351 |
352 |
352 # other utilities ######################################################### |
353 # other utilities ######################################################### |
353 |
354 |
354 def entity(self, rql, args=None, eidkey=None, req=None): |
355 def entity(self, rql, args=None, eidkey=None, req=None): |
355 return self.execute(rql, args, eidkey, req=req).get_entity(0, 0) |
356 return self.execute(rql, args, eidkey, req=req).get_entity(0, 0) |
|
357 |
|
358 @contextmanager |
|
359 def temporary_appobjects(self, *appobjects): |
|
360 self.vreg._loadedmods.setdefault(self.__module__, {}) |
|
361 for obj in appobjects: |
|
362 self.vreg.register(obj) |
|
363 yield |
|
364 for obj in appobjects: |
|
365 self.vreg.unregister(obj) |
356 |
366 |
357 # vregistry inspection utilities ########################################### |
367 # vregistry inspection utilities ########################################### |
358 |
368 |
359 def pviews(self, req, rset): |
369 def pviews(self, req, rset): |
360 return sorted((a.__regid__, a.__class__) |
370 return sorted((a.__regid__, a.__class__) |