diff server_side/blog.py @ 243:63e9b680d3e7

browser_side, blog: better PEP8 compliance
author souliane <souliane@mailoo.org>
date Tue, 15 Oct 2013 17:19:03 +0200
parents e632f77c4219
children 52b1afd7ac3f
line wrap: on
line diff
--- a/server_side/blog.py	Fri Oct 18 11:14:55 2013 +0200
+++ b/server_side/blog.py	Tue Oct 15 17:19:03 2013 +0200
@@ -44,10 +44,10 @@
                 </html>
                 """
 
-    def __init__(self,host):
+    def __init__(self, host):
         self.host = host
         Resource.__init__(self)
-        if not host.bridge.isConnected("libervia"): #FIXME: hard coded value for test
+        if not host.bridge.isConnected("libervia"):  # FIXME: hard coded value for test
             host.bridge.connect("libervia")
 
     def render_GET(self, request):
@@ -57,7 +57,7 @@
             prof_requested = request.postpath[0]
             #TODO: char check: only use alphanumerical chars + some extra(_,-,...) here
             prof_found = self.host.bridge.getProfileName(prof_requested)
-            if not prof_found or prof_found=='libervia':
+            if not prof_found or prof_found == 'libervia':
                 return MicroBlog.ERROR_TEMPLATE % "Invalid nickname"
             else:
                 def got_jid(pub_jid_s):
@@ -83,18 +83,18 @@
             </head>
             <body>
                 <div class='mblog_title'>%(user)s</div>
-            """ % {'user':user})
+            """ % {'user': user})
         #mblog_data.reverse()
         for entry in mblog_data:
-            timestamp = float(entry.get('timestamp',0))
+            timestamp = float(entry.get('timestamp', 0))
             _datetime = datetime.fromtimestamp(timestamp)
             request.write("""<div class='mblog_entry'><span class='mblog_timestamp'>%(date)s</span>
                           <span class='mblog_content'>%(content)s</span></div>""" % {
-                          'date':_datetime,
-                          'content':sanitizeHtml(entry['content']).encode('utf-8')})
+                          'date': _datetime,
+                          'content': sanitizeHtml(entry['content']).encode('utf-8')})
         request.write('</body></html>')
         request.finish()
-        
+
     def render_error_blog(self, error, request, profile):
         request.write(MicroBlog.ERROR_TEMPLATE % "Can't access requested data")
         request.finish()