Skip to content

Commit

Permalink
ignore_names parameter feed with paths, added path serializer that re…
Browse files Browse the repository at this point in the history
…turns expected paths required
  • Loading branch information
aiscenblue committed Oct 19, 2018
1 parent c201f9a commit 75a6e62
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions flask_blueprint/package_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ def __extract_packages(self, packages):
else:
raise TypeError("package should be a generator type")

""" extract modules from the package"""
def __serialize_module_paths(self):
return list(set([path.split("/")[-1:][0] for path in self.paths]))

""" extract modules from the package"""
def __extract_modules(self, loader, name, is_pkg):

""" if module found load module and save all attributes in the module found """
Expand All @@ -62,7 +64,7 @@ def __extract_modules(self, loader, name, is_pkg):
if hasattr(mod, '__method__'):

""" register to the blueprint if method attribute found """
module_router = ModuleRouter(mod).register_route(app=self.application, name=name)
module_router = ModuleRouter(mod, ignore_names=self.__serialize_module_paths()).register_route(app=self.application, name=name)

self.__routers.extend(module_router.routers)
self.__modules.append(mod)
Expand Down

0 comments on commit 75a6e62

Please sign in to comment.