Esempio n. 1
0
    def _POST(self, *param, **params):

        if not validates_user(self):
            return web.badrequest(self.view.alert)

        engine = get_engine()
        metadata = get_metadata()
        session = get_session()

        try:
            metadata.drop_all()   
            metadata.tables['machine2jobgroup'].create()
            metadata.create_all()   
        except Exception, e:
            traceback.format_exc()
            raise Exception('Initializing/Updating a database error - %s' % ''.join(e.args))
Esempio n. 2
0
karesansui.config = K2V("/etc/karesansui/application.conf").read()

(opts, args) = getopts()
#print opts
chkopts(opts)

for k in dir(opts):
    v = getattr(opts,k)
    if type(v) == str and k[0:2] != "__":
        exec("%s = '%s'" % (k, v,))

#print opts
#sys.exit()

engine = get_engine()
metadata = get_metadata()

try:
    metadata.drop_all()   
    metadata.tables['machine2jobgroup'].create()
    metadata.create_all()   
except Exception, e:
    traceback.format_exc()
    raise Exception('Initializing/Updating a database error - %s' % ''.join(e.args))

session = get_session()
try:
    (password, salt) = sha1encrypt(u"%s" % password)
    user = session.query(User).filter(User.email == email).first()

    if user is None: