##// END OF EJS Templates
Some more constant extracts
neko259 -
r2003:3c9f075c default
parent child Browse files
Show More
@@ -3,6 +3,7 b' from boards.models import Tag, TagAlias,'
3 3 from boards.models.attachment import AttachmentSticker
4 4 from boards.models.thread import FAV_THREAD_NO_UPDATES
5 5 from boards.models.tag import DEFAULT_LOCALE
6 from boards.settings import SECTION_VIEW
6 7
7 8 MAX_TRIPCODE_COLLISIONS = 50
8 9
@@ -135,7 +136,7 b' class SettingsManager:'
135 136 def add_or_read_fav_thread(self, opening_post):
136 137 threads = self.get_fav_threads()
137 138
138 max_fav_threads = settings.get_int('View', 'MaxFavoriteThreads')
139 max_fav_threads = settings.get_int(SECTION_VIEW, 'MaxFavoriteThreads')
139 140 if (str(opening_post.id) in threads) or (len(threads) < max_fav_threads):
140 141 thread = opening_post.get_thread()
141 142 # Don't check for new posts if the thread is archived already
@@ -27,8 +27,8 b' from boards.models.attachment.viewers im'
27 27 from boards.models.post import TITLE_MAX_LENGTH
28 28 from boards.utils import validate_file_size, get_file_mimetype, \
29 29 FILE_EXTENSION_DELIMITER, get_tripcode_from_text
30 from boards.settings import SECTION_FORMS
30 31
31 SECTION_FORMS = 'Forms'
32 32
33 33 POW_HASH_LENGTH = 16
34 34 POW_LIFE_MINUTES = 5
@@ -6,6 +6,7 b" CONFIG_SETTINGS = 'boards/config/setting"
6 6
7 7
8 8 SECTION_FORMS = 'Forms'
9 SECTION_VIEW = 'View'
9 10
10 11 VALUE_TRUE = 'true'
11 12
@@ -17,7 +17,7 b' from django.utils.translation import uge'
17 17 import boards
18 18 from neboard import settings
19 19 from boards.abstracts.constants import FILE_DIRECTORY
20 from boards.settings import get_bool
20 from boards.settings import get_bool, SECTION_FORMS
21 21
22 22 CACHE_KEY_DELIMITER = '_'
23 23
@@ -103,7 +103,7 b' def get_file_hash(file) -> str:'
103 103
104 104
105 105 def validate_file_size(size: int):
106 max_size = boards.settings.get_int('Forms', 'MaxFileSize')
106 max_size = boards.settings.get_int(SECTION_FORMS, 'MaxFileSize')
107 107 if 0 < max_size < size:
108 108 raise forms.ValidationError(
109 109 _('Total file size must be less than %s but is %s.')
@@ -14,6 +14,7 b' from boards.models import Post, Thread'
14 14 from boards.views.base import BaseBoardView, CONTEXT_FORM
15 15 from boards.views.mixins import FileUploadMixin, PaginatedMixin, \
16 16 DispatcherMixin, PARAMETER_METHOD
17 from boards.settings import SECTION_VIEW, SECTION_FORMS
17 18
18 19 FORM_TAGS = 'tags'
19 20 FORM_TEXT = 'text'
@@ -68,7 +69,7 b' class AllThreadsView(FileUploadMixin, Ba'
68 69 threads = threads.distinct()
69 70
70 71 paginator = get_paginator(threads,
71 settings.get_int('View', 'ThreadsPerPage'))
72 settings.get_int(SECTION_VIEW, 'ThreadsPerPage'))
72 73 paginator.current_page = int(page)
73 74
74 75 try:
@@ -80,7 +81,7 b' class AllThreadsView(FileUploadMixin, Ba'
80 81 params[CONTEXT_FORM] = form
81 82 params[PARAMETER_MAX_FILE_SIZE] = self.get_max_upload_size()
82 83 params[PARAMETER_RSS_URL] = self.get_rss_url()
83 params[PARAMETER_MAX_FILES] = settings.get_int('Forms', 'MaxFileCount')
84 params[PARAMETER_MAX_FILES] = settings.get_int(SECTION_FORMS, 'MaxFileCount')
84 85
85 86 paginator.set_url(self.get_reverse_url(), request.GET.dict())
86 87 params.update(self.get_page_context(paginator, page))
General Comments 0
You need to be logged in to leave comments. Login now