flake8 cleanups, ununsed imports and variables cleanup, changed register_diagnostics to use reverse_lazy instead of reverse
This commit is contained in:
@@ -306,8 +306,8 @@ def return_type(value):
|
||||
|
||||
# http://stackoverflow.com/questions/4248399/page-range-for-printing-algorithm
|
||||
def parse_range(astr):
|
||||
result=set()
|
||||
result = set()
|
||||
for part in astr.split(u','):
|
||||
x=part.split(u'-')
|
||||
result.update(range(int(x[0]),int(x[-1])+1))
|
||||
x = part.split(u'-')
|
||||
result.update(range(int(x[0]), int(x[-1]) + 1))
|
||||
return sorted(result)
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from navigation.api import register_menu
|
||||
|
||||
from permissions import role_list
|
||||
|
||||
from documents import document_find_all_duplicates
|
||||
from filesystem_serving import filesystem_serving_recreate_all_links
|
||||
from ocr import all_document_ocr_cleanup
|
||||
from user_management import user_list
|
||||
|
||||
from main.conf.settings import SIDE_BAR_SEARCH
|
||||
|
||||
@@ -9,7 +9,7 @@ reverse_lazy = lazy(reverse, str)
|
||||
def register_diagnostic(namespace, title, link):
|
||||
namespace_dict = diagnostics.get(namespace, {'title': None, 'links': []})
|
||||
namespace_dict['title'] = title
|
||||
link['url'] = link.get('url', reverse(link['view']))
|
||||
link['url'] = link.get('url', reverse_lazy(link['view']))
|
||||
namespace_dict['links'].append(link)
|
||||
diagnostics[namespace] = namespace_dict
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ def tools_menu(request):
|
||||
user_tools[namespace] = {
|
||||
'title': values['title']
|
||||
}
|
||||
user_links = user_tools[namespace].setdefault('links', [])
|
||||
user_tools[namespace].setdefault('links', [])
|
||||
user_tools[namespace]['links'].append(link)
|
||||
except PermissionDenied:
|
||||
pass
|
||||
|
||||
@@ -7,7 +7,7 @@ from django.template import TemplateSyntaxError, Library, \
|
||||
from django.utils.text import unescape_string_literal
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from django.template import TemplateSyntaxError, Library, Context
|
||||
from django.template import Context
|
||||
|
||||
from navigation.api import object_navigation, multi_object_navigation, \
|
||||
menu_links as menu_navigation, sidebar_templates
|
||||
@@ -34,7 +34,6 @@ def process_links(links, view_name, url):
|
||||
child_view = 'view' in child_link and child_link['view']
|
||||
child_url = 'url' in child_link and child_link['url']
|
||||
if view_name == child_view or url == child_url:
|
||||
active = True
|
||||
active_item = item
|
||||
new_link.update({
|
||||
'first': count == 0,
|
||||
|
||||
@@ -2,7 +2,6 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ugettext
|
||||
from django.db.utils import DatabaseError
|
||||
from django.db.models.signals import post_save
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
from navigation.api import register_links, register_menu, register_multi_item_links
|
||||
from permissions.api import register_permissions
|
||||
@@ -11,7 +10,6 @@ from main.api import register_tool
|
||||
|
||||
from ocr.conf.settings import AUTOMATIC_OCR
|
||||
from ocr.models import DocumentQueue
|
||||
from ocr.urls import urlpatterns
|
||||
|
||||
#Permissions
|
||||
PERMISSION_OCR_DOCUMENT = 'ocr_document'
|
||||
|
||||
@@ -20,6 +20,7 @@ from ocr.conf.settings import QUEUE_PROCESSING_INTERVAL
|
||||
LOCK_EXPIRE = 60 * 5 # Lock expires in 5 minutes
|
||||
local_cache = CacheClass([], {})
|
||||
|
||||
|
||||
@task
|
||||
def task_process_queue_document(queue_document_id):
|
||||
queue_document = QueueDocument.objects.get(id=queue_document_id)
|
||||
|
||||
@@ -274,7 +274,7 @@ def all_document_ocr_cleanup(request):
|
||||
def display_link(obj):
|
||||
output = []
|
||||
if hasattr(obj, 'get_absolute_url'):
|
||||
output.append(u'<a href="%(url)s">%(obj)s</a>'% {
|
||||
output.append(u'<a href="%(url)s">%(obj)s</a>' % {
|
||||
'url': obj.get_absolute_url(),
|
||||
'obj': obj
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user