Upgade to dj 1.10
This commit is contained in:
parent
47cf15a000
commit
5786cff38c
2
TODO.md
2
TODO.md
|
@ -465,8 +465,6 @@ with open(file) as handler:
|
||||||
|
|
||||||
# Add confirmation step on transaction actions like process transaction
|
# 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
|
# SAVE INISTIAL PASSWORD from all services, and just use it to create the service, never update it
|
||||||
|
|
||||||
|
|
||||||
# Don't use system groups for unixmailbackends
|
# Don't use system groups for unixmailbackends
|
||||||
|
|
|
@ -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)
|
context['display_objects'] = format_display_objects(modeladmin, request, queryset)
|
||||||
|
|
||||||
# Display the confirmation page
|
# Display the confirmation page
|
||||||
return TemplateResponse(request, template,
|
return TemplateResponse(request, template, context)
|
||||||
context, current_app=modeladmin.admin_site.name)
|
|
||||||
return inner
|
return inner
|
||||||
return decorator
|
return decorator
|
||||||
|
|
|
@ -330,9 +330,7 @@ class ChangePasswordAdminMixin(object):
|
||||||
'password': random_ascii(10),
|
'password': random_ascii(10),
|
||||||
}
|
}
|
||||||
context.update(admin.site.each_context(request))
|
context.update(admin.site.each_context(request))
|
||||||
return TemplateResponse(request,
|
return TemplateResponse(request, self.change_user_password_template, context)
|
||||||
self.change_user_password_template,
|
|
||||||
context, current_app=self.admin_site.name)
|
|
||||||
|
|
||||||
def show_hash(self, request, id):
|
def show_hash(self, request, id):
|
||||||
if not request.user.is_superuser:
|
if not request.user.is_superuser:
|
||||||
|
|
|
@ -196,6 +196,10 @@ AUTHENTICATION_BACKENDS = [
|
||||||
EMAIL_BACKEND = 'orchestra.contrib.mailer.backends.EmailBackend'
|
EMAIL_BACKEND = 'orchestra.contrib.mailer.backends.EmailBackend'
|
||||||
|
|
||||||
|
|
||||||
|
# Needed for Bulk operations
|
||||||
|
DATA_UPLOAD_MAX_NUMBER_FIELDS = None
|
||||||
|
|
||||||
|
|
||||||
#################################
|
#################################
|
||||||
## 3RD PARTY APPS CONIGURATION ##
|
## 3RD PARTY APPS CONIGURATION ##
|
||||||
#################################
|
#################################
|
||||||
|
|
|
@ -97,10 +97,10 @@ class ValidateZoneMixin(object):
|
||||||
super(ValidateZoneMixin, self).clean()
|
super(ValidateZoneMixin, self).clean()
|
||||||
if any(self.errors):
|
if any(self.errors):
|
||||||
return
|
return
|
||||||
has_srv = False
|
is_host = True
|
||||||
for form in self.forms:
|
for form in self.forms:
|
||||||
has_srv = form.cleaned_data.get('type') == Record.SRV
|
if form.cleaned_data.get('type') in (Record.TXT, Record.SRV, Record.CNAME):
|
||||||
if has_srv:
|
is_host = False
|
||||||
break
|
break
|
||||||
domain_names = []
|
domain_names = []
|
||||||
if self.instance.name:
|
if self.instance.name:
|
||||||
|
@ -113,9 +113,9 @@ class ValidateZoneMixin(object):
|
||||||
data = form.cleaned_data
|
data = form.cleaned_data
|
||||||
if data and not data['DELETE']:
|
if data and not data['DELETE']:
|
||||||
records.append(data)
|
records.append(data)
|
||||||
if '_' in name and not has_srv:
|
if '_' in name and is_host:
|
||||||
errors.append(ValidationError(
|
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)
|
domain = domain_for_validation(self.instance, records)
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -29,7 +29,7 @@ def validate_allowed_domain(value):
|
||||||
|
|
||||||
|
|
||||||
def validate_domain_name(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('_', '')
|
value = value.lstrip('*.').replace('_', '')
|
||||||
try:
|
try:
|
||||||
validate_hostname(value)
|
validate_hostname(value)
|
||||||
|
|
|
@ -47,7 +47,7 @@ class LogEntryAdmin(admin.ModelAdmin):
|
||||||
elif log.is_change():
|
elif log.is_change():
|
||||||
return _('Changed "%(link)s" - %(changes)s %(edit)s') % {
|
return _('Changed "%(link)s" - %(changes)s %(edit)s') % {
|
||||||
'link': self.content_object_link(log),
|
'link': self.content_object_link(log),
|
||||||
'changes': log.change_message,
|
'changes': log.get_change_message(),
|
||||||
'edit': edit,
|
'edit': edit,
|
||||||
}
|
}
|
||||||
elif log.is_deletion():
|
elif log.is_deletion():
|
||||||
|
|
|
@ -111,6 +111,5 @@ def letsencrypt(modeladmin, request, queryset):
|
||||||
'action_checkbox_name': admin.helpers.ACTION_CHECKBOX_NAME,
|
'action_checkbox_name': admin.helpers.ACTION_CHECKBOX_NAME,
|
||||||
'form': form,
|
'form': form,
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, 'admin/orchestra/generic_confirmation.html',
|
return TemplateResponse(request, 'admin/orchestra/generic_confirmation.html', context)
|
||||||
context, current_app=modeladmin.admin_site.name)
|
|
||||||
letsencrypt.short_description = "Let's encrypt!"
|
letsencrypt.short_description = "Let's encrypt!"
|
||||||
|
|
|
@ -30,7 +30,7 @@ def keep_log(execute, log, operations):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
trace = traceback.format_exc()
|
trace = traceback.format_exc()
|
||||||
log.state = log.EXCEPTION
|
log.state = log.EXCEPTION
|
||||||
log.stderr = trace
|
log.stderr += trace
|
||||||
log.save()
|
log.save()
|
||||||
subject = 'EXCEPTION executing backend(s) %s %s' % (args, kwargs)
|
subject = 'EXCEPTION executing backend(s) %s %s' % (args, kwargs)
|
||||||
logger.error(subject)
|
logger.error(subject)
|
||||||
|
|
|
@ -31,10 +31,12 @@ class WordpressMuController(ServiceController):
|
||||||
def with_retry(self, method, *args, retries=1, sleep=0.5, **kwargs):
|
def with_retry(self, method, *args, retries=1, sleep=0.5, **kwargs):
|
||||||
for i in range(retries):
|
for i in range(retries):
|
||||||
try:
|
try:
|
||||||
return method(*args, **kwargs)
|
return method(*args, verify=self.VERIFY, **kwargs)
|
||||||
except requests.exceptions.ConnectionError:
|
except requests.exceptions.ConnectionError:
|
||||||
if i >= retries:
|
if i >= retries:
|
||||||
raise
|
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)
|
time.sleep(sleep)
|
||||||
|
|
||||||
def login(self, session):
|
def login(self, session):
|
||||||
|
@ -46,7 +48,7 @@ class WordpressMuController(ServiceController):
|
||||||
'redirect_to': '/wp-admin/'
|
'redirect_to': '/wp-admin/'
|
||||||
}
|
}
|
||||||
sys.stdout.write("Login URL: %s\n" % login_url)
|
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/':
|
if response.url != main_url + '/wp-admin/':
|
||||||
raise IOError("Failure login to remote application (%s)" % login_url)
|
raise IOError("Failure login to remote application (%s)" % login_url)
|
||||||
|
|
||||||
|
@ -69,7 +71,8 @@ class WordpressMuController(ServiceController):
|
||||||
'class="edit">%s</a>' % saas.name
|
'class="edit">%s</a>' % saas.name
|
||||||
)
|
)
|
||||||
sys.stdout.write("Search URL: %s\n" % search)
|
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
|
# Get id
|
||||||
ids = regex.search(content)
|
ids = regex.search(content)
|
||||||
if not ids and not blog_id:
|
if not ids and not blog_id:
|
||||||
|
@ -94,7 +97,7 @@ class WordpressMuController(ServiceController):
|
||||||
url = self.get_main_url()
|
url = self.get_main_url()
|
||||||
url += '/wp-admin/network/site-new.php'
|
url += '/wp-admin/network/site-new.php'
|
||||||
sys.stdout.write("Create URL: %s\n" % url)
|
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="([^"]*)"')
|
wpnonce = re.compile('name="_wpnonce_add-blog"\s+value="([^"]*)"')
|
||||||
try:
|
try:
|
||||||
|
@ -111,7 +114,7 @@ class WordpressMuController(ServiceController):
|
||||||
}
|
}
|
||||||
|
|
||||||
# Validate response
|
# 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)
|
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]+)" />')
|
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')
|
content = response.content.decode('utf8')
|
||||||
|
@ -130,7 +133,7 @@ class WordpressMuController(ServiceController):
|
||||||
action_url = re.search(url_regex, content).groups()[0].replace("&", '&')
|
action_url = re.search(url_regex, content).groups()[0].replace("&", '&')
|
||||||
sys.stdout.write("%s confirm URL: %s\n" % (action, action_url))
|
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="([^"]*)"')
|
wpnonce = re.compile('name="_wpnonce"\s+value="([^"]*)"')
|
||||||
try:
|
try:
|
||||||
wpnonce = wpnonce.search(content).groups()[0]
|
wpnonce = wpnonce.search(content).groups()[0]
|
||||||
|
@ -145,7 +148,7 @@ class WordpressMuController(ServiceController):
|
||||||
action_url = self.get_main_url()
|
action_url = self.get_main_url()
|
||||||
action_url += '/wp-admin/network/sites.php?action=%sblog' % action
|
action_url += '/wp-admin/network/sites.php?action=%sblog' % action
|
||||||
sys.stdout.write("%s URL: %s\n" % (action, action_url))
|
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)
|
self.validate_response(response)
|
||||||
|
|
||||||
def is_active(self, content):
|
def is_active(self, content):
|
||||||
|
|
|
@ -71,8 +71,7 @@ def set_permission(modeladmin, request, queryset):
|
||||||
'action_checkbox_name': admin.helpers.ACTION_CHECKBOX_NAME,
|
'action_checkbox_name': admin.helpers.ACTION_CHECKBOX_NAME,
|
||||||
'form': form,
|
'form': form,
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, 'admin/systemusers/systemuser/set_permission.html',
|
return TemplateResponse(request, 'admin/systemusers/systemuser/set_permission.html', context)
|
||||||
context, current_app=modeladmin.admin_site.name)
|
|
||||||
set_permission.url_name = 'set-permission'
|
set_permission.url_name = 'set-permission'
|
||||||
set_permission.tool_description = _("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,
|
'action_checkbox_name': admin.helpers.ACTION_CHECKBOX_NAME,
|
||||||
'form': form,
|
'form': form,
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, 'admin/systemusers/systemuser/create_link.html',
|
return TemplateResponse(request, 'admin/systemusers/systemuser/create_link.html', context)
|
||||||
context, current_app=modeladmin.admin_site.name)
|
|
||||||
create_link.url_name = 'create-link'
|
create_link.url_name = 'create-link'
|
||||||
create_link.tool_description = _("Create link")
|
create_link.tool_description = _("Create link")
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ Markdown==2.4
|
||||||
djangorestframework==3.4.7
|
djangorestframework==3.4.7
|
||||||
ecdsa==0.11
|
ecdsa==0.11
|
||||||
Pygments==1.6
|
Pygments==1.6
|
||||||
django-filter==0.7
|
django-filter==0.15.2
|
||||||
jsonfield==0.9.22
|
jsonfield==0.9.22
|
||||||
python-dateutil==2.2
|
python-dateutil==2.2
|
||||||
https://github.com/glic3rinu/passlib/archive/master.zip
|
https://github.com/glic3rinu/passlib/archive/master.zip
|
||||||
|
|
Loading…
Reference in New Issue