common/appobject.py
branchtls-sprint
changeset 683 4f4a34346e9b
parent 662 6f867ab70e3d
child 692 800592b8d39b
equal deleted inserted replaced
682:d95936d6ce5c 683:4f4a34346e9b
    62         cls.config = vreg.config
    62         cls.config = vreg.config
    63         cls.register_properties()
    63         cls.register_properties()
    64         return cls
    64         return cls
    65 
    65 
    66     @classmethod
    66     @classmethod
    67     def selected(cls, req, rset, row=None, col=None, **kwargs):
    67     def selected(cls, *args, **kwargs):
    68         """by default web app objects are usually instantiated on
    68         """by default web app objects are usually instantiated on
    69         selection according to a request, a result set, and optional
    69         selection according to a request, a result set, and optional
    70         row and col
    70         row and col
    71         """
    71         """
    72         instance = cls(req, rset)
    72         instance = cls(*args)
    73         instance.row = row
    73         instance.row = kwargs.pop('row', None)
    74         instance.col = col
    74         instance.col = kwargs.pop('col', None)
    75         instance.sel_kwargs = kwargs
    75         instance.selection_kwargs = kwargs
    76         return instance
    76         return instance
    77 
    77 
    78     # Eproperties definition:
    78     # Eproperties definition:
    79     # key: id of the property (the actual EProperty key is build using
    79     # key: id of the property (the actual EProperty key is build using
    80     #      <registry name>.<obj id>.<property id>
    80     #      <registry name>.<obj id>.<property id>
    98     @classmethod
    98     @classmethod
    99     def propkey(cls, propid):
    99     def propkey(cls, propid):
   100         return '%s.%s.%s' % (cls.__registry__, cls.id, propid)
   100         return '%s.%s.%s' % (cls.__registry__, cls.id, propid)
   101             
   101             
   102         
   102         
   103     def __init__(self, req, rset):
   103     def __init__(self, req=None, rset=None):
   104         super(AppRsetObject, self).__init__()
   104         super(AppRsetObject, self).__init__()
   105         self.req = req
   105         self.req = req
   106         self.rset = rset
   106         self.rset = rset
   107 
   107 
   108     @property
   108     @property