How to overrride a function defined inside a function

"John P. Rouillard" <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.devel
Message-ID <[email protected]>
Hi all:

In https://issues.roundup-tracker.org/issue2551105 we have the need
to override the options passed to the various markdown backends.

Currently the options are defined in roundup/cgi/templating.py using a
scheme like:

  def _import_markdown():
     do imports etc.

     class SomeClass(Markdown.Class):
        override some method defs

     ...

     def _options(config):
            options = { 'fenced-code-blocks' : {}, 'nofollow': None }
	    # in some cases options is something like:
	    # options =  [SafeHtml(), 'fenced_code']
            if config['MARKDOWN_BREAK_ON_NEWLINE']:
                options['break-on-newline'] = True
            return options

     markdown = lambda s, c: markdown_from_parent(s, extensions=_options(c))

     return markdown

Is there a way to redefine _options inside of_import_markdown (it
would be done using interfaces.py) or should I restructure this to
have a MarkdownOptions class with _options defined within it and
change import markdown to end with:


     markdown = lambda s, c: markdown_from_parent(s,
                       extensions=MarkdownOptions._options(c))
     return markdown

Thoughts?

--
				-- rouilj
John Rouillard
===========================================================================
My employers don't acknowledge my existence much less my opinions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.