Commit c28650ea authored by Denis Bilenko's avatar Denis Bilenko

webchat examples: pep8

parent efc4c6d1
......@@ -40,7 +40,7 @@ class ChatRoom(object):
try:
for index, m in enumerate(self.cache):
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})
finally:
if self.cache:
......@@ -63,4 +63,3 @@ def create_message(from_, body):
def json_response(value, **kwargs):
kwargs.setdefault('content_type', 'text/javascript; charset=UTF-8')
return HttpResponse(simplejson.dumps(value), **kwargs)
#!/usr/bin/python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
......
......@@ -11,12 +11,13 @@ from django.core.signals import got_request_exception
sys.path.append('..')
os.environ['DJANGO_SETTINGS_MODULE'] = 'webchat.settings'
def exception_printer(sender, **kwargs):
traceback.print_exc()
got_request_exception.connect(exception_printer)
call_command('syncdb')
print 'Serving on 8088...'
WSGIServer(('', 8088), WSGIHandler()).serve_forever()
......@@ -11,4 +11,3 @@ urlpatterns += patterns('django.views.static',
'serve', {
'document_root': settings.MEDIA_ROOT,
'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