Skip to content

Conversation

@sebix
Copy link
Contributor

@sebix sebix commented Jul 25, 2025

makes the access to optional configuration options much easier

makes the access to optional configuration options much easier
sebix added a commit to sebix/moin that referenced this pull request Jul 25, 2025
Introduces a new optional configuration parameter to specify any
instance-specific extensions for the markdown parser

based on moinwiki#1964

implements moinwiki#1957
Comment on lines +269 to +277
def get(self, item, default=None):
"""Dict-like get method.
Return the value for key if key is in the dictionary, else default.
If default is not given, it defaults to None, so that this method never raises a KeyError."""
try:
return getattr(self, item)
except AttributeError:
return default

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC the idea of the DefaultConfig is that it has defaults for all supported attributes, so one would never get this AttributeError.

Having it in this class is also useful because it is one place where settings and their default can be looked up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

sebix added a commit to sebix/moin that referenced this pull request Jul 25, 2025
Introduces a new optional configuration parameter to specify any
instance-specific extensions for the markdown parser

based on moinwiki#1964

implements moinwiki#1957
sebix added a commit to sebix/moin that referenced this pull request Jul 26, 2025
Introduces a new optional configuration parameter to specify any
instance-specific extensions for the markdown parser

based on moinwiki#1964

implements moinwiki#1957
@sebix sebix closed this Jul 28, 2025
sebix added a commit to sebix/moin that referenced this pull request Jul 28, 2025
Introduces a new optional configuration parameter to specify any
instance-specific extensions for the markdown parser

based on moinwiki#1964

implements moinwiki#1957
sebix added a commit to sebix/moin that referenced this pull request Jul 28, 2025
Introduces a new optional configuration parameter to specify any
instance-specific extensions for the markdown parser

based on moinwiki#1964

implements moinwiki#1957
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants