Exemplo n.º 1
0
def logout():
  if not current_user.is_anonymous():
    if request.method == 'GET':
      page_data = request.environ.get('PAGE', {})
      return str(base(**page_data))
    logout_user()
  return redirect(request.environ.get('SCRIPT_NAME', '') + LOGIN_URL)
Exemplo n.º 2
0
Arquivo: dash.py Projeto: jackij/FPWeb
def study(studyID):
  rc = studyID_to_record_class.get(studyID.lower())
  if not rc:
    abort(404)
  page = request.environ.get('PAGE', {}).copy()
  page['user'] = current_user
  page['db'] = db
  page['record_class'] = rc
  page['studyID'] = rc.study_ID
  page['title'] = page['page_title'] = \
    page['title'].format(studyID=rc.study_ID)
  return str(base(**page))
Exemplo n.º 3
0
def plo():
    """
  Render a page in environ['PAGE'] using the base template.
  """
    environ = request.environ
    page = environ.get("PAGE", {})
    postdata = environ.get("wsgi.input")
    if not postdata:
        page["POSTDATA"] = "No Data!"
    else:
        page["POSTDATA"] = postdata.read(int(environ.get("CONTENT_LENGTH") or 0))
    print page["POSTDATA"]
    return base(**page)
Exemplo n.º 4
0
Arquivo: dash.py Projeto: jackij/FPWeb
def profile():
  page = request.environ.get('PAGE', {})
  page['user'] = current_user
  page['db'] = db
  form_content = page['form_content']

  if request.method == 'POST':
    form = ProfileForm()
    if form.validate_on_submit():
      print 'Whooo!!'
    else:
      print 'Booo!!'
    form_content = str(form)

  html = str(base(**page))
  html = html.format(form_content=page['form_content'])
  return html
Exemplo n.º 5
0
Arquivo: dash.py Projeto: jackij/FPWeb
def dash():
  page = request.environ.get('PAGE', {})
  page['user'] = current_user
  page['db'] = db
  page['record_classes'] = [
    RecordsDat,
    RecordsMediTrain,
    RecordsTrainCat,
    RecordsDATPre,
    RecordsDATPost,
    RecordsMediTrainPre,
    RecordsMediTrainPost,
    RecordsMediTrainSleep,
    RecordsMediTrainSaliva,
    ]
  page['ra'] = RecordAny
  return str(base(**page))
Exemplo n.º 6
0
def login():
  pre = request.environ.get('SCRIPT_NAME', '')
  if request.method == 'GET':
    if current_user.is_anonymous():
      page_data = request.environ.get('PAGE', {})
      page_data['next'] = oid.get_next_url()
      page_data['error'] = oid.fetch_error()
      page_data['OPENID_PROVIDERS'] = OPENID_PROVIDERS
      return str(base(**page_data))
    return redirect(pre + LOGOUT_URL)

  open_id = request.form.get('openid')
  if open_id:
    return oid.try_login(open_id, ask_for=['email', 'fullname', 'nickname'])

  username = request.form['user']
  pw = request.form['pasw']
  user = User.query.filter_by(name=username, password=pw).first()

  if user:
    login_user(user)
    return redirect(oid.get_next_url() or pre)
  return redirect('Bah')
Exemplo n.º 7
0
def lo(environ, start_response):
  '''
  Render a page in environ['PAGE'] using the base template.
  '''
  start_response('200 OK', [('content-type', 'text/html')])
  return base(**environ.get('PAGE', {}))
Exemplo n.º 8
0
def lo():
    """
  Render a page in environ['PAGE'] using the base template.
  """
    PAGE = request.environ.get("PAGE", {})
    return str(base(**PAGE))