from transaction import commit from wapy entity sqla import SQLAEntity

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from transaction import commit
from wapy.entity.sqla import SQLAEntityStore, row2dict
from uris.models import *
from wapy.security.password import hash_password
store = SQLAEntityStore()
store.model = Account
def populate_data():
user = store.find({'username': u'user'})
if user:
return
populate_user()
populate_roles()
def populate_user():
store.insert({'username': u'user',
'password': u'$2a$10$LTrYHvtt6Z1luCk/jK.wqO.hLAw4NFBT6jFLj1gG28CSeKSNARg0a',
'role_id': 1},
)
commit()
def populate_roles():
store.model = Roles
store.insert({'name': u'admin',
'id': 1,
'menu_perms': {"home": "rwx"}},
)
commit()