app/soc/views/models/user_self.py
changeset 656 a76f1b443ea4
parent 650 33b6dcae5615
child 660 5a381b290691
equal deleted inserted replaced
655:9635cbaa2dcd 656:a76f1b443ea4
    84     ' <li>the account is already attached to a User profile and cannot be'
    84     ' <li>the account is already attached to a User profile and cannot be'
    85     ' used to create another one</li>'
    85     ' used to create another one</li>'
    86     ' <li>the account is a former account that cannot be used again</li>'
    86     ' <li>the account is a former account that cannot be used again</li>'
    87     '</ul>')
    87     '</ul>')
    88 
    88 
    89   def __init__(self, original_params=None):
    89   def __init__(self, params=None):
    90     """Defines the fields and methods required for the base View class
    90     """Defines the fields and methods required for the base View class
    91     to provide the user with list, public, create, edit and delete views.
    91     to provide the user with list, public, create, edit and delete views.
    92 
    92 
    93     Params:
    93     Params:
    94       original_params: a dict with params for this View
    94       params: a dict with params for this View
    95     """
    95     """
    96 
    96 
    97     rights = {}
    97     rights = {}
    98     rights['unspecified'] = [access.deny]
    98     rights['unspecified'] = [access.deny]
    99     rights['any_access'] = [access.allow]
    99     rights['any_access'] = [access.allow]
   100     rights['editSelf'] = [access.checkIsLoggedIn]
   100     rights['editSelf'] = [access.checkIsLoggedIn]
   101     rights['roles'] = [access.checkIsUser]
   101     rights['roles'] = [access.checkIsUser]
   102     rights['signIn'] = [access.checkNotLoggedIn]
   102     rights['signIn'] = [access.checkNotLoggedIn]
   103 
   103 
   104     params = {}
   104     new_params = {}
   105     params['rights'] = rights
   105     new_params['rights'] = rights
   106     params['logic'] = soc.logic.models.user.logic
   106     new_params['logic'] = soc.logic.models.user.logic
   107 
   107 
   108     params['name'] = "User"
   108     new_params['name'] = "User"
   109     params['name_short'] = "User"
   109     new_params['name_short'] = "User"
   110     params['name_plural'] = "Users"
   110     new_params['name_plural'] = "Users"
   111     params['url_name'] = "user"
   111     new_params['url_name'] = "user"
   112     params['module_name'] = "user_self"
   112     new_params['module_name'] = "user_self"
   113     
   113     
   114     params['sidebar_heading'] = 'Users'
   114     new_params['sidebar_heading'] = 'Users'
   115 
   115 
   116     params = dicts.merge(original_params, params)
   116     params = dicts.merge(params, new_params)
   117 
   117 
   118     base.View.__init__(self, params=params)
   118     super(View, self).__init__(params=params)
   119 
   119 
   120   EDIT_SELF_TMPL = 'soc/user/edit_self.html'
   120   EDIT_SELF_TMPL = 'soc/user/edit_self.html'
   121 
   121 
   122   def edit(self, request, page_name=None, params=None, seed=None, **kwargs):
   122   def edit(self, request, page_name=None, params=None, seed=None, **kwargs):
   123     """Displays User self edit page for the entity specified by **kwargs.
   123     """Displays User self edit page for the entity specified by **kwargs.