Skip to content

Commit

Permalink
refs agiliq#71: use a kwarg to lookup gateways module
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxcanfly committed Jun 4, 2013
1 parent 634f19b commit ee8439e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions merchant/contrib/django/billing/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
gateway_cache = {}


def get_gateway(gateway, *args, **kwargs):
def get_gateway(gateway, module_path="merchant.contrib.django.billing.gateways", *args, **kwargs):
"""
Return a gateway instance specified by `gateway` name.
This caches gateway classes in a module-level dictionnary to avoid hitting
Expand All @@ -29,7 +29,7 @@ def get_gateway(gateway, *args, **kwargs):
# Let's actually load it (it's not in the cache)
gateway_filename = "%s_gateway" % gateway
gateway_module = None
gateway_module = import_module("merchant.contrib.django.billing.gateways.%s" % gateway_filename)
gateway_module = import_module("%s.%s" % (module_path, gateway_filename))
if not gateway_module:
raise GatewayModuleNotFound("Missing gateway: %s" % (gateway))
gateway_class_name = "".join(gateway_filename.title().split("_"))
Expand Down

0 comments on commit ee8439e

Please sign in to comment.