equal
deleted
inserted
replaced
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 assert len(args) <= 2 |
72 assert len(args) <= 2 |
73 # for key in ('req', 'rset'): |
73 return cls(*args, **kwargs) |
74 # if key in kwargs: |
|
75 # args += (kwargs.pop(key),) |
|
76 instance = cls(*args) |
|
77 instance.row = kwargs.pop('row', None) |
|
78 instance.col = kwargs.pop('col', None) |
|
79 instance.extra_kwargs = kwargs |
|
80 return instance |
|
81 |
74 |
82 # Eproperties definition: |
75 # Eproperties definition: |
83 # key: id of the property (the actual EProperty key is build using |
76 # key: id of the property (the actual EProperty key is build using |
84 # <registry name>.<obj id>.<property id> |
77 # <registry name>.<obj id>.<property id> |
85 # value: tuple (property type, vocabfunc, default value, property description) |
78 # value: tuple (property type, vocabfunc, default value, property description) |
111 return tuple(selector.selectors) |
104 return tuple(selector.selectors) |
112 if not isinstance(selector, tuple): |
105 if not isinstance(selector, tuple): |
113 selector = (selector,) |
106 selector = (selector,) |
114 return selector |
107 return selector |
115 |
108 |
116 def __init__(self, req=None, rset=None): |
109 def __init__(self, req=None, rset=None, row=None, col=None, **extra): |
117 super(AppRsetObject, self).__init__() |
110 super(AppRsetObject, self).__init__() |
118 self.req = req |
111 self.req = req |
119 self.rset = rset |
112 self.rset = rset |
|
113 self.row = row |
|
114 self.col = col |
|
115 self.extra_kwargs = extra |
120 |
116 |
121 def get_cache(self, cachename): |
117 def get_cache(self, cachename): |
122 """ |
118 """ |
123 NOTE: cachename should be dotted names as in : |
119 NOTE: cachename should be dotted names as in : |
124 - cubicweb.mycache |
120 - cubicweb.mycache |
141 return cache |
137 return cache |
142 |
138 |
143 def propval(self, propid): |
139 def propval(self, propid): |
144 assert self.req |
140 assert self.req |
145 return self.req.property_value(self.propkey(propid)) |
141 return self.req.property_value(self.propkey(propid)) |
146 |
|
147 |
142 |
148 def limited_rql(self): |
143 def limited_rql(self): |
149 """return a printable rql for the result set associated to the object, |
144 """return a printable rql for the result set associated to the object, |
150 with limit/offset correctly set according to maximum page size and |
145 with limit/offset correctly set according to maximum page size and |
151 currently displayed page when necessary |
146 currently displayed page when necessary |