equal
deleted
inserted
replaced
128 |
128 |
129 def after_entity_copy(self, entity, sourceparams): |
129 def after_entity_copy(self, entity, sourceparams): |
130 super(DataFeedLDAPAdapter, self).after_entity_copy(entity, sourceparams) |
130 super(DataFeedLDAPAdapter, self).after_entity_copy(entity, sourceparams) |
131 if entity.__regid__ == 'EmailAddress': |
131 if entity.__regid__ == 'EmailAddress': |
132 return |
132 return |
133 groups = [self._get_group(n) for n in self.source.user_default_groups] |
133 groups = filter(None, [self._get_group(name) |
134 entity.cw_set(in_group=groups) |
134 for name in self.source.user_default_groups]) |
|
135 if groups: |
|
136 entity.cw_set(in_group=groups) |
135 self._process_email(entity, sourceparams) |
137 self._process_email(entity, sourceparams) |
136 |
138 |
137 def is_deleted(self, extidplus, etype, eid): |
139 def is_deleted(self, extidplus, etype, eid): |
138 try: |
140 try: |
139 extid, _ = extidplus.rsplit('@@', 1) |
141 extid, _ = extidplus.rsplit('@@', 1) |
170 self.sourceuris.pop(uri, None) |
172 self.sourceuris.pop(uri, None) |
171 # XXX else check use_email relation? |
173 # XXX else check use_email relation? |
172 |
174 |
173 @cached |
175 @cached |
174 def _get_group(self, name): |
176 def _get_group(self, name): |
175 return self._cw.execute('Any X WHERE X is CWGroup, X name %(name)s', |
177 try: |
176 {'name': name}).get_entity(0, 0) |
178 return self._cw.execute('Any X WHERE X is CWGroup, X name %(name)s', |
|
179 {'name': name}).get_entity(0, 0) |
|
180 except IndexError: |
|
181 self.error('group %r referenced by source configuration %r does not exist' |
|
182 % (name, self.source.uri)) |
|
183 return None |
|
184 |