Code beautification
This commit is contained in:
@@ -7,12 +7,19 @@ import os
|
||||
from random import choice
|
||||
|
||||
def randomheader(request):
|
||||
header_file = choice(filter(lambda x: os.path.isfile(settings.HEADER_DIR + os.path.sep + x), os.listdir(settings.HEADER_DIR)))
|
||||
header_file = choice(filter(
|
||||
lambda x: os.path.isfile(
|
||||
settings.HEADER_DIR + os.path.sep + x
|
||||
),
|
||||
os.listdir(settings.HEADER_DIR)
|
||||
))
|
||||
return {'header': header_file}
|
||||
|
||||
def tagcloud(request):
|
||||
tagcloud = []
|
||||
tagcloudlist = Tag.objects.annotate(ct=Count('taggit_taggeditem_items')).order_by('-ct')
|
||||
tagcloudlist = Tag.objects.annotate(
|
||||
ct = Count('taggit_taggeditem_items')
|
||||
).order_by('-ct')
|
||||
|
||||
if (len(tagcloudlist) > 0):
|
||||
tmax = tagcloudlist[0].ct
|
||||
@@ -26,9 +33,13 @@ def tagcloud(request):
|
||||
|
||||
if (tagcount >= tmin):
|
||||
size = int(floor((5.0 * (tagcount - tmin)) / (tmax - tmin)))
|
||||
tagcloud.append({'name': cloudelement.name, 'slug': cloudelement.slug, 'size': size})
|
||||
tagcloud.append({
|
||||
'name': cloudelement.name,
|
||||
'slug': cloudelement.slug,
|
||||
'size': size
|
||||
})
|
||||
|
||||
tagcloud.sort(key=itemgetter('name'))
|
||||
tagcloud.sort(key = itemgetter('name'))
|
||||
|
||||
return {'tagcloud': tagcloud}
|
||||
|
||||
|
@@ -8,7 +8,21 @@
|
||||
"""
|
||||
|
||||
from pygments.style import Style
|
||||
from pygments.token import Comment, Error, Generic, Keyword, Literal, Name, Number, Operator, Other, Punctuation, String, Text, Token, Whitespace
|
||||
from pygments.token import \
|
||||
Comment, \
|
||||
Error, \
|
||||
Generic, \
|
||||
Keyword, \
|
||||
Literal, \
|
||||
Name, \
|
||||
Number, \
|
||||
Operator, \
|
||||
Other, \
|
||||
Punctuation, \
|
||||
String, \
|
||||
Text, \
|
||||
Token, \
|
||||
Whitespace
|
||||
|
||||
class SolarizedDarkStyle(Style):
|
||||
"""
|
||||
|
@@ -10,13 +10,40 @@ handler403 = 'basics.views.forbidden'
|
||||
handler400 = 'basics.views.badrequest'
|
||||
|
||||
urlpatterns = patterns('',
|
||||
# Examples:
|
||||
url(r'^$', 'blog.views.mainpage', name='home'),
|
||||
url(r'^google150e54bda5f96d97', 'basics.views.googlevalidator'),
|
||||
url(r'^robots\.txt$', TemplateView.as_view(template_name='robots.txt', content_type = 'text/plain')),
|
||||
url(r'^blog/', include('blog.urls', namespace='blog')),
|
||||
url(
|
||||
r'^$',
|
||||
'blog.views.mainpage',
|
||||
name = 'home'
|
||||
),
|
||||
url(
|
||||
r'^google150e54bda5f96d97',
|
||||
'basics.views.googlevalidator'
|
||||
),
|
||||
url(
|
||||
r'^robots\.txt$',
|
||||
TemplateView.as_view(template_name = 'robots.txt', content_type = 'text/plain')
|
||||
),
|
||||
url(
|
||||
r'^blog/',
|
||||
include(
|
||||
'blog.urls',
|
||||
namespace = 'blog'
|
||||
)
|
||||
),
|
||||
# Uncomment the admin/doc line below to enable admin documentation:
|
||||
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
||||
url(r'^admin/', include(admin.site.urls)),
|
||||
url(r'^', include('basics.urls', namespace='basics')),
|
||||
#url(
|
||||
# r'^admin/doc/',
|
||||
# include('django.contrib.admindocs.urls')
|
||||
# ),
|
||||
url(
|
||||
r'^admin/',
|
||||
include(admin.site.urls)
|
||||
),
|
||||
url(
|
||||
r'^',
|
||||
include(
|
||||
'basics.urls',
|
||||
namespace = 'basics'
|
||||
)
|
||||
),
|
||||
)
|
||||
|
Reference in New Issue
Block a user