Skip to content

Commit

Permalink
Workaround to get the templates properly on production
Browse files Browse the repository at this point in the history
  • Loading branch information
Delawen committed Jul 28, 2020
1 parent 59bce2b commit fa2b286
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions pretix_mercadopago/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,12 @@ def payment_is_valid_session(self, request):
"""

def payment_form_render(self, request) -> str:
template = get_template('pretix_mercadopago/checkout_payment_form.html')
try:
# TODO weird error that doesn't include templates on our path folder
template = get_template('../../pretix_mercadopago/templates/pretix_mercadopago/checkout_payment_form.html')
except Exception as e:
template = get_template('pretixplugins/paypal/checkout_payment_form.html')

ctx = {'request': request, 'event': self.event, 'settings': self.settings}
return template.render(ctx)

Expand Down Expand Up @@ -297,7 +302,12 @@ def checkout_confirm_render(self, request) -> str:
Returns the HTML that should be displayed when the user selected this provider
on the 'confirm order' page.
"""
template = get_template('pretix_mercadopago/checkout_payment_confirm.html')

try:
# TODO weird error that doesn't include templates on our path folder
template = get_template('../../pretix_mercadopago/templates/pretix_mercadopago/checkout_payment_confirm.html')
except Exception as e:
template = get_template('pretixplugins/paypal/checkout_payment_confirm.html')
ctx = {'request': request, 'event': self.event, 'settings': self.settings}
return template.render(ctx)

Expand All @@ -308,7 +318,12 @@ def payment_pending_render(self, request, payment) -> str:
retry = False
except KeyError:
pass
template = get_template('pretix_mercadopago/pending.html')
try:
# TODO weird error that doesn't include templates on our path folder
template = get_template('../../pretix_mercadopago/templates/pretix_mercadopago/pending.html')
except Exception as e:
template = get_template('pretixplugins/paypal/pending.html')

ctx = {'request': request, 'event': self.event, 'settings': self.settings,
'retry': retry, 'order': payment.order}
return template.render(ctx)
Expand Down

0 comments on commit fa2b286

Please sign in to comment.