docstrings

This commit is contained in:
Matthias 2022-01-11 01:08:51 +01:00
parent f612f57992
commit 9601811827
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076

View File

@ -15,31 +15,41 @@ register = template.Library()
@register.simple_tag()
def plugin_list(*args, **kwargs):
""" Return a list of all installed integration plugins """
"""
List of all installed integration plugins
"""
return registry.plugins
@register.simple_tag()
def inactive_plugin_list(*args, **kwargs):
""" Return a list of all inactive integration plugins """
"""
List of all inactive integration plugins
"""
return registry.plugins_inactive
@register.simple_tag()
def plugin_settings(plugin, *args, **kwargs):
""" Return a list of all custom settings for a plugin """
"""
List of all settings for the plugin
"""
return registry.mixins_settings.get(plugin)
@register.simple_tag()
def mixin_enabled(plugin, key, *args, **kwargs):
""" Return if the mixin is existant and configured in the plugin """
"""
Is the mixin registerd and configured in the plugin?
"""
return plugin.mixin_enabled(key)
@register.simple_tag()
def navigation_enabled(*args, **kwargs):
"""Return if plugin navigation is enabled"""
"""
Is plugin navigation enabled?
"""
if djangosettings.PLUGIN_TESTING:
return True
return InvenTreeSetting.get_setting('ENABLE_PLUGINS_NAVIGATION')
@ -47,7 +57,10 @@ def navigation_enabled(*args, **kwargs):
@register.simple_tag()
def safe_url(view_name, *args, **kwargs):
""" safe lookup for urls """
"""
Safe lookup fnc for URLs
Returns None if not found
"""
try:
return reverse(view_name, args=args, kwargs=kwargs)
except:
@ -56,5 +69,7 @@ def safe_url(view_name, *args, **kwargs):
@register.simple_tag()
def plugin_errors(*args, **kwargs):
"""Return all plugin errors"""
"""
All plugin errors in the current session
"""
return registry.errors