Пример #1
0
 def _insert_external(cls, external, **values):
     if 'internal_user_id' in values:
         values['internal_user_id'] = BLANK_UUID
     if values.has_key('client'):
         return update_or_insert(cls, values, external_user_id=external, client=values['client'])
     else:
         try:
             unknown_client = DimensionClient.objects.get(id=-1)
             return update_or_insert(cls, values, external_user_id=external, client=unknown_client)
         except:
             return select_or_insert(cls, values, external_user_id=external)
Пример #2
0
    def _insert_both(cls, internal, external, **values):

        result = update_or_insert(cls, values, internal_user_id=internal, external_user_id=external)

        deprecated = []
        deprecated.append(DimensionUser.objects.filter(internal_user_id=internal).exclude(id=result.id))
        if 'client' in values:
            deprecated.append(DimensionUser.objects.filter(external_user_id=external,
                                                           client=values['client']).exclude(id=result.id))

        for deprecated_user in chain(*deprecated):
            cls._replace_user_id(deprecated_user, result)

        return result
Пример #3
0
 def _insert_internal(cls, internal, **values):
     if 'external_user_id' in values:
         values['external_user_id'] = BLANK_UUID
     return update_or_insert(cls, values, internal_user_id=internal)