325 **kwargs): |
325 **kwargs): |
326 """shortcut to self.vreg.view method avoiding to pass self.req""" |
326 """shortcut to self.vreg.view method avoiding to pass self.req""" |
327 return self.vreg[__registry].render(__vid, self.req, __fallback_oid, |
327 return self.vreg[__registry].render(__vid, self.req, __fallback_oid, |
328 rset=rset, **kwargs) |
328 rset=rset, **kwargs) |
329 |
329 |
330 # url generation methods ################################################## |
|
331 |
|
332 controller = 'view' |
|
333 |
|
334 def build_url(self, *args, **kwargs): |
|
335 """return an absolute URL using params dictionary key/values as URL |
|
336 parameters. Values are automatically URL quoted, and the |
|
337 publishing method to use may be specified or will be guessed. |
|
338 """ |
|
339 # use *args since we don't want first argument to be "anonymous" to |
|
340 # avoid potential clash with kwargs |
|
341 if args: |
|
342 assert len(args) == 1, 'only 0 or 1 non-named-argument expected' |
|
343 method = args[0] |
|
344 else: |
|
345 method = None |
|
346 # XXX I (adim) think that if method is passed explicitly, we should |
|
347 # not try to process it and directly call req.build_url() |
|
348 if method is None: |
|
349 method = self.controller |
|
350 if method == 'view' and self.req.from_controller() == 'view' and \ |
|
351 not '_restpath' in kwargs: |
|
352 method = self.req.relative_path(includeparams=False) or 'view' |
|
353 return self.req.build_url(method, **kwargs) |
|
354 |
|
355 # deprecated ############################################################### |
330 # deprecated ############################################################### |
356 |
331 |
357 @classproperty |
332 @classproperty |
358 @deprecated('[3.4] use __select__ and & or | operators') |
333 @deprecated('[3.4] use __select__ and & or | operators') |
359 def __selectors__(cls): |
334 def __selectors__(cls): |
380 |
355 |
381 @deprecated('[3.5] use req.get_cache') |
356 @deprecated('[3.5] use req.get_cache') |
382 def get_cache(self, cachename): |
357 def get_cache(self, cachename): |
383 return self.req.get_cache(cachename) |
358 return self.req.get_cache(cachename) |
384 |
359 |
|
360 @deprecated('[3.5] use req.build_url') |
|
361 def build_url(self, *args, **kwargs): |
|
362 return self.req.build_url(*args, **kwargs) |
|
363 |
385 @deprecated('[3.5] use rset.limited_rql') |
364 @deprecated('[3.5] use rset.limited_rql') |
386 def limited_rql(self): |
365 def limited_rql(self): |
387 return self.rset.limited_rql() |
366 return self.rset.limited_rql() |
388 |
367 |
389 @deprecated('[3.5] use self.rset.complete_entity(row,col) instead') |
368 @deprecated('[3.5] use self.rset.complete_entity(row,col) instead') |