Commits

Gael Pasgrimaud committed 9f9caf8

fix test_couchdb

  • Participants
  • Parent commits 21a213b

Comments (0)

Files changed (3)

shabti/template.py

 
 
 class ShabtiAuthCouchdbTemplate(Template):
-    required_templates = ['pylons']
+    required_templates = ['shabti_auth']
     _template_dir = 'templates/auth_couchdb'
     summary = 'Shabti auth using CouchDB'
     template_renderer = staticmethod(paste_script_template_renderer)

shabti/templates/auth_couchdb/+package+/lib/auth/__init__.py_tmpl

-from pylons import request, session, url
-from pylons.controllers.util import redirect
-from {{package}}.model import *
-
-_login_url = 'login'
-_auth_user_environ_key = 'AUTH_USER'
-_auth_user_session_key = 'AUTH_USER_ID'
-
-def get_user():
-    if _auth_user_environ_key not in request.environ:
-        user_id = session.get(_auth_user_session_key)
-        if user_id:
-            request.environ[_auth_user_environ_key] = user_id
-        else:
-            request.environ[_auth_user_environ_key] = None
-    return request.environ[_auth_user_environ_key]
-
-def login(u):
-    session[_auth_user_session_key] = u.id
-    session.save()
-
-def logout():
-    session.pop(_auth_user_session_key, None)
-    session.clear()
-    session.delete()
-
-def redirect_to_login():
-    redirect(url(controller=_login_url))
-

shabti/templates/default/+package+/tests/test_models.py_tmpl

+{{if sqlalchemy}}
 # default/tests/test_models
 from sqlalchemy.exceptions import IntegrityError
 from elixir import *
 
 
 # --- Added by Shabti default template
-
+{{endif}}