def _clean_missing(resource_id, items, user):
 key = (('#' + unicode(resource_id)) + '.')
 contacts = Object.filter_permitted(user, Contact.objects).filter(nuvius_resource__contains=key)
 if (not (len(contacts) == len(items))):
  candidates = []
  for contact in contacts:
   found = False
   for item in items:
    itemkey = (key + unicode(item.id.raw))
    if (itemkey in contact.nuvius_resource):
     found = True
   if (not found):
    candidates.append(contact)
  for victim in candidates:
   victim.subscribers.clear()
   victim.delete()

def _clean_missing ( resource_id , items , user ) : key = ( ( '#' + unicode ( resource_id ) ) + '.' ) contacts = Object . filter_permitted ( user , Contact . objects ) . filter ( nuvius_resource__contains = key ) if ( not ( len ( contacts ) == len ( items ) ) ) : candidates = [ ] for contact in contacts : found = False for item in items : itemkey = ( key + unicode ( item . id . raw ) ) if ( itemkey in contact . nuvius_resource ) : found = True if ( not found ) : candidates . append ( contact ) for victim in candidates : victim . subscribers . clear ( ) victim . delete ( )
clean items missing from data of their original resource .