Fixed bad payment method import

This commit is contained in:
Marc Aymerich 2014-11-14 16:12:56 +00:00
parent 07ccd80934
commit a58ebbd40a
5 changed files with 9 additions and 4 deletions

View File

@ -81,6 +81,7 @@ class DomainAdmin(AccountAdminMixin, ExtendedModelAdmin):
def display_is_top(self, domain): def display_is_top(self, domain):
return domain.is_top return domain.is_top
display_is_top.short_description = _("Is top")
display_is_top.boolean = True display_is_top.boolean = True
display_is_top.admin_order_field = 'top' display_is_top.admin_order_field = 'top'

View File

@ -1,5 +1,6 @@
from functools import partial from functools import partial
from django.db.models.loading import get_model
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
@ -70,6 +71,10 @@ class ServiceBackend(plugins.Plugin):
def get_backend(cls, name): def get_backend(cls, name):
return cls.get_plugin(name) return cls.get_plugin(name)
@classmethod
def model_class(cls):
return get_model(cls.model)
def get_banner(self): def get_banner(self):
time = timezone.now().strftime("%h %d, %Y %I:%M:%S") time = timezone.now().strftime("%h %d, %Y %I:%M:%S")
return "Generated by Orchestra at %s" % time return "Generated by Orchestra at %s" % time

View File

@ -93,7 +93,7 @@ class Resource(models.Model):
self.sync_periodic_task() self.sync_periodic_task()
# This only work on tests (multiprocessing used on real deployments) # This only work on tests (multiprocessing used on real deployments)
apps.get_app_config('resources').reload_relations() apps.get_app_config('resources').reload_relations()
run('sleep 2 && touch %s/wsgi.py' % get_project_root(), async=True, display=True) run('sleep 2 && touch %s/wsgi.py' % get_project_root(), async=True)
def delete(self, *args, **kwargs): def delete(self, *args, **kwargs):
super(Resource, self).delete(*args, **kwargs) super(Resource, self).delete(*args, **kwargs)

View File

@ -1,5 +1,4 @@
from celery import shared_task from celery import shared_task
from django.db.models.loading import get_model
from orchestra.apps.orchestration.models import BackendOperation as Operation from orchestra.apps.orchestration.models import BackendOperation as Operation
from orchestra.models.utils import get_model_field_path from orchestra.models.utils import get_model_field_path
@ -16,7 +15,7 @@ def monitor(resource_id, ids=None):
# Execute monitors # Execute monitors
for monitor_name in resource.monitors: for monitor_name in resource.monitors:
backend = ServiceMonitor.get_backend(monitor_name) backend = ServiceMonitor.get_backend(monitor_name)
model = get_model(backend.model) model = backend.model_class()
kwargs = {} kwargs = {}
if ids: if ids:
path = get_model_field_path(model, resource_model) path = get_model_field_path(model, resource_model)

View File

@ -113,7 +113,7 @@ def run(command, display=False, error_codes=[0], silent=False, stdin='', async=F
if return_code not in error_codes: if return_code not in error_codes:
out.failed = True out.failed = True
msg = "\nrun() encountered an error (return code %s) while executing '%s'\n" msg = "\nrun() encountered an error (return code %s) while executing '%s'\n"
msg = msg % (p.returncode, command) msg = msg % (return_code, command)
if display: if display:
sys.stderr.write("\n\033[1;31mCommandError: %s %s\033[m\n" % (msg, err)) sys.stderr.write("\n\033[1;31mCommandError: %s %s\033[m\n" % (msg, err))
if not silent: if not silent: