devtools/testlib.py
branchstable
changeset 7324 5f7813ae9fb8
parent 7313 02fb1dcc99a2
child 7331 7fcc4f22f3e4
equal deleted inserted replaced
7321:0a1c405384d0 7324:5f7813ae9fb8
   358     def create_user(self, req, login=None, groups=('users',), password=None,
   358     def create_user(self, req, login=None, groups=('users',), password=None,
   359                     commit=True, **kwargs):
   359                     commit=True, **kwargs):
   360         """create and return a new user entity"""
   360         """create and return a new user entity"""
   361         if isinstance(req, basestring):
   361         if isinstance(req, basestring):
   362             warn('[3.12] create_user arguments are now (req, login[, groups, password, commit, **kwargs])',
   362             warn('[3.12] create_user arguments are now (req, login[, groups, password, commit, **kwargs])',
   363                  DeprecationWarning, stacklevel=1)
   363                  DeprecationWarning, stacklevel=2)
   364             if not isinstance(groups, (tuple, list)):
   364             if not isinstance(groups, (tuple, list)):
   365                 password = groups
   365                 password = groups
   366                 groups = login
   366                 groups = login
   367             elif isinstance(login, tuple):
   367             elif isinstance(login, tuple):
   368                 groups = login
   368                 groups = login
   389         """insert a permission on an entity. Will have to commit the main
   389         """insert a permission on an entity. Will have to commit the main
   390         connection to be considered
   390         connection to be considered
   391         """
   391         """
   392         if not isinstance(session, Session):
   392         if not isinstance(session, Session):
   393             warn('[3.12] grant_permission arguments are now (session, entity, group, pname[, plabel])',
   393             warn('[3.12] grant_permission arguments are now (session, entity, group, pname[, plabel])',
   394                  DeprecationWarning, stacklevel=1)
   394                  DeprecationWarning, stacklevel=2)
   395             plabel = pname
   395             plabel = pname
   396             pname = group
   396             pname = group
   397             group = entity
   397             group = entity
   398             entity = session
   398             entity = session
   399             assert not isinstance(self, type)
   399             assert not isinstance(self, type)