Merge branch 'master' of github.com:web2py/web2py
This commit is contained in:
+3
-3
@@ -23,7 +23,6 @@ from gluon.storage import Storage, List
|
||||
from gluon.template import parse_template
|
||||
from gluon.restricted import restricted, compile2
|
||||
from gluon.fileutils import mktree, listdir, read_file, write_file
|
||||
from gluon.myregex import regex_expose, regex_longcomments
|
||||
from gluon.languages import TranslatorFactory
|
||||
from gluon.dal import DAL, Field
|
||||
from gluon.validators import Validator
|
||||
@@ -45,6 +44,7 @@ from functools import reduce
|
||||
from gluon import rewrite
|
||||
from gluon.custom_import import custom_import_install
|
||||
import py_compile
|
||||
import ast
|
||||
|
||||
logger = logging.getLogger("web2py")
|
||||
|
||||
@@ -517,8 +517,8 @@ def compile_models(folder):
|
||||
|
||||
|
||||
def find_exposed_functions(data):
|
||||
data = regex_longcomments.sub('', data)
|
||||
return regex_expose.findall(data)
|
||||
parsed = ast.parse(data)
|
||||
return [n.name for n in ast.walk(parsed) if type(n) == ast.FunctionDef and len(n.args.args) == 0 and n.args.kwarg is None]
|
||||
|
||||
|
||||
def compile_controllers(folder):
|
||||
|
||||
@@ -13,9 +13,10 @@ OAuth 2.0 spec: http://tools.ietf.org/html/rfc6749
|
||||
|
||||
import time
|
||||
import cgi
|
||||
import urllib2
|
||||
|
||||
from urllib import urlencode
|
||||
from gluon._compat import urllib2
|
||||
from gluon._compat import urlencode
|
||||
|
||||
from gluon import current, redirect, HTTP
|
||||
|
||||
import json
|
||||
|
||||
@@ -8,7 +8,7 @@ try:
|
||||
else:
|
||||
import tkinter
|
||||
except ImportError:
|
||||
Tkinter = None
|
||||
tkinter = None
|
||||
|
||||
|
||||
class MessageBoxHandler(logging.Handler):
|
||||
|
||||
+1
-7
@@ -18,13 +18,7 @@ regex_tables = re.compile(
|
||||
"""^[\w]+\.define_table\(\s*[\'\"](?P<name>\w+)[\'\"]""",
|
||||
flags=re.M)
|
||||
|
||||
# pattern to find exposed functions in controller
|
||||
|
||||
regex_expose = re.compile(
|
||||
'^def\s+(?P<name>_?[a-zA-Z0-9]\w*)\( *\)\s*:',
|
||||
flags=re.M)
|
||||
|
||||
regex_longcomments = re.compile('(""".*?"""|'+"'''.*?''')", re.DOTALL)
|
||||
# patterns to find includes and extends in views
|
||||
|
||||
regex_include = re.compile(
|
||||
'(?P<all>\{\{\s*include\s+[\'"](?P<name>[^\'"]*)[\'"]\s*\}\})')
|
||||
|
||||
+1
-1
@@ -411,7 +411,7 @@ def unlocalised_http_header_date(data):
|
||||
"12": "Dec",
|
||||
}.get(time.strftime("%m", data))
|
||||
|
||||
year_and_time = time.strftime("%Y %H:%M:%S GMT")
|
||||
year_and_time = time.strftime("%Y %H:%M:%S GMT", data)
|
||||
|
||||
return "{}, {} {} {}".format(
|
||||
short_weekday,
|
||||
|
||||
Reference in New Issue
Block a user