mirror of
https://github.com/Yubico/yubiadmin.git
synced 2024-12-01 16:24:13 +01:00
Fix ordering when missing app.name
This commit is contained in:
parent
c3e7298241
commit
d2d857a938
@ -26,11 +26,17 @@
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import os
|
||||
import sys
|
||||
from importlib import import_module
|
||||
|
||||
apps = []
|
||||
__all__ = ['apps']
|
||||
|
||||
|
||||
def get_name(app):
|
||||
return getattr(app, 'name', None) or sys.modules[app.__module__].__file__ \
|
||||
.split('/')[-1].rsplit('.', 1)[0]
|
||||
|
||||
for filename in os.listdir(os.path.dirname(__file__)):
|
||||
if filename.endswith('.py') and not filename.startswith('__'):
|
||||
module = import_module('yubiadmin.apps.%s' % filename[:-3])
|
||||
|
@ -34,8 +34,8 @@ import sys
|
||||
|
||||
|
||||
def inspect_app(app):
|
||||
name = app.name or sys.modules[app.__module__].__file__.split('/')[-1] \
|
||||
.rsplit('.', 1)[0]
|
||||
name = getattr(app, 'name', None) or sys.modules[app.__module__].__file__ \
|
||||
.split('/')[-1].rsplit('.', 1)[0]
|
||||
|
||||
if app.__doc__:
|
||||
doc = app.__doc__.strip()
|
||||
|
Loading…
Reference in New Issue
Block a user