|
a/ForgeClassic/sfx/prweb.py |
|
b/ForgeClassic/sfx/prweb.py |
|
... |
|
... |
31 |
def index(self, **kw):
|
31 |
def index(self, **kw):
|
32 |
c.new = W.new_vhost
|
32 |
c.new = W.new_vhost
|
33 |
return dict(vhosts=list(SM.VHost.find()))
|
33 |
return dict(vhosts=list(SM.VHost.find()))
|
34 |
|
34 |
|
35 |
@expose()
|
35 |
@expose()
|
36 |
def create(self, vhostid=None):
|
36 |
def create(self, name=None):
|
37 |
SM.VHost.create(vhostid)
|
37 |
SM.VHost.create(name)
|
38 |
flash('Virtual host scheduled for creation.')
|
38 |
flash('Virtual host scheduled for creation.')
|
39 |
redirect('.')
|
39 |
redirect('.')
|
40 |
|
40 |
|
41 |
@expose()
|
41 |
@expose()
|
42 |
def delete(self, vhostid=None):
|
42 |
def delete(self, vhostid=None):
|
43 |
vhost = SM.VHost.get(vhostid)
|
43 |
vhost = SM.VHost.get(vhostid)
|
44 |
if vhost is None:
|
44 |
if vhost is None:
|
45 |
flash('Virtual host %s not found' % vhostid, 'error')
|
45 |
flash('Virtual host %s not found' % vhostid, 'error')
|
46 |
vhost.delete()
|
46 |
vhost.delete()
|
47 |
flash('Virtual host %s deleted' % vhostid)
|
47 |
flash('Virtual host %s deleted' % vhost.vhost_name)
|
48 |
redirect('.')
|
48 |
redirect('.')
|
49 |
|
49 |
|
50 |
class MySQLApp(SFXBaseApp):
|
50 |
class MySQLApp(SFXBaseApp):
|
51 |
'''This is the MySQL app for PyForge'''
|
51 |
'''This is the MySQL app for PyForge'''
|
52 |
tool_label='MySQL Databases'
|
52 |
tool_label='MySQL Databases'
|
|
... |
|
... |
65 |
@without_trailing_slash
|
65 |
@without_trailing_slash
|
66 |
@validate(W.mysql_password, error_handler=index)
|
66 |
@validate(W.mysql_password, error_handler=index)
|
67 |
@expose()
|
67 |
@expose()
|
68 |
def save(self, **kw):
|
68 |
def save(self, **kw):
|
69 |
db = SM.MySQL()
|
69 |
db = SM.MySQL()
|
70 |
if hasattr(db, 'passwd_rouser'):
|
70 |
if db.passwd_rouser is None:
|
|
|
71 |
SM.MySQL.create(**kw)
|
|
|
72 |
flash('Passwords set')
|
|
|
73 |
else:
|
71 |
db.update(**kw)
|
74 |
db.update(**kw)
|
72 |
else:
|
75 |
flash('Passwords updated')
|
73 |
SM.MySQL.create(**kw)
|
|
|
74 |
redirect('.')
|
76 |
redirect('.')
|