--- a/appobject.py Thu Aug 13 11:24:52 2009 +0200
+++ b/appobject.py Thu Aug 13 11:32:34 2009 +0200
@@ -313,8 +313,8 @@
# overriding) only the first encountered definition is considered, so those
# objects can't try to have different default values for instance.
#
- # you can then access to a property value using self.propval, where self is
- # an instance of class
+ # you can then access to a property value using self.cw_propval, where self
+ # is an instance of class
@classmethod
def _cwpropkey(cls, propid):
--- a/cwvreg.py Thu Aug 13 11:24:52 2009 +0200
+++ b/cwvreg.py Thu Aug 13 11:32:34 2009 +0200
@@ -65,10 +65,10 @@
obj = self.select(__fallback_oid, req, **kwargs)
return obj.render(**kwargs)
- @deprecated('[3.5] use select_or_none and test for obj.propval("visible")')
+ @deprecated('[3.5] use select_or_none and test for obj.cw_propval("visible")')
def select_vobject(self, oid, *args, **kwargs):
selected = self.select_or_none(oid, *args, **kwargs)
- if selected and selected.propval('visible'):
+ if selected and selected.cw_propval('visible'):
return selected
return None
@@ -78,8 +78,8 @@
visualizable objects)
"""
return sorted([x for x in self.possible_objects(*args, **kwargs)
- if x.propval('visible')],
- key=lambda x: x.propval('order'))
+ if x.cw_propval('visible')],
+ key=lambda x: x.cw_propval('order'))
possible_vobjects = deprecated('[3.5] use poss_visible_objects()')(poss_visible_objects)
--- a/entity.py Thu Aug 13 11:24:52 2009 +0200
+++ b/entity.py Thu Aug 13 11:32:34 2009 +0200
@@ -384,7 +384,7 @@
kwargs['_restpath'] = self.rest_path()
else:
kwargs['rql'] = 'Any X WHERE X eid %s' % self.eid
- return self.build_url(method, **kwargs)
+ return self.req.build_url(method, **kwargs)
def rest_path(self, use_ext_eid=False):
"""returns a REST-like (relative) path for this entity"""
@@ -682,7 +682,7 @@
return self.related(rtype, role, limit, entities)
def related_rql(self, rtype, role='subject'):
- rschema = self.schema[rtype]
+ rschema = self.req.vreg.schema[rtype]
if role == 'subject':
targettypes = rschema.objects(self.e_schema)
restriction = 'E eid %%(x)s, E %s X' % rtype
@@ -736,7 +736,7 @@
"""
ordermethod = ordermethod or 'fetch_unrelated_order'
if isinstance(rtype, basestring):
- rtype = self.schema.rschema(rtype)
+ rtype = self.req.vreg.schema.rschema(rtype)
if role == 'subject':
evar, searchedvar = 'S', 'O'
subjtype, objtype = self.e_schema, targettype
@@ -801,7 +801,7 @@
"""set cached values for the given relation"""
if rset:
related = list(rset.entities(col))
- rschema = self.schema.rschema(rtype)
+ rschema = self.req.vreg.schema.rschema(rtype)
if role == 'subject':
rcard = rschema.rproperty(self.e_schema, related[0].e_schema,
'cardinality')[1]
--- a/sobjects/notification.py Thu Aug 13 11:24:52 2009 +0200
+++ b/sobjects/notification.py Thu Aug 13 11:32:34 2009 +0200
@@ -42,7 +42,7 @@
'X primary_email E, E address A')
def recipients(self):
- mode = self.config['default-recipients-mode']
+ mode = self.req.vreg.config['default-recipients-mode']
if mode == 'users':
# use unsafe execute else we may don't have the right to see users
# to notify...
@@ -51,7 +51,7 @@
for u in execute(self.user_rql, build_descr=True, propagate=True).entities()]
elif mode == 'default-dest-addrs':
lang = self.vreg.property_value('ui.language')
- dests = zip(self.config['default-dest-addrs'], repeat(lang))
+ dests = zip(self.req.vreg.config['default-dest-addrs'], repeat(lang))
else: # mode == 'none'
dests = []
return dests
@@ -171,7 +171,7 @@
self.w(self.req._(self.content) % self.context(**kwargs))
def construct_message_id(self, eid):
- return construct_message_id(self.config.appid, eid, self.msgid_timestamp)
+ return construct_message_id(self.req.vreg.config.appid, eid, self.msgid_timestamp)
def render_and_send(self, **kwargs):
"""generate and send an email message for this view"""
@@ -211,7 +211,7 @@
content = self.render(row=0, col=0, **kwargs)
subject = self.subject()
msg = format_mail(userdata, [emailaddr], content, subject,
- config=self.config, msgid=msgid, references=refs)
+ config=self.req.vreg.config, msgid=msgid, references=refs)
self.send([emailaddr], msg)
# restore language
self.req.set_language(origlang)
--- a/view.py Thu Aug 13 11:24:52 2009 +0200
+++ b/view.py Thu Aug 13 11:32:34 2009 +0200
@@ -481,7 +481,7 @@
__select__ = yes()
def div_class(self):
- return '%s %s' % (self.propval('htmlclass'), self.id)
+ return '%s %s' % (self.cw_propval('htmlclass'), self.id)
def div_id(self):
return '%sComponent' % self.id
--- a/web/views/basecomponents.py Thu Aug 13 11:24:52 2009 +0200
+++ b/web/views/basecomponents.py Thu Aug 13 11:32:34 2009 +0200
@@ -47,7 +47,7 @@
<input type="text" id="rql" name="rql" value="%s" title="%s" tabindex="%s" accesskey="q" class="searchField" />
<input type="submit" value="" class="rqlsubmit" tabindex="%s" />
</fieldset>
-''' % (not self.propval('visible') and 'hidden' or '',
+''' % (not self.cw_propval('visible') and 'hidden' or '',
self.build_url('view'), xml_escape(rql), req._('full text or RQL query'), req.next_tabindex(),
req.next_tabindex()))
if self.req.search_state[0] != 'normal':
--- a/web/views/basetemplates.py Thu Aug 13 11:24:52 2009 +0200
+++ b/web/views/basetemplates.py Thu Aug 13 11:32:34 2009 +0200
@@ -115,7 +115,7 @@
# display entity type restriction component
etypefilter = self.vreg['components'].select_or_none(
'etypenavigation', self.req, rset=self.rset)
- if etypefilter and etypefilter.propval('visible'):
+ if etypefilter and etypefilter.cw_propval('visible'):
etypefilter.render(w=w)
self.nav_html = UStringIO()
if view and view.need_navigation:
@@ -258,7 +258,7 @@
def topleft_header(self):
logo = self.vreg['components'].select_or_none('logo', self.req,
rset=self.rset)
- if logo and logo.propval('visible'):
+ if logo and logo.cw_propval('visible'):
self.w(u'<table id="header"><tr>\n')
self.w(u'<td>')
logo.render(w=self.w)
@@ -330,7 +330,7 @@
self.w(u'<td id="firstcolumn">')
logo = self.vreg['components'].select_or_none(
'logo', self.req, rset=self.rset)
- if logo and logo.propval('visible'):
+ if logo and logo.cw_propval('visible'):
logo.render(w=self.w)
self.w(u'</td>\n')
# appliname and breadcrumbs
@@ -338,19 +338,19 @@
for cid in ('appliname', 'breadcrumbs'):
comp = self.vreg['components'].select_or_none(
cid, self.req, rset=self.rset)
- if comp and comp.propval('visible'):
+ if comp and comp.cw_propval('visible'):
comp.render(w=self.w)
self.w(u'</td>')
# logged user and help
self.w(u'<td>\n')
comp = self.vreg['components'].select_or_none(
'loggeduserlink', self.req, rset=self.rset)
- if comp and comp.propval('visible'):
+ if comp and comp.cw_propval('visible'):
comp.render(w=self.w)
self.w(u'</td><td>')
helpcomp = self.vreg['components'].select_or_none(
'help', self.req, rset=self.rset)
- if helpcomp and helpcomp.propval('visible'):
+ if helpcomp and helpcomp.cw_propval('visible'):
helpcomp.render(w=self.w)
self.w(u'</td>')
# lastcolumn
--- a/web/views/facets.py Thu Aug 13 11:24:52 2009 +0200
+++ b/web/views/facets.py Thu Aug 13 11:32:34 2009 +0200
@@ -77,7 +77,7 @@
mainvar, baserql = prepare_facets_rqlst(rqlst, rset.args)
widgets = []
for facet in self.get_facets(rset, mainvar):
- if facet.propval('visible'):
+ if facet.cw_propval('visible'):
wdg = facet.get_widget()
if wdg is not None:
widgets.append(wdg)