Commit 18c49c9a authored by Arthur Lutz's avatar Arthur Lutz
Browse files

flake8

parent f807b073b7d3
......@@ -5,7 +5,7 @@
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
:license: Lesser General Public License version 2 or above - http://www.gnu.org/
"""
__docformat__ = "restructuredtext en"
# __docformat__ = "restructuredtext en"
from logilab.common.date import todate
......@@ -13,6 +13,8 @@ from cubicweb.entities import AnyEntity, fetch_config
from cubicweb.view import EntityAdapter
from cubicweb.predicates import is_instance
__docformat__ = "restructuredtext en"
class BlogIFeedAdapter(EntityAdapter):
__regid__ = 'IFeed'
......
from six import text_type as unicode
try:
from cubicweb import _
except ImportError:
......
......@@ -20,7 +20,6 @@
# along with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""Generic Setup script, takes package info from __pkginfo__.py file
"""
__docformat__ = "restructuredtext en"
import os
import sys
......@@ -31,6 +30,8 @@ except ImportError: # PY3
from os.path import exists, join, dirname
from os import walk
__docformat__ = "restructuredtext en"
try:
if os.environ.get('NO_SETUPTOOLS'):
raise ImportError() # do as there is no setuptools
......
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import re
from datetime import datetime
from six import text_type as unicode
from lxml.html import fromstring, tostring
......@@ -168,7 +167,7 @@ def search_twitter(word):
from simplejson import loads
data = urllib2.urlopen(
'http://search.twitter.com/search.json?q=%s&rpp=100' % word).read()
results = loads(data)
loads(data)
# process results
# print results
return []
......
......@@ -15,7 +15,7 @@ class BlogTestsCubicWebTC(CubicWebTC):
'BlogEntry', title=u"hop", content=u"cubicweb hop")
blog_entry_1.cw_set(entry_of=cubicweb_blog)
blog_entry_2 = cnx.create_entity(
'BlogEntry', title=u"yes", content=u"cubicweb yes")
'BlogEntry', title=u"yes", content=u"cubicweb yes")
blog_entry_2.cw_set(entry_of=cubicweb_blog)
self.assertEqual(len(MAILBOX), 0)
cnx.commit()
......@@ -58,7 +58,7 @@ tutu
def test_prevnext(self):
with self.admin_access.client_cnx() as cnx:
e1 = cnx.create_entity('BlogEntry', title=u'a', content=u'a')
e2 = cnx.create_entity('CWGroup', name=u'NotTheNextOfe1')
cnx.create_entity('CWGroup', name=u'NotTheNextOfe1')
e3 = cnx.create_entity('BlogEntry', title=u'b', content=u'b')
cnx.commit()
a1 = e1.cw_adapt_to('IPrevNext')
......
BLOG_ICON = data('icon_blog.gif')
BLOG_ICON = data('icon_blog.gif') # noqa
......@@ -4,7 +4,6 @@
:copyright: 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
"""
__docformat__ = "restructuredtext en"
from logilab.mtconverter import xml_escape
......@@ -13,6 +12,8 @@ from cubicweb.predicates import is_instance
from cubicweb.web import component
from cubicweb.web.views import uicfg, primary
__docformat__ = "restructuredtext en"
_pvs = uicfg.primaryview_section
_pvdc = uicfg.primaryview_display_ctrl
_abaa = uicfg.actionbox_appearsin_addmenu
......
......@@ -4,20 +4,21 @@
:copyright: 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
"""
__docformat__ = "restructuredtext en"
try:
from cubicweb import _
except ImportError:
_ = unicode
from logilab.mtconverter import xml_escape
from six import text_type as unicode
from cubicweb import tags
from cubicweb.predicates import (none_rset, one_line_rset, is_instance,
has_related_entities, match_view)
from cubicweb.web import component
try:
from cubicweb import _
except ImportError:
_ = unicode
__docformat__ = "restructuredtext en"
class BlogArchivesBox(component.CtxComponent):
"""blog side box displaying a Blog Archive"""
......
......@@ -4,12 +4,6 @@
:copyright: 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
"""
__docformat__ = "restructuredtext en"
try:
from cubicweb import _
except ImportError:
_ = unicode
import re
......@@ -17,6 +11,7 @@ from calendar import monthrange
from datetime import datetime
from six import PY2
from six import text_type as unicode
from logilab.mtconverter import xml_escape
......@@ -26,6 +21,12 @@ from cubicweb.predicates import paginated_rset, sorted_rset, is_instance
from cubicweb.web.views import uicfg
from cubicweb.web.views import primary, baseviews, calendar, navigation, workflow
from cubicweb.web.views.xmlrss import RSSItemView
try:
from cubicweb import _
except ImportError:
_ = unicode
__docformat__ = "restructuredtext en"
_pvs = uicfg.primaryview_section
_pvs.tag_attribute(('BlogEntry', 'title'), 'hidden')
......@@ -155,7 +156,6 @@ class BlogEntryBlogView(EntityView):
def cell_call(self, row, col, **kwargs):
entity = self.cw_rset.get_entity(row, col)
w = self.w
_ = self._cw._
w(u'<div class="post">')
self.toolbar_components('ctxtoolbar')
render_blogentry_title(self._cw, w, entity)
......
from calendar import monthrange
from datetime import datetime
from cubicweb.web.views.urlrewrite import SimpleReqRewriter, rgx
......@@ -8,29 +5,35 @@ class BlogReqRewriter(SimpleReqRewriter):
rules = [
# links generated by archives by date/author boxes
(rgx('/(micro)?blog/([0-9]+)/blogentries'),
dict(rql='Any B,BD ORDERBY BD DESC WHERE B creation_date BD, B entry_of BL, BL eid %(eid)s' % {'eid': r'\2'},
dict(rql='Any B,BD ORDERBY BD DESC WHERE B creation_date BD, '
'B entry_of BL, BL eid %(eid)s' % {'eid': r'\2'},
)),
(rgx('/(micro)?blog/([0-9]+)/blogentries/([a-z_]+)'),
dict(rql='Any B,BD ORDERBY BD DESC WHERE B creation_date BD, B entry_of BL, BL eid %(eid)s, '
'B created_by U, U login "%(user)s"' % {
'eid': r'\2', 'user': r'\3'},
dict(rql='Any B,BD ORDERBY BD DESC WHERE B creation_date BD, '
'B entry_of BL, BL eid %(eid)s, '
'B created_by U, U login "%(user)s"' % {'eid': r'\2', 'user': r'\3'},
user=r'\2')),
(rgx('/(micro)?blog/([0-9]+)/blogentries/([0-9]{4})'),
dict(rql='Any B,BD ORDERBY BD DESC WHERE B creation_date BD, B entry_of BL, BL eid %(eid)s'
'HAVING YEAR(BD)= %(year)s' % {'eid': r'\2', 'year': r'\3'},
)),
(rgx('/(micro)?blog/([0-9]+)/blogentries/([0-9]{4})/([0-9]{2})'),
dict(rql='Any B,BD ORDERBY BD DESC WHERE B creation_date BD, B entry_of BL, BL eid %(eid)s '
'HAVING YEAR(BD)= %(year)s, MONTH(BD)=%(month)s' % {
'eid': r'\2', 'year': r'\3', 'month': r'\4'},
dict(rql='Any B,BD ORDERBY BD DESC WHERE B creation_date BD, '
'B entry_of BL, BL eid %(eid)s '
'HAVING YEAR(BD)= %(year)s, MONTH(BD)=%(month)s' % {'eid': r'\2',
'year': r'\3',
'month': r'\4'},
)),
# XXX use or kill
(rgx('/blogentry/([a-z_]+)'),
dict(rql='Any B,BD ORDERBY BD DESC WHERE B is BlogEntry, B creation_date BD, B created_by U, U login "%(user)s"' % {'user': r'\1'},
dict(rql='Any B,BD ORDERBY BD DESC WHERE B is BlogEntry, '
'B creation_date BD, B created_by U, U login "%(user)s"' % {'user': r'\1'},
user=r'\1')),
(rgx('/blogentry/([a-z_]+)\.rss'),
dict(rql='Any B,BD ORDERBY BD DESC LIMIT 20 WHERE B is BlogEntry, B creation_date BD, B created_by U, U login "%(user)s"' % {'user': r'\1'}, vid='rss')),
dict(rql='Any B,BD ORDERBY BD DESC LIMIT 20 WHERE B is BlogEntry, '
'B creation_date BD, B created_by U, U login "%(user)s"' % {'user': r'\1'},
vid='rss')),
(rgx('/blogentries/([0-9]{4})'),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment