Commit c28650ea authored by Denis Bilenko's avatar Denis Bilenko

webchat examples: pep8

parent efc4c6d1
...@@ -40,7 +40,7 @@ class ChatRoom(object): ...@@ -40,7 +40,7 @@ class ChatRoom(object):
try: try:
for index, m in enumerate(self.cache): for index, m in enumerate(self.cache):
if m['id'] == cursor: if m['id'] == cursor:
return json_response({'messages': self.cache[index+1:]}) return json_response({'messages': self.cache[index + 1:]})
return json_response({'messages': self.cache}) return json_response({'messages': self.cache})
finally: finally:
if self.cache: if self.cache:
...@@ -63,4 +63,3 @@ def create_message(from_, body): ...@@ -63,4 +63,3 @@ def create_message(from_, body):
def json_response(value, **kwargs): def json_response(value, **kwargs):
kwargs.setdefault('content_type', 'text/javascript; charset=UTF-8') kwargs.setdefault('content_type', 'text/javascript; charset=UTF-8')
return HttpResponse(simplejson.dumps(value), **kwargs) return HttpResponse(simplejson.dumps(value), **kwargs)
...@@ -11,12 +11,13 @@ from django.core.signals import got_request_exception ...@@ -11,12 +11,13 @@ from django.core.signals import got_request_exception
sys.path.append('..') sys.path.append('..')
os.environ['DJANGO_SETTINGS_MODULE'] = 'webchat.settings' os.environ['DJANGO_SETTINGS_MODULE'] = 'webchat.settings'
def exception_printer(sender, **kwargs): def exception_printer(sender, **kwargs):
traceback.print_exc() traceback.print_exc()
got_request_exception.connect(exception_printer) got_request_exception.connect(exception_printer)
call_command('syncdb') call_command('syncdb')
print 'Serving on 8088...' print 'Serving on 8088...'
WSGIServer(('', 8088), WSGIHandler()).serve_forever() WSGIServer(('', 8088), WSGIHandler()).serve_forever()
...@@ -11,4 +11,3 @@ urlpatterns += patterns('django.views.static', ...@@ -11,4 +11,3 @@ urlpatterns += patterns('django.views.static',
'serve', { 'serve', {
'document_root': settings.MEDIA_ROOT, 'document_root': settings.MEDIA_ROOT,
'show_indexes': True })) 'show_indexes': True }))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment