Commit 4307480d authored by Nicolas Chauvat's avatar Nicolas Chauvat
Browse files

3.6 api update

parent 659e2a0f6c5e
......@@ -36,11 +36,9 @@ class ExternalUriComponent(component.EntityVComponent):
self.cell_call(self.row or 0, self.col or 0)
def cell_call(self, row, col, view=None):
req = self.req
user = req.user
entity = self.rset.get_entity(row, col)
entity = self.cw_rset.get_entity(row, col)
self.w(u'<div class="toolbarButton" id="%s">' % self.div_id())
imgurl = req.external_resource('BLUE_ARROW')
imgurl = self._cw.external_resource('BLUE_ARROW')
if entity.url:
url = entity.url
else:
......@@ -61,7 +59,7 @@ class ClassifiedAdInContextView(baseviews.SameETypeListItemView):
__select__ = implements('ClassifiedAd')
def cell_call(self, row, col, contexteid=None):
entity = self.entity(row, col)
entity = self.cw_rset.get_entity(row, col)
abs_url = entity.absolute_url()
if entity.url:
link = entity.url
......@@ -113,7 +111,7 @@ class ProximityOfAds(baseviews.EntityView):
__select__ = implements('ClassifiedAd')
def call(self):
rset = self.req.execute('Any X WHERE X is ClassifiedAd')
rset = self._cw.execute('Any X WHERE X is ClassifiedAd')
ads = dict((entity.eid, entity) for entity in rset.entities())
vectors = dict((eid, vectorize(entity)) for eid, entity in ads.items())
distances = {}
......@@ -123,7 +121,7 @@ class ProximityOfAds(baseviews.EntityView):
distances[mk_key(eid1, eid2)] = distance(vectors[eid1], vectors[eid2])
self.w(u'<table><tr><th width="50%%">%s</th><th>%s</th></tr>' %
(self._cw._('ClassifiedAd'), self._cw._('Similar Ads')))
for row, ad in enumerate(self.rset.entities()):
for row, ad in enumerate(self.cw_rset.entities()):
self.w(u'<tr class="%s"><td>' % (row % 2 and u'even' or u'odd'))
self.w(ad.view('sameetypelistitem'))
self.w(u'</td><td><ul>')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment