Commits

jvanasco committed b04b655

* migrated helpers to /lib/helpers at the suggestion of mike orr

Comments (0)

Files changed (5)

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/handlers/account.py_tmpl

 class AccountHandler(BaseHandler):
     """
         This AccountHander does not actually do any auth.
-        We're simply checking / setting a session value, based on routines in {{package}}.helpers
+        We're simply checking / setting a session value, based on routines in {{package}}.lib.helpers
         
         Pyramid offers a full fledged security system with Auth & Access Control
         You can view the full docs here:
             Many people believe that helpers should be a single file used for text transformations in templates.
             Others belive it is okay to have 'lib' style functions in it.
         
-            Placing these reference login functions into /helpers is only done for an initial convenience to illustrate functionality.  This is not meant to advocate one mechansim over another.
+            Placing these reference login functions into /lib/helpers is only done for an initial convenience to illustrate functionality.  This is not meant to advocate one mechansim over another.
         
         Notes on auth:
         
     def login(self):
         # http://docs.pylonsproject.org/projects/pyramid/dev/narr/webob.html#request
         if self.request.method == 'POST' :
-            {{package}}.helpers.do_login()
+            {{package}}.lib.helpers.do_login()
             return HTTPFound(location='/account/home')
         return render_to_response('/account/login/form.mako', {'project':'{{package}}'}, self.request) 
 
 
 
     def logout(self):
-        {{package}}.helpers.do_logout()
+        {{package}}.lib.helpers.do_logout()
         return HTTPFound(location='/')
 
 
 
     @action(renderer='/account/home.mako')
     def home(self):
-        if not {{package}}.helpers.is_logged_in() :
+        if not {{package}}.lib.helpers.is_logged_in() :
             return HTTPFound(location='/account/login')
         return {'project':'{{package}}'}
 

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/helpers/__init__.py

-"""Helper functions
-
-This module is available as the ``h`` variable in templates, and can also be
-imported into handler modules or elsewhere. Put any common functions you want
-to access in all templates here.
-
-The WebHelpers package (http://python.org/pypi/WebHelpers) contains some
-commonly used helpers for HTML tag creation, text formatting, number
-formatting, etc.
-
-The template globals (``h`` et al) are set in
-``{{package}}.subscribers.add_renderer_globals()``.
-
-
-NOTE on pyramid_sqla_quickstart functions:
-	Many people believe that helpers should be a single file used for text transformations in templates.
-    Others belive it is okay to have 'lib' style functions in it.
-        
-    Placing these reference login functions into /helpers is only done for an initial convenience to illustrate functionality.  This is not meant to advocate one mechansim over another.
-
-"""
-
-#from webhelpers.html import *
-#from webhelpers.html.tags import *
-
-from pyramid.threadlocal import get_current_request
-
-
-def do_login():
-    """REFERENCE FUNCTION
-This is meant for illutration only.
-    """
-    session= get_current_request().session
-    session['logged_in']= True
-    
-
-def do_logout():
-    """REFERENCE FUNCTION
-This is meant for illutration only.
-    """
-    session= get_current_request().session
-    if 'logged_in' in session :
-        del session['logged_in']
-
-
-def is_logged_in():
-    """REFERENCE FUNCTION
-This is meant for illutration only.
-    """
-    session= get_current_request().session
-    if not session:
-        return False
-    if 'logged_in' in session and session['logged_in']:
-        return session['logged_in']
-    return False

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/lib/__init__.py

Empty file added.

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/lib/helpers/__init__.py

+"""Helper functions
+
+This module is available as the ``h`` variable in templates, and can also be
+imported into handler modules or elsewhere. Put any common functions you want
+to access in all templates here.
+
+The WebHelpers package (http://python.org/pypi/WebHelpers) contains some
+commonly used helpers for HTML tag creation, text formatting, number
+formatting, etc.
+
+The template globals (``h`` et al) are set in
+``{{package}}.subscribers.add_renderer_globals()``.
+
+
+NOTE on pyramid_sqla_quickstart functions:
+	Many people believe that helpers should be a single file used for text transformations in templates.
+    Others belive it is okay to have 'lib' style functions in it.
+        
+    Placing these reference login functions into /helpers is only done for an initial convenience to illustrate functionality.  This is not meant to advocate one mechansim over another.
+
+"""
+
+#from webhelpers.html import *
+#from webhelpers.html.tags import *
+
+from pyramid.threadlocal import get_current_request
+
+
+def do_login():
+    """REFERENCE FUNCTION
+This is meant for illutration only.
+    """
+    session= get_current_request().session
+    session['logged_in']= True
+    
+
+def do_logout():
+    """REFERENCE FUNCTION
+This is meant for illutration only.
+    """
+    session= get_current_request().session
+    if 'logged_in' in session :
+        del session['logged_in']
+
+
+def is_logged_in():
+    """REFERENCE FUNCTION
+This is meant for illutration only.
+    """
+    session= get_current_request().session
+    if not session:
+        return False
+    if 'logged_in' in session and session['logged_in']:
+        return session['logged_in']
+    return False

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/subscribers.py_tmpl

 from pyramid.url import route_url
 from pyramid.url import current_route_url
 
-import {{package}}.helpers as helpers
+import {{package}}.lib.helpers as helpers
 
 def add_renderer_globals(event):
     """ A subscriber to the ``pyramid.events.BeforeRender`` events.  Updates