Make mycreole independent from patt
This commit is contained in:
parent
057388e3b4
commit
8a2da2b843
27
context.py
27
context.py
@ -1,8 +1,10 @@
|
||||
from django.conf import settings
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
import logging
|
||||
import importlib
|
||||
|
||||
from mycreole import url_upload
|
||||
from users.context import menubar as user_menubar
|
||||
from patt.context import navigationbar
|
||||
from themes import color_icon_url
|
||||
|
||||
try:
|
||||
@ -15,9 +17,26 @@ NEW_ATTACHMENT_UID = 'new_attachment'
|
||||
|
||||
|
||||
def context_adaption(context, request, title, rel_path, **kwargs):
|
||||
def get_method(import_string):
|
||||
class_data = import_string.split(".")
|
||||
module_path = ".".join(class_data[:-1])
|
||||
class_str = class_data[-1]
|
||||
#
|
||||
module = importlib.import_module(module_path)
|
||||
return getattr(module, class_str)
|
||||
|
||||
def log_warning(method_name, e):
|
||||
logger.warning('Could not import %s method for extending bars: %s - %s', method_name, type(e).__name__, e)
|
||||
|
||||
context.set_additional_title(title)
|
||||
user_menubar(context[context.MENUBAR], request)
|
||||
navigationbar(context, request)
|
||||
for key in ["menubar", "navibar"]:
|
||||
try:
|
||||
method_name = settings.MYCREOLE_BAR[key]
|
||||
except (AttributeError, KeyError) as e:
|
||||
log_warning(key, e)
|
||||
else:
|
||||
method = get_method(method_name)
|
||||
method(context, request, caller_name="attachments")
|
||||
add_new(request, context[context.ACTIONBAR], rel_path, kwargs.get('next'))
|
||||
for key in kwargs:
|
||||
context[key] = kwargs[key]
|
||||
|
4
help.py
4
help.py
@ -1,7 +1,7 @@
|
||||
MYCREOLE_HELP = """\
|
||||
= Creole Markup
|
||||
|
||||
The Fields //"Description"// and //"Name"// of Tasks and Projects are interpreted as creole. \
|
||||
Some Fields are interpreted as creole. \
|
||||
See http://www.wikicreole.org for more details.
|
||||
|
||||
== Text Markup
|
||||
@ -12,6 +12,8 @@ See http://www.wikicreole.org for more details.
|
||||
| Underline | {{{__text__}}} | __text__ |
|
||||
| Raw Link | {{{https://python.org}}} | https://python.org |
|
||||
| Text Link | {{{[[https://python.org|Python]]}}} | [[https://python.org|Python]] |
|
||||
|
||||
== Additional syntax
|
||||
| Image | {{{ {{/media/theme/logo.png|logo}} }}} | {{/media/theme/logo.png|logo}} |
|
||||
| Attachment Text Link | {{{[[attachment:file.ext|Python]]}}} | |
|
||||
| Attachment Image | {{{ {{attachment:logo.png|logo}} }}} | |
|
||||
|
Loading…
x
Reference in New Issue
Block a user