fixed pep8 in apps
This commit is contained in:
@@ -1,44 +1,44 @@
|
||||
def group_feed_reader(group,mode='div',counter='5'):
|
||||
def group_feed_reader(group, mode='div', counter='5'):
|
||||
"""parse group feeds"""
|
||||
|
||||
url = "http://groups.google.com/group/%s/feed/rss_v2_0_topics.xml?num=%s" %\
|
||||
(group,counter)
|
||||
(group, counter)
|
||||
from gluon.contrib import feedparser
|
||||
g = feedparser.parse(url)
|
||||
|
||||
if mode == 'div':
|
||||
html = XML(TAG.BLOCKQUOTE(UL(*[LI(A(entry['title']+' - ' +\
|
||||
entry['author'][entry['author'].rfind('('):],\
|
||||
_href=entry['link'],_target='_blank'))\
|
||||
for entry in g['entries'] ]),\
|
||||
_class="boxInfo",\
|
||||
_style="padding-bottom:5px;"))
|
||||
html = XML(TAG.BLOCKQUOTE(UL(*[LI(A(entry['title'] + ' - ' +
|
||||
entry['author'][
|
||||
entry['author'].rfind('('):],
|
||||
_href=entry['link'], _target='_blank'))
|
||||
for entry in g['entries']]),
|
||||
_class="boxInfo",
|
||||
_style="padding-bottom:5px;"))
|
||||
|
||||
else:
|
||||
html = XML(UL(*[LI(A(entry['title']+' - ' +\
|
||||
entry['author'][entry['author'].rfind('('):],\
|
||||
_href=entry['link'],_target='_blank'))\
|
||||
for entry in g['entries'] ]))
|
||||
html = XML(UL(*[LI(A(entry['title'] + ' - ' +
|
||||
entry['author'][entry['author'].rfind('('):],
|
||||
_href=entry['link'], _target='_blank'))
|
||||
for entry in g['entries']]))
|
||||
|
||||
return html
|
||||
|
||||
|
||||
def code_feed_reader(project,mode='div'):
|
||||
def code_feed_reader(project, mode='div'):
|
||||
"""parse code feeds"""
|
||||
|
||||
url = "http://code.google.com/feeds/p/%s/hgchanges/basic" % project
|
||||
from gluon.contrib import feedparser
|
||||
g = feedparser.parse(url)
|
||||
if mode == 'div':
|
||||
html = XML(DIV(UL(*[LI(A(entry['title'],_href=entry['link'],\
|
||||
_target='_blank'))\
|
||||
for entry in g['entries'][0:5]]),\
|
||||
_class="boxInfo",\
|
||||
html = XML(DIV(UL(*[LI(A(entry['title'], _href=entry['link'],
|
||||
_target='_blank'))
|
||||
for entry in g['entries'][0:5]]),
|
||||
_class="boxInfo",
|
||||
_style="padding-bottom:5px;"))
|
||||
else:
|
||||
html = XML(UL(*[LI(A(entry['title'],_href=entry['link'],\
|
||||
_target='_blank'))\
|
||||
for entry in g['entries'][0:5]]))
|
||||
|
||||
html = XML(UL(*[LI(A(entry['title'], _href=entry['link'],
|
||||
_target='_blank'))
|
||||
for entry in g['entries'][0:5]]))
|
||||
|
||||
return html
|
||||
|
||||
@@ -2,18 +2,19 @@ import gluon.template
|
||||
|
||||
markmin_dict = dict(
|
||||
code_python=lambda code: str(CODE(code)),
|
||||
template=lambda \
|
||||
code:gluon.template.render(code,context=globals()),
|
||||
sup=lambda \
|
||||
code:'<sup style="font-size:0.5em;">%s</sup>'%code,
|
||||
br=lambda n:'<br>'*int(n),
|
||||
groupdates=lambda group:group_feed_reader(group),
|
||||
)
|
||||
template=lambda
|
||||
code: gluon.template.render(code, context=globals()),
|
||||
sup=lambda
|
||||
code: '<sup style="font-size:0.5em;">%s</sup>' % code,
|
||||
br=lambda n: '<br>' * int(n),
|
||||
groupdates=lambda group: group_feed_reader(group),
|
||||
)
|
||||
|
||||
def get_content(b=None,\
|
||||
c=request.controller,\
|
||||
f=request.function,\
|
||||
l='en',\
|
||||
|
||||
def get_content(b=None,
|
||||
c=request.controller,
|
||||
f=request.function,
|
||||
l='en',
|
||||
format='markmin'):
|
||||
"""Gets and renders the file in
|
||||
<app>/private/content/<lang>/<controller>/<function>/<block>.<format>
|
||||
@@ -21,17 +22,18 @@ def get_content(b=None,\
|
||||
|
||||
def openfile():
|
||||
import os
|
||||
path = os.path.join(request.folder,'private','content',l,c,f,b+'.'+format)
|
||||
path = os.path.join(
|
||||
request.folder, 'private', 'content', l, c, f, b + '.' + format)
|
||||
return open(path)
|
||||
|
||||
try:
|
||||
openedfile = openfile()
|
||||
except Exception, IOError:
|
||||
l='en'
|
||||
l = 'en'
|
||||
openedfile = openfile()
|
||||
|
||||
if format == 'markmin':
|
||||
html = MARKMIN(str(T(openedfile.read())),markmin_dict)
|
||||
html = MARKMIN(str(T(openedfile.read())), markmin_dict)
|
||||
else:
|
||||
html = str(T(openedfile.read()))
|
||||
openedfile.close()
|
||||
|
||||
@@ -1,28 +1,29 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
response.menu = [
|
||||
(T('Home'),False,URL('default','index')),
|
||||
(T('About'),False,URL('default','what')),
|
||||
(T('Download'),False,URL('default','download')),
|
||||
(T('Docs & Resources'),False,URL('default','documentation')),
|
||||
(T('Support'),False,URL('default','support')),
|
||||
(T('Contributors'),False,URL('default','who'))]
|
||||
(T('Home'), False, URL('default', 'index')),
|
||||
(T('About'), False, URL('default', 'what')),
|
||||
(T('Download'), False, URL('default', 'download')),
|
||||
(T('Docs & Resources'), False, URL('default', 'documentation')),
|
||||
(T('Support'), False, URL('default', 'support')),
|
||||
(T('Contributors'), False, URL('default', 'who'))]
|
||||
|
||||
#########################################################################
|
||||
## Changes the menu active item
|
||||
#########################################################################
|
||||
def toggle_menuclass(cssclass='pressed',menuid='headermenu'):
|
||||
|
||||
|
||||
def toggle_menuclass(cssclass='pressed', menuid='headermenu'):
|
||||
"""This function changes the menu class to put pressed appearance"""
|
||||
|
||||
positions = dict(
|
||||
index='',
|
||||
what='-108px -115px',
|
||||
download='-211px -115px',
|
||||
who='-315px -115px',
|
||||
support='-418px -115px',
|
||||
documentation='-520px -115px'
|
||||
)
|
||||
|
||||
index='',
|
||||
what='-108px -115px',
|
||||
download='-211px -115px',
|
||||
who='-315px -115px',
|
||||
support='-418px -115px',
|
||||
documentation='-520px -115px'
|
||||
)
|
||||
|
||||
if request.function in positions.keys():
|
||||
jscript = """
|
||||
@@ -34,10 +35,10 @@ def toggle_menuclass(cssclass='pressed',menuid='headermenu'):
|
||||
});
|
||||
</script>
|
||||
""" % dict(cssclass=cssclass,
|
||||
menuid=menuid,
|
||||
function=request.function,
|
||||
cssposition=positions[request.function]
|
||||
)
|
||||
menuid=menuid,
|
||||
function=request.function,
|
||||
cssposition=positions[request.function]
|
||||
)
|
||||
|
||||
return XML(jscript)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user