Move the parse_range function to the only app that uses it, documents app
This commit is contained in:
@@ -122,15 +122,6 @@ def return_type(value):
|
||||
return value
|
||||
|
||||
|
||||
# http://stackoverflow.com/questions/4248399/page-range-for-printing-algorithm
|
||||
def parse_range(astr):
|
||||
result = set()
|
||||
for part in astr.split(','):
|
||||
x = part.split('-')
|
||||
result.update(range(int(x[0]), int(x[-1]) + 1))
|
||||
return sorted(result)
|
||||
|
||||
|
||||
def generate_choices_w_labels(choices):
|
||||
results = []
|
||||
for choice in choices:
|
||||
|
||||
10
mayan/apps/documents/utils.py
Normal file
10
mayan/apps/documents/utils.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
def parse_range(astr):
|
||||
# http://stackoverflow.com/questions/4248399/page-range-for-printing-algorithm
|
||||
result = set()
|
||||
for part in astr.split(','):
|
||||
x = part.split('-')
|
||||
result.update(range(int(x[0]), int(x[-1]) + 1))
|
||||
return sorted(result)
|
||||
@@ -18,7 +18,7 @@ import sendfile
|
||||
from acls.models import AccessEntry
|
||||
from acls.views import acl_list_for
|
||||
from common.compressed_files import CompressedFile
|
||||
from common.utils import encapsulate, pretty_size, parse_range, urlquote
|
||||
from common.utils import encapsulate, pretty_size, urlquote
|
||||
from common.views import SingleObjectListView
|
||||
from common.widgets import two_state_template
|
||||
from converter.literals import (
|
||||
@@ -58,6 +58,7 @@ from .settings import (
|
||||
from .tasks import (
|
||||
task_clear_image_cache, task_get_document_image, task_update_page_count
|
||||
)
|
||||
from .utils import parse_range
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user