Merge pull request #1280 from BuhtigithuB/pep8-gluon-html-py

Enhance gluon/html.py PEP8
This commit is contained in:
mdipierro
2016-04-08 23:37:54 -05:00
+6 -7
View File
@@ -308,7 +308,7 @@ def URL(a=None,
else: else:
function = f function = f
# if the url gets a static resource, don't force extention # if the url gets a static resource, don't force extension
if controller == 'static': if controller == 'static':
extension = None extension = None
# add static version to url # add static version to url
@@ -955,7 +955,6 @@ class DIV(XmlComponent):
# get the xml for the inner components # get the xml for the inner components
co = join([xmlescape(component) for component in co = join([xmlescape(component) for component in
self.components]) self.components])
return (fa, co) return (fa, co)
def xml(self): def xml(self):
@@ -990,7 +989,7 @@ class DIV(XmlComponent):
Examples: Examples:
>>> markdown = lambda text,tag=None,attributes={}: \ >>> markdown = lambda text, tag=None, attributes={}: \
{None: re.sub('\s+',' ',text), \ {None: re.sub('\s+',' ',text), \
'h1':'#'+text+'\\n\\n', \ 'h1':'#'+text+'\\n\\n', \
'p':text+'\\n'}.get(tag,text) 'p':text+'\\n'}.get(tag,text)
@@ -1171,13 +1170,13 @@ class DIV(XmlComponent):
return i return i
else: else:
self[i] = replace(self[i]) if callable(replace) else replace self[i] = replace(self[i]) if callable(replace) else replace
return i+1 return i + 1
# loop the components # loop the components
if find_text or find_components: if find_text or find_components:
i = 0 i = 0
while i < len(self.components): while i < len(self.components):
c = self[i] c = self[i]
j = i+1 j = i + 1
if check and find_text and isinstance(c, str) and \ if check and find_text and isinstance(c, str) and \
((is_regex and find_text.search(c)) or (str(find_text) in c)): ((is_regex and find_text.search(c)) or (str(find_text) in c)):
j = replace_component(i) j = replace_component(i)
@@ -2573,7 +2572,7 @@ class MENU(DIV):
item[3], select, prefix=CAT(prefix, item[0], '/')) item[3], select, prefix=CAT(prefix, item[0], '/'))
select['_onchange'] = 'window.location=this.value' select['_onchange'] = 'window.location=this.value'
# avoid to wrap the select if no custom items are present # avoid to wrap the select if no custom items are present
html = DIV(select, self.serialize(custom_items)) if len(custom_items) else select html = DIV(select, self.serialize(custom_items)) if len(custom_items) else select
return html return html
def xml(self): def xml(self):
@@ -2805,7 +2804,7 @@ class MARKMIN(XmlComponent):
self.extra = extra or {} self.extra = extra or {}
self.allowed = allowed or {} self.allowed = allowed or {}
self.sep = sep self.sep = sep
self.url = URL if url == True else url self.url = URL if url is True else url
self.environment = environment self.environment = environment
self.latex = latex self.latex = latex
self.autolinks = autolinks self.autolinks = autolinks