mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 07:23:22 +00:00
This has two advantages; * We can split bugdown/__init__.py into several modules, and each module can access these arguments by importing these * We get rid of the super-ugly `global db_data` construct, replacing it with a only slightly ugly monkey-ish patching of the `zerver.lib.bugdown.arguments` module, which is at least considerably more clear on reading as to what it's purpose is.
13 lines
510 B
Python
13 lines
510 B
Python
from typing import Any, Dict, Optional
|
|
|
|
from zerver.models import Message
|
|
|
|
# Filters such as UserMentionPattern need a message, but python-markdown
|
|
# provides no way to pass extra params through to a pattern. Thus, a global.
|
|
current_message = None # type: Optional[Message]
|
|
|
|
# We avoid doing DB queries in our markdown thread to avoid the overhead of
|
|
# opening a new DB connection. These connections tend to live longer than the
|
|
# threads themselves, as well.
|
|
db_data = None # type: Optional[Dict[str, Any]]
|