modify import_methods to search by full module name
diff --git a/xos/api/import_methods.py b/xos/api/import_methods.py
index 2a6ca57..0c6fb8c 100644
--- a/xos/api/import_methods.py
+++ b/xos/api/import_methods.py
@@ -27,7 +27,14 @@
return module
-def import_api_methods(dirname=None, api_path="api"):
+def import_module_by_dotted_name(name):
+ print "import", name
+ module = __import__(name)
+ for part in name.split(".")[1:]:
+ module = getattr(module, part)
+ return module
+
+def import_api_methods(dirname=None, api_path="api", api_module="api"):
subdirs=[]
urlpatterns=[]
@@ -38,8 +45,10 @@
for fn in os.listdir(dirname):
pathname = os.path.join(dirname,fn)
if os.path.isfile(pathname) and fn.endswith(".py") and (fn!="__init__.py") and (fn!="import_methods.py"):
- module = import_module_from_filename(dirname, fn)
+ #module = import_module_from_filename(dirname, fn)
+ module = import_module_by_dotted_name(api_module + "." + fn[:-3])
for classname in dir(module):
+ print " ",classname
c = getattr(module, classname, None)
if inspect.isclass(c) and issubclass(c, View) and (classname not in globals()):
@@ -52,7 +61,7 @@
view_urls.append( (method_kind, method_name, classname, c) )
elif os.path.isdir(pathname):
- urlpatterns.extend(import_api_methods(pathname, os.path.join(api_path, fn)))
+ urlpatterns.extend(import_api_methods(pathname, os.path.join(api_path, fn), api_module+"." + fn))
for view_url in view_urls:
if view_url[0] == "list":
diff --git a/xos/api/service/__init__.py b/xos/api/service/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/xos/api/service/__init__.py
@@ -0,0 +1 @@
+
diff --git a/xos/api/service/vbng/__init__.py b/xos/api/service/vbng/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/xos/api/service/vbng/__init__.py
@@ -0,0 +1 @@
+
diff --git a/xos/api/tenant/__init__.py b/xos/api/tenant/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/xos/api/tenant/__init__.py
@@ -0,0 +1 @@
+
diff --git a/xos/api/tenant/cord/__init__.py b/xos/api/tenant/cord/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/xos/api/tenant/cord/__init__.py
@@ -0,0 +1 @@
+