mirror of
https://github.com/kennethreitz/replit-py.git
synced 2026-06-05 23:10:18 +00:00
39 lines
923 B
Python
39 lines
923 B
Python
"""Make apps quickly using Python."""
|
|
|
|
import os
|
|
|
|
import flask
|
|
from werkzeug.local import LocalProxy
|
|
|
|
from . import files
|
|
from . import html
|
|
from .app import ReplitApp
|
|
from .files import File
|
|
from .html import HTMLElement, Link, Page, Paragraph
|
|
from .utils import *
|
|
from ..database import AsyncDatabase, AsyncJSONKey, Database, db, JSONKey
|
|
|
|
auth = LocalProxy(lambda: flask.request.auth)
|
|
signed_in = LocalProxy(lambda: flask.request.signed_in)
|
|
request = LocalProxy(lambda: flask.request)
|
|
render_template = flask.render_template
|
|
redirect = flask.redirect
|
|
|
|
|
|
def user_data(username: str) -> JSONKey:
|
|
"""Shorthand for db.jsonkey(username, dict).
|
|
|
|
Args:
|
|
username (str): The key to use for the JSONKey.
|
|
|
|
Returns:
|
|
JSONKey: An initialized JSONKey.
|
|
"""
|
|
return db.jsonkey(username, dict)
|
|
|
|
|
|
current_user_data = LocalProxy(lambda: user_data(flask.request.auth.name))
|
|
|
|
# Syntax sugar.
|
|
App = ReplitApp
|