Example #1
0
File: index.py Project: ab/blag
 def register(self, author_name=None, password=None, confirm=None,
              submit=None):
     if cherrypy.request.method.lower() != "post":
         return {}
     if author_name is None or password is None:
         return {"message":
                     "You must specify both author name and password."}
     elif db.get_author(author_name) is not None:
         return {"message":"That author already exists."}
     elif password != confirm:
         return {"message":"Passwords did not match."}
     db.add_author(author_name, password)
     login_author(author_name,password)
     raise cherrypy.HTTPRedirect("/")
Example #2
0
def api_add_author():
    if not flask.request.is_json:
        return flask.jsonify({"msg": "Missing JSON in request"}), 400  
    
    return add_author(flask.request.get_json())
Example #3
0
File: reset.py Project: ab/blag
def hard_reset():
    db.drop_tables(verbose=True)
    db.create_dbs()
    db.add_author('dude', 'dude')
    db.add_author('guy', 'guy')
    db.add_post(1, 'Hello!', 'The quick brown fox jumps over the lazy dog.')