1
0
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:
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.
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])

View File

@ -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()