1
0
mirror of https://github.com/Yubico/yubiadmin.git synced 2024-12-03 04:24:12 +01:00

Fix ordering when missing app.name

This commit is contained in:
Dain Nilsson 2013-05-31 16:42:08 +02:00
parent c3e7298241
commit d2d857a938
2 changed files with 8 additions and 2 deletions

View File

@ -26,11 +26,17 @@
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
import os import os
import sys
from importlib import import_module from importlib import import_module
apps = [] apps = []
__all__ = ['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__)): for filename in os.listdir(os.path.dirname(__file__)):
if filename.endswith('.py') and not filename.startswith('__'): if filename.endswith('.py') and not filename.startswith('__'):
module = import_module('yubiadmin.apps.%s' % filename[:-3]) module = import_module('yubiadmin.apps.%s' % filename[:-3])

View File

@ -34,8 +34,8 @@ import sys
def inspect_app(app): def inspect_app(app):
name = app.name or sys.modules[app.__module__].__file__.split('/')[-1] \ name = getattr(app, 'name', None) or sys.modules[app.__module__].__file__ \
.rsplit('.', 1)[0] .split('/')[-1].rsplit('.', 1)[0]
if app.__doc__: if app.__doc__:
doc = app.__doc__.strip() doc = app.__doc__.strip()