Merge remote-tracking branch 'upstream/master'
This commit is contained in:
+3
-3
@@ -437,7 +437,7 @@ def compile_views(folder, skip_failed_views=False):
|
||||
"""
|
||||
path = pjoin(folder, 'views')
|
||||
failed_views = []
|
||||
for fname in listdir(path, REGEX_VIEW_PATH):
|
||||
for fname in listdir(path, REGEX_VIEW_PATH, followlinks=True):
|
||||
try:
|
||||
data = parse_template(fname, path)
|
||||
except Exception as e:
|
||||
@@ -462,7 +462,7 @@ def compile_models(folder):
|
||||
Compiles all the models in the application specified by `folder`
|
||||
"""
|
||||
path = pjoin(folder, 'models')
|
||||
for fname in listdir(path, REGEX_MODEL_PATH):
|
||||
for fname in listdir(path, REGEX_MODEL_PATH, followlinks=True):
|
||||
data = read_file(pjoin(path, fname))
|
||||
modelfile = 'models.'+fname.replace(os.sep, '.')
|
||||
filename = pjoin(folder, 'compiled', modelfile)
|
||||
@@ -487,7 +487,7 @@ def compile_controllers(folder):
|
||||
Compiles all the controllers in the application specified by `folder`
|
||||
"""
|
||||
path = pjoin(folder, 'controllers')
|
||||
for fname in listdir(path, REGEX_CONTROLLER):
|
||||
for fname in listdir(path, REGEX_CONTROLLER, followlinks=True):
|
||||
data = read_file(pjoin(path, fname))
|
||||
exposed = find_exposed_functions(data)
|
||||
for function in exposed:
|
||||
|
||||
@@ -18,14 +18,14 @@ regex_title = re.compile('^#{1} (?P<t>[^\n]+)', re.M)
|
||||
regex_maps = [
|
||||
(re.compile('[ \t\r]+\n'), '\n'),
|
||||
(re.compile('\*\*(?P<t>[^\s\*]+( +[^\s\*]+)*)\*\*'), '{\\\\bf \g<t>}'),
|
||||
(re.compile("''(?P<t>[^\s']+( +[^\s']+)*)''"), '{\\it \g<t>}'),
|
||||
(re.compile("''(?P<t>[^\s']+( +[^\s']+)*)''"), '{\\\it \g<t>}'),
|
||||
(re.compile('^#{5,6}\s*(?P<t>[^\n]+)', re.M), '\n\n{\\\\bf \g<t>}\n'),
|
||||
(re.compile('^#{4}\s*(?P<t>[^\n]+)', re.M), '\n\n\\\\goodbreak\\subsubsection{\g<t>}\n'),
|
||||
(re.compile('^#{3}\s*(?P<t>[^\n]+)', re.M), '\n\n\\\\goodbreak\\subsection{\g<t>}\n'),
|
||||
(re.compile('^#{2}\s*(?P<t>[^\n]+)', re.M), '\n\n\\\\goodbreak\\section{\g<t>}\n'),
|
||||
(re.compile('^#{4}\s*(?P<t>[^\n]+)', re.M), '\n\n\\\\goodbreak\\\subsubsection{\g<t>}\n'),
|
||||
(re.compile('^#{3}\s*(?P<t>[^\n]+)', re.M), '\n\n\\\\goodbreak\\\subsection{\g<t>}\n'),
|
||||
(re.compile('^#{2}\s*(?P<t>[^\n]+)', re.M), '\n\n\\\\goodbreak\\\section{\g<t>}\n'),
|
||||
(re.compile('^#{1}\s*(?P<t>[^\n]+)', re.M), ''),
|
||||
(re.compile('^\- +(?P<t>.*)', re.M), '\\\\begin{itemize}\n\\item \g<t>\n\\end{itemize}'),
|
||||
(re.compile('^\+ +(?P<t>.*)', re.M), '\\\\begin{itemize}\n\\item \g<t>\n\\end{itemize}'),
|
||||
(re.compile('^\- +(?P<t>.*)', re.M), '\\\\begin{itemize}\n\\\item \g<t>\n\\\end{itemize}'),
|
||||
(re.compile('^\+ +(?P<t>.*)', re.M), '\\\\begin{itemize}\n\\\item \g<t>\n\\\end{itemize}'),
|
||||
(re.compile('\\\\end\{itemize\}\s+\\\\begin\{itemize\}'), '\n'),
|
||||
(re.compile('\n\s+\n'), '\n\n')]
|
||||
regex_table = re.compile('^\-{4,}\n(?P<t>.*?)\n\-{4,}(:(?P<c>\w+))?\n', re.M | re.S)
|
||||
@@ -97,7 +97,7 @@ def render(text,
|
||||
text = latex_escape(text, pound=False)
|
||||
|
||||
texts = text.split('## References', 1)
|
||||
text = regex_anchor.sub('\\label{\g<t>}', texts[0])
|
||||
text = regex_anchor.sub('\\\label{\g<t>}', texts[0])
|
||||
if len(texts) == 2:
|
||||
text += '\n\\begin{thebibliography}{999}\n'
|
||||
text += regex_bibitem.sub('\n\\\\bibitem{\g<t>}', texts[1])
|
||||
@@ -145,7 +145,7 @@ def render(text,
|
||||
text = regex_image_width.sub(sub, text)
|
||||
text = regex_image.sub(sub, text)
|
||||
|
||||
text = regex_link.sub('{\\\\footnotesize\\href{\g<k>}{\g<t>}}', text)
|
||||
text = regex_link.sub('{\\\\footnotesize\\\href{\g<k>}{\g<t>}}', text)
|
||||
text = regex_commas.sub('\g<t>', text)
|
||||
text = regex_noindent.sub('\n\\\\noindent \g<t>', text)
|
||||
|
||||
|
||||
@@ -1 +1,4 @@
|
||||
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf8 -*-
|
||||
# Plural-Forms for fa (Persian)
|
||||
|
||||
@@ -64,7 +64,7 @@ class WebClient(object):
|
||||
headers=headers, method='GET')
|
||||
|
||||
def post(self, url, data=None, cookies=None,
|
||||
headers=None, auth=None, method='auto'):
|
||||
headers=None, auth=None, method='auto', charset='utf-8'):
|
||||
self.url = self.app + url
|
||||
|
||||
# if this POST form requires a postback do it
|
||||
@@ -147,7 +147,11 @@ class WebClient(object):
|
||||
else:#python2.5
|
||||
self.status = None
|
||||
|
||||
self.text = to_native(self.response.read())
|
||||
self.text = self.response.read()
|
||||
if charset:
|
||||
if charset == 'auto':
|
||||
charset = self.response.headers.getparam('charset')
|
||||
self.text = to_native(self.text, charset)
|
||||
# In PY3 self.response.headers are case sensitive
|
||||
self.headers = dict()
|
||||
for h in self.response.headers:
|
||||
@@ -173,9 +177,10 @@ class WebClient(object):
|
||||
self.sessions[name] = value
|
||||
|
||||
# find all forms and formkeys in page
|
||||
self.forms = {}
|
||||
for match in FORM_REGEX.finditer(to_native(self.text)):
|
||||
self.forms[match.group('formname')] = match.group('formkey')
|
||||
if charset:
|
||||
self.forms = {}
|
||||
for match in FORM_REGEX.finditer(self.text):
|
||||
self.forms[match.group('formname')] = match.group('formkey')
|
||||
|
||||
# log this request
|
||||
self.history.append((self.method, self.url, self.status, self.time))
|
||||
|
||||
+3
-2
@@ -148,7 +148,8 @@ def listdir(path,
|
||||
add_dirs=False,
|
||||
sort=True,
|
||||
maxnum=None,
|
||||
exclude_content_from=None
|
||||
exclude_content_from=None,
|
||||
followlinks=False
|
||||
):
|
||||
"""
|
||||
Like `os.listdir()` but you can specify a regex pattern to filter files.
|
||||
@@ -164,7 +165,7 @@ def listdir(path,
|
||||
n = 0
|
||||
regex = re.compile(expression)
|
||||
items = []
|
||||
for (root, dirs, files) in os.walk(path, topdown=True):
|
||||
for (root, dirs, files) in os.walk(path, topdown=True, followlinks=followlinks):
|
||||
for dir in dirs[:]:
|
||||
if dir.startswith('.'):
|
||||
dirs.remove(dir)
|
||||
|
||||
@@ -392,6 +392,12 @@ class lazyT(object):
|
||||
def __eq__(self, other):
|
||||
return str(self) == str(other)
|
||||
|
||||
def __lt__(self, other):
|
||||
return str(self) < str(other)
|
||||
|
||||
def __gt__(self, other):
|
||||
return str(self) > str(other)
|
||||
|
||||
def __ne__(self, other):
|
||||
return str(self) != str(other)
|
||||
|
||||
|
||||
+1
-1
Submodule gluon/packages/dal updated: 1fd32c5133...541913385c
+1
-1
Submodule gluon/packages/yatl updated: dd96936526...2eb050b8e2
+1
-1
@@ -204,7 +204,7 @@ def url_out(request, environ, application, controller, function,
|
||||
if host is True or (host is None and (scheme or port is not None)):
|
||||
host = request.env.http_host
|
||||
if not scheme or scheme is True:
|
||||
scheme = request.env.get('wsgi_url_scheme', 'http').lower() if request else 'http'
|
||||
scheme = 'https' if request and request.is_https else 'http'
|
||||
if host:
|
||||
host_port = host if not port else host.split(':', 1)[0] + ':%s' % port
|
||||
url = '%s://%s%s' % (scheme, host_port, url)
|
||||
|
||||
Reference in New Issue
Block a user