equal
deleted
inserted
replaced
5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
6 """ |
6 """ |
7 __docformat__ = "restructuredtext en" |
7 __docformat__ = "restructuredtext en" |
8 |
8 |
9 from urlparse import urlsplit, urlunsplit |
9 from urlparse import urlsplit, urlunsplit |
10 from mx.DateTime import now |
10 from datetime import datetime |
11 |
11 |
12 from logilab.common.decorators import cached |
12 from logilab.common.decorators import cached |
13 |
13 |
14 from cubicweb.entity import _marker |
14 from cubicweb.entity import _marker |
15 from cubicweb.entities import AnyEntity, fetch_config |
15 from cubicweb.entities import AnyEntity, fetch_config |
151 return self.title |
151 return self.title |
152 |
152 |
153 def dc_description(self, format='text/plain'): |
153 def dc_description(self, format='text/plain'): |
154 return self.synopsis or u'' |
154 return self.synopsis or u'' |
155 |
155 |
|
156 |
156 class ECache(AnyEntity): |
157 class ECache(AnyEntity): |
157 """Cache""" |
158 """Cache""" |
158 id = 'ECache' |
159 id = 'ECache' |
159 |
160 |
160 fetch_attrs, fetch_order = fetch_config(['name']) |
161 fetch_attrs, fetch_order = fetch_config(['name']) |
161 |
162 |
162 def touch(self): |
163 def touch(self): |
163 self.req.execute('SET X timestamp %(t)s WHERE X eid %(x)s', {'t': now(), 'x': self.eid}, 'x') |
164 self.req.execute('SET X timestamp %(t)s WHERE X eid %(x)s', |
|
165 {'t': datetime.now(), 'x': self.eid}, 'x') |
164 |
166 |
165 def valid(self, date): |
167 def valid(self, date): |
166 return date < self.timestamp |
168 return date < self.timestamp |