Exemple #1
0
    def decode(self, cstruct):
        from nomenklatura.model.user import User

        if hasattr(cstruct, 'api_key'):
            return cstruct
        if isinstance(cstruct, (basestring, int)):
            return User.by_id(cstruct)
        if isinstance(cstruct, dict):
            return self.decode(cstruct.get('id'))
        return None
Exemple #2
0
def email_available(value):
    from nomenklatura.model.user import User
    return User.by_email(value) is None