equal
deleted
inserted
replaced
20 try: |
20 try: |
21 name, host = address.split('@', 1) |
21 name, host = address.split('@', 1) |
22 except ValueError: |
22 except ValueError: |
23 return address |
23 return address |
24 return '%s at %s' % (name, host.replace('.', ' dot ')) |
24 return '%s at %s' % (name, host.replace('.', ' dot ')) |
|
25 |
25 |
26 |
26 class EmailAddress(AnyEntity): |
27 class EmailAddress(AnyEntity): |
27 __regid__ = 'EmailAddress' |
28 __regid__ = 'EmailAddress' |
28 fetch_attrs, fetch_order = fetch_config(['address', 'alias']) |
29 fetch_attrs, fetch_order = fetch_config(['address', 'alias']) |
29 |
30 |
48 # XXX move to eemail |
49 # XXX move to eemail |
49 # check email relations are in the schema first |
50 # check email relations are in the schema first |
50 subjrels = self.e_schema.object_relations() |
51 subjrels = self.e_schema.object_relations() |
51 if not ('sender' in subjrels and 'recipients' in subjrels): |
52 if not ('sender' in subjrels and 'recipients' in subjrels): |
52 return |
53 return |
53 rql = 'DISTINCT Any X, S, D ORDERBY D DESC WHERE X sender Y or X recipients Y, X subject S, X date D, Y eid %(y)s' |
54 rset = self._cw.execute('DISTINCT Any X, S, D ORDERBY D DESC ' |
54 rset = self._cw.execute(rql, {'y': self.eid}, 'y') |
55 'WHERE X sender Y or X recipients Y, ' |
|
56 'X subject S, X date D, Y eid %(y)s', |
|
57 {'y': self.eid}) |
55 if skipeids is None: |
58 if skipeids is None: |
56 skipeids = set() |
59 skipeids = set() |
57 for i in xrange(len(rset)): |
60 for i in xrange(len(rset)): |
58 eid = rset[i][0] |
61 eid = rset[i][0] |
59 if eid in skipeids: |
62 if eid in skipeids: |
129 __regid__ = 'CWCache' |
132 __regid__ = 'CWCache' |
130 fetch_attrs, fetch_order = fetch_config(['name']) |
133 fetch_attrs, fetch_order = fetch_config(['name']) |
131 |
134 |
132 def touch(self): |
135 def touch(self): |
133 self._cw.execute('SET X timestamp %(t)s WHERE X eid %(x)s', |
136 self._cw.execute('SET X timestamp %(t)s WHERE X eid %(x)s', |
134 {'t': datetime.now(), 'x': self.eid}, 'x') |
137 {'t': datetime.now(), 'x': self.eid}) |
135 |
138 |
136 def valid(self, date): |
139 def valid(self, date): |
137 if date: |
140 if date: |
138 return date > self.timestamp |
141 return date > self.timestamp |
139 return False |
142 return False |