Skip to content

Commit

Permalink
close #1, #2
Browse files Browse the repository at this point in the history
  • Loading branch information
malanjp committed Jul 20, 2013
1 parent 8d371af commit cd0ac6b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
15 changes: 8 additions & 7 deletions cats/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
from socketio.mixins import RoomsMixin, BroadcastMixin
import mimetypes

from pprint import pprint


class BaseSocketIO(BaseNamespace, RoomsMixin, BroadcastMixin):
"""
Expand All @@ -17,9 +15,6 @@ class BaseSocketIO(BaseNamespace, RoomsMixin, BroadcastMixin):
def recv_disconnect(self):
self.disconnect(silent=True)

#def recv_message(self, message):
# print "PING!!!", message


class WSGIHandler(object):
"""
Expand Down Expand Up @@ -60,8 +55,7 @@ def dispatch(self, path, environ, start_response):
for cls in self.url_list:
if cls[0] == path:
instance = cls[1]()
response = getattr(instance,
self.methods[request.method.lower()])(request)
response = getattr(instance, request.method.lower())(request)
response = Response(body=response, charset='utf8')
return response(environ, start_response)

Expand All @@ -85,6 +79,13 @@ def http404(self, start_response):


class Cats:
def __init__(self, settings=None):
self.settings('settings')

def settings(self, settings=None):
if settings:
self.settings = __import__(settings)

def routes(self, urls=None):
"""
Routing.
Expand Down
7 changes: 6 additions & 1 deletion cats/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

default_mimetype = 'text/html'

env = Environment(loader=FileSystemLoader('templates'))

def load_settings(settings=None):
return __import__(settings)

def render_to_string(filename, context={}):
template = env.get_template(filename)
Expand All @@ -17,4 +19,7 @@ def render_template(filename, context={}, mimetype=default_mimetype, request=Non
return rendered


settings = load_settings('settings')
env = Environment(loader=FileSystemLoader(settings.templates_dir))


0 comments on commit cd0ac6b

Please sign in to comment.