Permalink
Browse files

Applied PEP8 to all python files.

  • Loading branch information...
1 parent 25385dd commit 2a163300e5f3853b76b47415806c236386ff2fa1 Paddy Foran committed Jul 8, 2011
Showing with 208 additions and 184 deletions.
  1. +1 −1 appengine_config.py
  2. +7 −6 auth.py
  3. +35 −33 channels.py
  4. +165 −144 devlinks.py
View
@@ -1,2 +1,2 @@
def webapp_add_wsgi_middleware(app):
- return app
+ return app
View
13 auth.py
@@ -1,9 +1,10 @@
from google.appengine.api import users, oauth
+
def getCurrentUser():
- user = False
- try:
- user = oauth.get_current_user()
- except:
- user = users.get_current_user()
- return user
+ user = False
+ try:
+ user = oauth.get_current_user()
+ except:
+ user = users.get_current_user()
+ return user
View
@@ -1,42 +1,44 @@
from django.utils import simplejson
from google.appengine.api import channel, memcache
-import models, stats
+import models
+import stats
+
class Channel():
- token = None
- address = None
- cached = True
- message = {}
+ token = None
+ address = None
+ cached = True
+ message = {}
- def __init__(self, address, generate=True):
- self.address = address
- if generate:
- self.token = memcache.get("token_%s" % self.address)
- if self.token is None:
- device = models.getDevice(self.address)
- if device.token and device.tokenValid():
- self.token = device.token
- else:
- self.token = channel.create_channel(self.address)
- stats.record("channel_created", self.address)
- self.cached = False
- device.updateToken(self.token)
- memcache.set("token_%s" % self.address, self.token, time=7200)
+ def __init__(self, address, generate=True):
+ self.address = address
+ if generate:
+ self.token = memcache.get("token_%s" % self.address)
+ if self.token is None:
+ device = models.getDevice(self.address)
+ if device.token and device.tokenValid():
+ self.token = device.token
+ else:
+ self.token = channel.create_channel(self.address)
+ stats.record("channel_created", self.address)
+ self.cached = False
+ device.updateToken(self.token)
+ memcache.set("token_%s" % self.address, self.token, time=7200)
- def send(self):
- channel.send_message(self.address, simplejson.dumps(self.message))
- self.message.clear()
+ def send(self):
+ channel.send_message(self.address, simplejson.dumps(self.message))
+ self.message.clear()
- def queueLink(self, link):
- if 'links' not in self.message:
- self.message['links'] = []
- link_message = {}
- link_message['id'] = link.key().id_or_name()
- link_message['url'] = link.url
- link_message['sender'] = link.sender.address
- self.message['links'].append(link_message)
+ def queueLink(self, link):
+ if 'links' not in self.message:
+ self.message['links'] = []
+ link_message = {}
+ link_message['id'] = link.key().id_or_name()
+ link_message['url'] = link.url
+ link_message['sender'] = link.sender.address
+ self.message['links'].append(link_message)
- def sendLink(self, link):
- self.queueLink(link)
- self.send()
+ def sendLink(self, link):
+ self.queueLink(link)
+ self.send()
Oops, something went wrong.

0 comments on commit 2a16330

Please sign in to comment.