Skip to content

Commit

Permalink
Merge pull request #110 from luto/allow-view-arguments
Browse files Browse the repository at this point in the history
allow a derived management command to change the way views are instantiated
  • Loading branch information
palewire authored Nov 20, 2017
2 parents 46fe503 + 7568947 commit 70421e5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bakery/management/commands/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ def build_media(self):
os.path.join(self.build_dir, settings.MEDIA_URL.lstrip('/'))
)

def get_view_instance(self, view):
"""
Given a view class, get an instance of it.
"""
return view()

def build_views(self):
"""
Bake out specified buildable views.
Expand All @@ -198,7 +204,7 @@ def build_views(self):
if self.verbosity > 1:
self.stdout.write("Building %s" % view_str)
view = get_callable(view_str)
view().build_method()
self.get_view_instance(view).build_method()

def copytree_and_gzip(self, source_dir, target_dir):
"""
Expand Down

0 comments on commit 70421e5

Please sign in to comment.