source:
OpenRLabs-Git/deploy/rlabs-docker/web2py-rlabs/gluon/__init__.py
Last change on this file was 42bd667, checked in by , 4 years ago | |
---|---|
|
|
File size: 3.0 KB |
Line | |
---|---|
1 | #!/usr/bin/env python |
2 | # -*- coding: utf-8 -*- |
3 | """ |
4 | This file is part of the web2py Web Framework |
5 | Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> |
6 | License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) |
7 | |
8 | |
9 | Web2Py framework modules |
10 | ======================== |
11 | """ |
12 | |
13 | __all__ = ['A', 'B', 'BEAUTIFY', 'BODY', 'BR', 'CAT', 'CENTER', 'CLEANUP', 'CODE', 'CRYPT', 'DAL', 'DIV', 'EM', 'EMBED', 'FIELDSET', 'FORM', 'Field', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'HEAD', 'HR', 'HTML', 'HTTP', 'I', 'IFRAME', 'IMG', 'INPUT', 'IS_ALPHANUMERIC', 'IS_DATE', 'IS_DATETIME', 'IS_DATETIME_IN_RANGE', 'IS_DATE_IN_RANGE', 'IS_DECIMAL_IN_RANGE', 'IS_EMAIL', 'IS_LIST_OF_EMAILS', 'IS_EMPTY_OR', 'IS_EQUAL_TO', 'IS_EXPR', 'IS_FILE', 'IS_FLOAT_IN_RANGE', 'IS_IMAGE', 'IS_JSON', 'IS_INT_IN_RANGE', 'IS_IN_DB', 'IS_IN_SET', 'IS_IPV4', 'IS_LENGTH', 'IS_LIST_OF', 'IS_LOWER', 'IS_MATCH', 'IS_NOT_EMPTY', 'IS_NOT_IN_DB', 'IS_NULL_OR', 'IS_SLUG', 'IS_STRONG', 'IS_TIME', 'IS_UPLOAD_FILENAME', 'IS_UPPER', 'IS_URL', 'LABEL', 'LEGEND', 'LI', 'LINK', 'LOAD', 'MARKMIN', 'MENU', 'META', 'OBJECT', 'OL', 'ON', 'OPTGROUP', 'OPTION', 'P', 'PRE', 'SCRIPT', 'SELECT', 'SPAN', 'SQLFORM', 'SQLTABLE', 'STRONG', 'STYLE', 'TABLE', 'TAG', 'TBODY', 'TD', 'TEXTAREA', 'TFOOT', 'TH', 'THEAD', 'TITLE', 'TR', 'TT', 'UL', 'URL', 'XHTML', 'XML', 'redirect', 'current', 'embed64'] |
14 | |
15 | #: add pydal to sys.modules |
16 | import os |
17 | import sys |
18 | |
19 | MESSAGE = ("web2py depends on %s, which apparently you have not installed.\n" + |
20 | "Probably you cloned the repository using git without '--recursive'" + |
21 | "\nTo fix this, please run (from inside your web2py folder):\n\n" + |
22 | " git submodule update --init --recursive\n\n" + |
23 | "You can also download a complete copy from http://www.web2py.com.") |
24 | |
25 | def import_packages(): |
26 | for package, location in [('pydal', 'dal'), ('yatl', 'yatl')]: |
27 | try: |
28 | path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "packages", location) |
29 | if path not in sys.path: |
30 | sys.path.insert(0, path) |
31 | sys.modules[package] = __import__(package) |
32 | except ImportError: |
33 | raise RuntimeError(MESSAGE % package) |
34 | |
35 | import_packages() |
36 | |
37 | from .globals import current |
38 | from .html import * |
39 | from .validators import * |
40 | from .http import redirect, HTTP |
41 | from .dal import DAL, Field |
42 | from .sqlhtml import SQLFORM, SQLTABLE |
43 | from .compileapp import LOAD |
44 | |
45 | # Dummy code to enable code completion in IDE's. |
46 | if 0: |
47 | from .globals import Request, Response, Session |
48 | from .cache import Cache |
49 | from .languages import translator |
50 | from .tools import Auth, Crud, Mail, Service, PluginManager |
51 | |
52 | # API objects |
53 | request = Request() |
54 | response = Response() |
55 | session = Session() |
56 | cache = Cache(request) |
57 | T = translator(request) |
58 | |
59 | # Objects commonly defined in application model files |
60 | # (names are conventions only -- not part of API) |
61 | db = DAL() |
62 | auth = Auth(db) |
63 | crud = Crud(db) |
64 | mail = Mail() |
65 | service = Service() |
66 | plugins = PluginManager() |
Note: See TracBrowser
for help on using the repository browser.