mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Fix this markdown extension nonsense.
Previously, every single spline-pokedex request tacked another markdown extension onto a global list in spline, making markdown processing just a little bit slower over time. This is terrible. Now we do something a little less crazy and a little more global. Wait, is that less crazy or more?
This commit is contained in:
parent
bb1a164a34
commit
25ab674c7c
3 changed files with 44 additions and 49 deletions
pokedex/db
|
@ -193,12 +193,14 @@ class MultilangSession(Session):
|
|||
Needs to be used with `MultilangScopedSession`, below.
|
||||
"""
|
||||
default_language_id = None
|
||||
markdown_extension_class = markdown.PokedexLinkExtension
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if 'default_language_id' in kwargs:
|
||||
self.default_language_id = kwargs.pop('default_language_id')
|
||||
|
||||
self.pokedex_link_maker = markdown.MarkdownLinkMaker(self)
|
||||
if 'markdown_extension_class' in kwargs:
|
||||
self.markdown_extension_class = kwargs.pop('markdown_extension_class')
|
||||
|
||||
kwargs.setdefault('query_cls', MultilangQuery)
|
||||
|
||||
|
@ -218,7 +220,5 @@ class MultilangScopedSession(ScopedSession):
|
|||
self.registry().default_language_id = new
|
||||
|
||||
@property
|
||||
def pokedex_link_maker(self):
|
||||
"""Passes the new link maker through to the current session.
|
||||
"""
|
||||
return self.registry().pokedex_link_maker
|
||||
def markdown_extension_class(self):
|
||||
return self.registry().markdown_extension_class
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue