Commits

mitar committed 1360398

Two new settings options. One which allows custom Trac configuration options, the other for Trac templates dir.

  • Participants
  • Parent commits 71e2344

Comments (0)

Files changed (2)

         },
     }
 
-``CMS_MARKUP_TRAC_COMPONENTS`` configures which additional Trac plugins (components) should be enabled. They should of course be in Python path.
+``CMS_MARKUP_TRAC_COMPONENTS`` configures which additional Trac plugins (components) should be enabled. They should of course be in Python path. And probably defined fully, like::
+
+    CMS_MARKUP_TRAC_COMPONENTS = (
+        'tracdashessyntax.plugin.DashesSyntaxPlugin',
+        'footnotemacro.macro.FootNoteMacro',
+        'mathjax.api.MathJaxPlugin',
+        'tracmath.tracmath.TracMathPlugin',
+    )
+
+``CMS_MARKUP_TRAC_CONFIGURATION`` allows definining any additional Trac configuration options, like::
+
+    CMS_MARKUP_TRAC_CONFIGURATION = {
+        'tracmath': {
+            'cache_dir': os.path.join(PROJECT_PATH, 'tracwiki', 'cache'),
+        }
+    }
+
+And ``CMS_MARKUP_TRAC_TEMPLATES_DIR`` specifies directory with Trac templates. Example::
+
+    CMS_MARKUP_TRAC_TEMPLATES_DIR = os.path.join(PROJECT_PATH, 'tracwiki', 'templates')
 
 ``CMS_MARKUP_TRAC_HEADING_OFFSET`` configures the heading offset when rendering wiki syntax. Useful when you are including wiki content inside some other content with existing headings. Default is 1 which means that ``= Heading =`` becomes ``<h2>Heading</h2>``. Setting it to 0 disables this feature.

File cmsplugin_markup_tracwiki/tracwiki.py

                 self.config.set('intertrac', '%s.url' % (ns,), conf['URL'])
                 self.config.set('intertrac', '%s.compat' % (ns,), conf.get('COMPAT', False))
 
+        for (section, conf) in getattr(settings, 'CMS_MARKUP_TRAC_CONFIGURATION', {}).iteritems():
+            for (key, value) in conf.iteritems():
+                self.config.set(section, key, value)
+
         # TODO: Sync activated locales with Django?
 
     def set_abs_href(self, request):
             self.abs_href = LazyHref('https://' + site.domain + (':' + server_port if server_port != '443' else '') + self.href())
         else:
             self.abs_href = LazyHref('http://' + site.domain + (':' + server_port if server_port != '80' else '') + self.href())
+    
+    def get_templates_dir(self):
+        return getattr(settings, 'CMS_MARKUP_TRAC_TEMPLATES_DIR', super(DjangoEnvironment, self).get_templates_dir())
 
 class DjangoChrome(trac_chrome.Chrome):
     pass