257 def _build_repo(cls): |
257 def _build_repo(cls): |
258 cls.repo, cls.cnx = devtools.init_test_database(config=cls.config) |
258 cls.repo, cls.cnx = devtools.init_test_database(config=cls.config) |
259 cls.init_config(cls.config) |
259 cls.init_config(cls.config) |
260 cls.repo.hm.call_hooks('server_startup', repo=cls.repo) |
260 cls.repo.hm.call_hooks('server_startup', repo=cls.repo) |
261 cls.vreg = cls.repo.vreg |
261 cls.vreg = cls.repo.vreg |
262 cls.websession = DBAPISession(cls.cnx, cls.admlogin, |
262 cls.websession = DBAPISession(cls.cnx, cls.admlogin) |
263 {'password': cls.admpassword}) |
|
264 cls._orig_cnx = (cls.cnx, cls.websession) |
263 cls._orig_cnx = (cls.cnx, cls.websession) |
265 cls.config.repository = lambda x=None: cls.repo |
264 cls.config.repository = lambda x=None: cls.repo |
266 |
265 |
267 @classmethod |
266 @classmethod |
268 def _refresh_repo(cls): |
267 def _refresh_repo(cls): |
479 def pviews(self, req, rset): |
478 def pviews(self, req, rset): |
480 return sorted((a.__regid__, a.__class__) |
479 return sorted((a.__regid__, a.__class__) |
481 for a in self.vreg['views'].possible_views(req, rset=rset)) |
480 for a in self.vreg['views'].possible_views(req, rset=rset)) |
482 |
481 |
483 def pactions(self, req, rset, |
482 def pactions(self, req, rset, |
484 skipcategories=('addrelated', 'siteactions', 'useractions', 'footer')): |
483 skipcategories=('addrelated', 'siteactions', 'useractions', |
|
484 'footer', 'manage')): |
485 return [(a.__regid__, a.__class__) |
485 return [(a.__regid__, a.__class__) |
486 for a in self.vreg['actions'].poss_visible_objects(req, rset=rset) |
486 for a in self.vreg['actions'].poss_visible_objects(req, rset=rset) |
487 if a.category not in skipcategories] |
487 if a.category not in skipcategories] |
488 |
488 |
489 def pactions_by_cats(self, req, rset, categories=('addrelated',)): |
489 def pactions_by_cats(self, req, rset, categories=('addrelated',)): |
490 return [(a.__regid__, a.__class__) |
490 return [(a.__regid__, a.__class__) |
491 for a in self.vreg['actions'].poss_visible_objects(req, rset=rset) |
491 for a in self.vreg['actions'].poss_visible_objects(req, rset=rset) |
492 if a.category in categories] |
492 if a.category in categories] |
493 |
493 |
494 def pactionsdict(self, req, rset, |
494 def pactionsdict(self, req, rset, |
495 skipcategories=('addrelated', 'siteactions', 'useractions', 'footer')): |
495 skipcategories=('addrelated', 'siteactions', 'useractions', |
|
496 'footer', 'manage')): |
496 res = {} |
497 res = {} |
497 for a in self.vreg['actions'].poss_visible_objects(req, rset=rset): |
498 for a in self.vreg['actions'].poss_visible_objects(req, rset=rset): |
498 if a.category not in skipcategories: |
499 if a.category not in skipcategories: |
499 res.setdefault(a.category, []).append(a.__class__) |
500 res.setdefault(a.category, []).append(a.__class__) |
500 return res |
501 return res |