Example #1
0
 def create(owner, desc):
     nb = hsdb.incr('users', ('all_photos', ),
                    '=', (owner, ),
                    return_original=True)[0]['all_photos']
     hsdb.insert('photos', ('owner', 'nb', 'status', 'desc'),
                 (owner, -int(nb), 'n', desc),
                 shard_seed=int(owner))
     return Photo(owner, nb, 'n', desc)
Example #2
0
File: models.py Project: savix/jnp3
 def create(username, password):
     password = hash_password(password)
     try:
         hsdb.insert('users', ('id', 'username', 'password', 'ready_photos', 'all_photos'),
             ('', username, password, 0, 0))
     except hsdb.OperationalError:
         raise IntegrityError()
     else:
         row = hsdb.get('users', ('username', 'id'), username, index_name='users_by_username')
         return User(row['id'], username, password, 0)
Example #3
0
File: models.py Project: savix/jnp3
 def create(username, password):
     password = hash_password(password)
     try:
         hsdb.insert(
             'users',
             ('id', 'username', 'password', 'ready_photos', 'all_photos'),
             ('', username, password, 0, 0))
     except hsdb.OperationalError:
         raise IntegrityError()
     else:
         row = hsdb.get('users', ('username', 'id'),
                        username,
                        index_name='users_by_username')
         return User(row['id'], username, password, 0)
Example #4
0
File: models.py Project: savix/jnp3
 def create(owner, desc):
     nb = hsdb.incr('users', ('all_photos', ), '=', (owner, ), return_original=True)[0]['all_photos']
     hsdb.insert('photos', ('owner', 'nb', 'status', 'desc'), (owner, -int(nb), 'n', desc),
             shard_seed = int(owner))
     return Photo(owner, nb, 'n', desc)