##// END OF EJS Templates
Version bump
Version bump

File last commit:

r2005:00eae4e7 default
r2019:bae74335 4.8.1 default
Show More
mixins.py
61 lines | 1.6 KiB | text/x-python | PythonLexer
neko259
Show max file size in the posting templates
r1396 import boards
neko259
Even more refactoring
r2005 from boards.settings import SECTION_FORMS
neko259
Show max file size in the posting templates
r1396
neko259
Views refactoring
r900 PARAM_NEXT = 'next'
neko259
Moved tag subscribe and unsubscribe methods to the tag view. Added a...
r563 PARAMETER_METHOD = 'method'
neko259
Moved pagination related stuff to the mixin
r1854 PARAMETER_CURRENT_PAGE = 'current_page'
PARAMETER_PAGINATOR = 'paginator'
PARAMETER_PREV_LINK = 'prev_page_link'
PARAMETER_NEXT_LINK = 'next_page_link'
neko259
Moved tag subscribe and unsubscribe methods to the tag view. Added a...
r563
neko259
Unify thread and post creation into one method inside post manager, that can be called from almost anywhere (one step closer to ajax thread creation)
r1997
neko259
Moved tag subscribe and unsubscribe methods to the tag view. Added a...
r563 class DispatcherMixin:
"""
This class contains a dispather method that can run a method specified by
'method' request parameter.
"""
neko259
Added ability to hide a post
r1366 def __init__(self):
self.user = None
neko259
Added post admin page with tags edit capability
r566 def dispatch_method(self, *args, **kwargs):
request = args[0]
neko259
Added ability to hide a post
r1366 self.user = request.user
neko259
Added post admin page with tags edit capability
r566 method_name = None
neko259
Moved tag subscribe and unsubscribe methods to the tag view. Added a...
r563 if PARAMETER_METHOD in request.GET:
method_name = request.GET[PARAMETER_METHOD]
neko259
Added post admin page with tags edit capability
r566 elif PARAMETER_METHOD in request.POST:
method_name = request.POST[PARAMETER_METHOD]
neko259
Moved tag subscribe and unsubscribe methods to the tag view. Added a...
r563
neko259
Added post admin page with tags edit capability
r566 if method_name:
return getattr(self, method_name)(*args, **kwargs)
neko259
Show max file size in the posting templates
r1396
class FileUploadMixin:
def get_max_upload_size(self):
neko259
Even more refactoring
r2005 return boards.settings.get_int(SECTION_FORMS, 'MaxFileSize')
neko259
Added tag gallery
r1419
class PaginatedMixin:
neko259
Moved pagination related stuff to the mixin
r1854 def get_page_context(self, paginator, page):
"""
Get pagination context variables
"""
params = {}
params[PARAMETER_PAGINATOR] = paginator
current_page = paginator.page(int(page))
params[PARAMETER_CURRENT_PAGE] = current_page
if current_page.has_previous():
params[PARAMETER_PREV_LINK] = paginator.get_page_url(
current_page.previous_page_number())
if current_page.has_next():
params[PARAMETER_NEXT_LINK] = paginator.get_page_url(
current_page.next_page_number())
return params