Permalink
Browse files

Changed models.py AuthUser get_profile() from classmethod to instance…

…method, removed missed reference to Pyramid Apex
  • Loading branch information...
Qwait committed Nov 2, 2011
1 parent 82dec9a commit e94e63fcfe6495163517e164b9ac5f017e1fe7d4
Showing with 9 additions and 10 deletions.
  1. +8 −9 apex/models.py
  2. +1 −1 apex/templates/apex_template.mako
View
@@ -180,16 +180,16 @@ def check_password(cls, **kwargs):
else:
return False
@classmethod
def get_profile(cls, request=None):
def get_profile(self, request=None):
"""
Returns AuthUser.profile object, creates record if it doesn't exist.
.. code-block:: python
from apex.models import AuthUser
user = AuthUser.get_profile(request)
user = AuthUser.get_by_id(1)
profile = user.get_profile(request)
in **development.ini**
@@ -200,12 +200,11 @@ def get_profile(cls, request=None):
if not request:
request = get_current_request()
if authenticated_userid(request):
auth_profile = request.registry.settings.get('apex.auth_profile')
if auth_profile:
resolver = DottedNameResolver(auth_profile.split('.')[0])
profile_cls = resolver.resolve(auth_profile)
return get_or_create(DBSession, profile_cls, user_id=authenticated_userid(request))
auth_profile = request.registry.settings.get('apex.auth_profile')
if auth_profile:
resolver = DottedNameResolver(auth_profile.split('.')[0])
profile_cls = resolver.resolve(auth_profile)
return get_or_create(DBSession, profile_cls, user_id=self.id)
class AuthUserLog(Base):
"""
@@ -2,7 +2,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Pyramid Apex</title>
<title>Apex</title>
<%namespace file="apex:templates/flash_template.mako" import="*"/>
<link rel="stylesheet" href="${request.static_url('apex:static/css/apex_forms.css')}" type="text/css" media="screen" charset="utf-8" />

0 comments on commit e94e63f

Please sign in to comment.