Nattaphoom Ch. avatar Nattaphoom Ch. committed 4f8c8d1

http://stackoverflow.com/a/2070798/606355 says: Use backslashes as a
last resort. So, I delete it, especially in if/else and use parenthesis
() instead.

Comments (0)

Files changed (3)

accounts/activation.py

 def send_activation(user):
     time.sleep(5)
     code = md5(user.username).hexdigest()
-    url = "http://appnosystem.com/accounts/activate/?username=%s&code=%s" %\
-    (user.username, code)
+    url = ("http://appnosystem.com/accounts/activate/?username=%s&code=%s" %
+            (user.username, code))
     print url
     template = loader.get_template('registration/activation.html')
     context = Context({

ans_gcm/widgets.py

             #output.append(image_url + '<br />' + file_name)
             try:
                 picture = open(settings.MEDIA_ROOT + '/' + file_name)
-                thumbnailer = get_thumbnailer(picture, relative_name='avatars/' + user_name + '/' + file_extension)
-                thumb = thumbnailer.get_thumbnail({'size': (149, 149), 'crop': True})
+                thumbnailer = get_thumbnailer(picture,
+                        relative_name=('avatars/%s/%s' %
+                            (user_name, file_extension)))
+                        #'avatars/' + user_name + '/' +
+                         #   file_extension))
+                         # TODO(me) just in case
+                thumb = thumbnailer.get_thumbnail({'size': (149, 149),
+                    'crop': True})
                 output.append(
-                        u'<a href="%s" target="_blank">\
-                                <img src="%s" alt="%s" /></a> %s ' % (
+                        u'<a href="%s" target="_blank">'
+                                '<img src="%s" alt="%s" /></a> %s ' % (
                                     thumb.url, thumb.url, file_name, '')
                                 )
             except IOError:
             # handle coercing to Unicode: need string or buffer, NoneType found
             stub_image_url = settings.STATIC_URL + 'images/profile_pic1.jpg'
             output.append(
-                    u' <a href="%s" target="_blank">\
-                            <img src="%s" alt="%s" /></a> %s ' % (
-                                stub_image_url, stub_image_url, 'stub', ''))
+                    u' <a href="%s" target="_blank">'
+                    '<img src="%s" alt="%s" /></a> %s ' % (
+                        stub_image_url, stub_image_url, 'stub', ''))
         output.append(super(AdminFileWidget, self).render(
             name, value, attrs))
         return mark_safe(u''.join(output))
                         asterisk_username=recipient)
             except ANSUser.DoesNotExist:
                 return HttpResponse(
-                        "Extension '%s' is not registered with ANS,\
-                        visit http://appnosystem.com for more information." %
+                        "Extension '%s' is not registered with ANS, "
+                        "visit http://appnosystem.com for more information." %
                         recipient)
         else:
             try:
             message.save()
             # check whether message have agenda or not?
             if request.POST['agenda'] == 'true':
-                if 'date_value' in request.POST and\
-                        'time_value' in request.POST:
+                if ('date_value' in request.POST and
+                        'time_value' in request.POST):
                     date = request.POST['date_value'] + ' ' + request.POST[
                             'time_value']
                 else:
 
     def create(self, request):
         ans_user = ANSUser.objects.get(username=request.user.username)
-        if 'approve_agenda' in request.POST and\
-                request.POST['approve_agenda'] == 'true':
+        if ('approve_agenda' in request.POST and
+                request.POST['approve_agenda'] == 'true'):
             agenda_id = request.POST['agenda_id']
             that_agenda = Agenda.objects.get(id=agenda_id)
             that_agenda.confirm = True
             that_agenda.save()
             return HttpResponse('Agenda %s approved' % str(that_agenda))
 
-        if 'delete_agenda' in request.POST and\
-                request.POST['delete_agenda'] == 'true':
+        if ('delete_agenda' in request.POST and
+                request.POST['delete_agenda'] == 'true'):
             agenda_id = request.POST['agenda_id']
             that_agenda = Agenda.objects.get(id=agenda_id)
             that_agenda.delete()
 
         all_message = Message.objects.all()
         agendas_list = []
-        if 'get_unconfirm_agendas' in request.POST and\
-                request.POST['get_unconfirm_agendas'] == 'true':
+        if ('get_unconfirmed_agendas' in request.POST and
+                request.POST['get_unconfirmed_agendas'] == 'true'):
             for message in all_message:
                 if message.sender == ans_user or message.recipient == ans_user:
                     agendas_list.extend(Agenda.objects.filter(
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.