Upgade to dj 1.10

This commit is contained in:
Marc Aymerich 2016-10-22 07:23:45 +00:00
parent 47cf15a000
commit 5786cff38c
12 changed files with 28 additions and 29 deletions

View File

@ -465,8 +465,6 @@ with open(file) as handler:
# Add confirmation step on transaction actions like process transaction
# SAVE INISTIAL PASSWORD from all services, and just use it to create the service, never update it
# Don't use system groups for unixmailbackends

View File

@ -96,7 +96,6 @@ def action_with_confirmation(action_name=None, extra_context=None, validator=Non
context['display_objects'] = format_display_objects(modeladmin, request, queryset)
# Display the confirmation page
return TemplateResponse(request, template,
context, current_app=modeladmin.admin_site.name)
return TemplateResponse(request, template, context)
return inner
return decorator

View File

@ -330,9 +330,7 @@ class ChangePasswordAdminMixin(object):
'password': random_ascii(10),
}
context.update(admin.site.each_context(request))
return TemplateResponse(request,
self.change_user_password_template,
context, current_app=self.admin_site.name)
return TemplateResponse(request, self.change_user_password_template, context)
def show_hash(self, request, id):
if not request.user.is_superuser:

View File

@ -196,6 +196,10 @@ AUTHENTICATION_BACKENDS = [
EMAIL_BACKEND = 'orchestra.contrib.mailer.backends.EmailBackend'
# Needed for Bulk operations
DATA_UPLOAD_MAX_NUMBER_FIELDS = None
#################################
## 3RD PARTY APPS CONIGURATION ##
#################################

View File

@ -97,10 +97,10 @@ class ValidateZoneMixin(object):
super(ValidateZoneMixin, self).clean()
if any(self.errors):
return
has_srv = False
is_host = True
for form in self.forms:
has_srv = form.cleaned_data.get('type') == Record.SRV
if has_srv:
if form.cleaned_data.get('type') in (Record.TXT, Record.SRV, Record.CNAME):
is_host = False
break
domain_names = []
if self.instance.name:
@ -113,9 +113,9 @@ class ValidateZoneMixin(object):
data = form.cleaned_data
if data and not data['DELETE']:
records.append(data)
if '_' in name and not has_srv:
if '_' in name and is_host:
errors.append(ValidationError(
_("%s: Domains containing underscore character '_' must provide an SRV record.") % name
_("%s: Hosts can not have underscore character '_', consider providing a SRV, CNAME or TXT record.") % name
))
domain = domain_for_validation(self.instance, records)
try:

View File

@ -29,7 +29,7 @@ def validate_allowed_domain(value):
def validate_domain_name(value):
# SRV records may use '_' in the domain name
# SRV, CNAME and TXT records may use '_' in the domain name
value = value.lstrip('*.').replace('_', '')
try:
validate_hostname(value)

View File

@ -47,7 +47,7 @@ class LogEntryAdmin(admin.ModelAdmin):
elif log.is_change():
return _('Changed "%(link)s" - %(changes)s %(edit)s') % {
'link': self.content_object_link(log),
'changes': log.change_message,
'changes': log.get_change_message(),
'edit': edit,
}
elif log.is_deletion():

View File

@ -111,6 +111,5 @@ def letsencrypt(modeladmin, request, queryset):
'action_checkbox_name': admin.helpers.ACTION_CHECKBOX_NAME,
'form': form,
}
return TemplateResponse(request, 'admin/orchestra/generic_confirmation.html',
context, current_app=modeladmin.admin_site.name)
return TemplateResponse(request, 'admin/orchestra/generic_confirmation.html', context)
letsencrypt.short_description = "Let's encrypt!"

View File

@ -30,7 +30,7 @@ def keep_log(execute, log, operations):
except Exception as e:
trace = traceback.format_exc()
log.state = log.EXCEPTION
log.stderr = trace
log.stderr += trace
log.save()
subject = 'EXCEPTION executing backend(s) %s %s' % (args, kwargs)
logger.error(subject)

View File

@ -31,10 +31,12 @@ class WordpressMuController(ServiceController):
def with_retry(self, method, *args, retries=1, sleep=0.5, **kwargs):
for i in range(retries):
try:
return method(*args, **kwargs)
return method(*args, verify=self.VERIFY, **kwargs)
except requests.exceptions.ConnectionError:
if i >= retries:
raise
sys.stderr.write("Connection error while {method}{args}, retry {i}/{retries}\n".format(
method=method.__name__, args=str(args), i=i, retries=retries))
time.sleep(sleep)
def login(self, session):
@ -46,7 +48,7 @@ class WordpressMuController(ServiceController):
'redirect_to': '/wp-admin/'
}
sys.stdout.write("Login URL: %s\n" % login_url)
response = self.with_retry(session.post, login_url, data=login_data, verify=self.VERIFY)
response = self.with_retry(session.post, login_url, data=login_data)
if response.url != main_url + '/wp-admin/':
raise IOError("Failure login to remote application (%s)" % login_url)
@ -69,7 +71,8 @@ class WordpressMuController(ServiceController):
'class="edit">%s</a>' % saas.name
)
sys.stdout.write("Search URL: %s\n" % search)
content = self.with_retry(session.get, search, verify=self.VERIFY).content.decode('utf8')
response = self.with_retry(session.get, search)
content = response.content.decode('utf8')
# Get id
ids = regex.search(content)
if not ids and not blog_id:
@ -94,7 +97,7 @@ class WordpressMuController(ServiceController):
url = self.get_main_url()
url += '/wp-admin/network/site-new.php'
sys.stdout.write("Create URL: %s\n" % url)
content = self.with_retry(session.get, url, verify=self.VERIFY).content.decode('utf8')
content = self.with_retry(session.get, url).content.decode('utf8')
wpnonce = re.compile('name="_wpnonce_add-blog"\s+value="([^"]*)"')
try:
@ -111,7 +114,7 @@ class WordpressMuController(ServiceController):
}
# Validate response
response = self.with_retry(session.post, url, data=data, verify=self.VERIFY)
response = self.with_retry(session.post, url, data=data)
self.validate_response(response)
blog_id = re.compile(r'<link id="wp-admin-canonical" rel="canonical" href="http(?:[^ ]+)/wp-admin/network/site-new.php\?id=([0-9]+)" />')
content = response.content.decode('utf8')
@ -130,7 +133,7 @@ class WordpressMuController(ServiceController):
action_url = re.search(url_regex, content).groups()[0].replace("&#038;", '&')
sys.stdout.write("%s confirm URL: %s\n" % (action, action_url))
content = self.with_retry(session.get, action_url, verify=self.VERIFY).content.decode('utf8')
content = self.with_retry(session.get, action_url).content.decode('utf8')
wpnonce = re.compile('name="_wpnonce"\s+value="([^"]*)"')
try:
wpnonce = wpnonce.search(content).groups()[0]
@ -145,7 +148,7 @@ class WordpressMuController(ServiceController):
action_url = self.get_main_url()
action_url += '/wp-admin/network/sites.php?action=%sblog' % action
sys.stdout.write("%s URL: %s\n" % (action, action_url))
response = self.with_retry(session.post, action_url, data=data, verify=self.VERIFY)
response = self.with_retry(session.post, action_url, data=data)
self.validate_response(response)
def is_active(self, content):

View File

@ -71,8 +71,7 @@ def set_permission(modeladmin, request, queryset):
'action_checkbox_name': admin.helpers.ACTION_CHECKBOX_NAME,
'form': form,
}
return TemplateResponse(request, 'admin/systemusers/systemuser/set_permission.html',
context, current_app=modeladmin.admin_site.name)
return TemplateResponse(request, 'admin/systemusers/systemuser/set_permission.html', context)
set_permission.url_name = 'set-permission'
set_permission.tool_description = _("Set permission")
@ -126,8 +125,7 @@ def create_link(modeladmin, request, queryset):
'action_checkbox_name': admin.helpers.ACTION_CHECKBOX_NAME,
'form': form,
}
return TemplateResponse(request, 'admin/systemusers/systemuser/create_link.html',
context, current_app=modeladmin.admin_site.name)
return TemplateResponse(request, 'admin/systemusers/systemuser/create_link.html', context)
create_link.url_name = 'create-link'
create_link.tool_description = _("Create link")

View File

@ -10,7 +10,7 @@ Markdown==2.4
djangorestframework==3.4.7
ecdsa==0.11
Pygments==1.6
django-filter==0.7
django-filter==0.15.2
jsonfield==0.9.22
python-dateutil==2.2
https://github.com/glic3rinu/passlib/archive/master.zip