refactor internal names

This commit is contained in:
Matthias 2021-11-12 00:13:12 +01:00
parent 61f6061edf
commit ae5031e997
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076

View File

@ -293,18 +293,18 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin):
@property @property
def slug(self): def slug(self):
"""slug for the plugin""" """slug for the plugin"""
name = getattr(self, 'PLUGIN_SLUG', None) slug = getattr(self, 'PLUGIN_SLUG', None)
if not name: if not slug:
name = self.plugin_name() slug = self.plugin_name()
return slugify(name) return slugify(slug)
@property @property
def human_name(self): def human_name(self):
"""human readable name for labels etc.""" """human readable name for labels etc."""
name = getattr(self, 'PLUGIN_TITLE', None) human_name = getattr(self, 'PLUGIN_TITLE', None)
if not name: if not human_name:
name = self.plugin_name() human_name = self.plugin_name()
return name return human_name
@property @property
def description(self): def description(self):
@ -317,36 +317,36 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin):
@property @property
def author(self): def author(self):
"""returns author of plugin - either from plugin settings or git""" """returns author of plugin - either from plugin settings or git"""
name = getattr(self, 'AUTHOR', None) author = getattr(self, 'AUTHOR', None)
if not name: if not author:
name = self.package.get('author') author = self.package.get('author')
if not name: if not author:
name = _('No author found') author = _('No author found')
return name return author
@property @property
def pub_date(self): def pub_date(self):
"""returns publishing date of plugin - either from plugin settings or git""" """returns publishing date of plugin - either from plugin settings or git"""
name = getattr(self, 'PUBLISH_DATE', None) pub_date = getattr(self, 'PUBLISH_DATE', None)
if not name: if not pub_date:
name = self.package.get('date') pub_date = self.package.get('date')
else: else:
name = datetime.fromisoformat(str(name)) pub_date = datetime.fromisoformat(str(pub_date))
if not name: if not pub_date:
name = _('No date found') pub_date = _('No date found')
return name return pub_date
@property @property
def version(self): def version(self):
"""returns version of plugin""" """returns version of plugin"""
name = getattr(self, 'VERSION', None) version = getattr(self, 'VERSION', None)
return name return version
@property @property
def website(self): def website(self):
"""returns website of plugin""" """returns website of plugin"""
name = getattr(self, 'WEBSITE', None) website = getattr(self, 'WEBSITE', None)
return name return website
@property @property
def license(self): def license(self):