mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
Set array arguments to None
This commit is contained in:
parent
2882775842
commit
7994d19f65
@ -187,6 +187,7 @@ Contributors
|
|||||||
* Albert O'Connor
|
* Albert O'Connor
|
||||||
* Morgan Aubert
|
* Morgan Aubert
|
||||||
* Diederik van der Boor
|
* Diederik van der Boor
|
||||||
|
* shoefler
|
||||||
|
|
||||||
Translators
|
Translators
|
||||||
===========
|
===========
|
||||||
|
@ -242,12 +242,20 @@ class ButtonHelper(object):
|
|||||||
self.permission_helper = view.permission_helper
|
self.permission_helper = view.permission_helper
|
||||||
self.url_helper = view.url_helper
|
self.url_helper = view.url_helper
|
||||||
|
|
||||||
def finalise_classname(self, classnames_add=[], classnames_exclude=[]):
|
def finalise_classname(self, classnames_add=None, classnames_exclude=None):
|
||||||
|
if classnames_add is None:
|
||||||
|
classnames_add = []
|
||||||
|
if classnames_exclude is None:
|
||||||
|
classnames_exclude = []
|
||||||
combined = self.default_button_classnames + classnames_add
|
combined = self.default_button_classnames + classnames_add
|
||||||
finalised = [cn for cn in combined if cn not in classnames_exclude]
|
finalised = [cn for cn in combined if cn not in classnames_exclude]
|
||||||
return ' '.join(finalised)
|
return ' '.join(finalised)
|
||||||
|
|
||||||
def add_button(self, classnames_add=[], classnames_exclude=[]):
|
def add_button(self, classnames_add=None, classnames_exclude=None):
|
||||||
|
if classnames_add is None:
|
||||||
|
classnames_add = []
|
||||||
|
if classnames_exclude is None:
|
||||||
|
classnames_exclude = []
|
||||||
classnames = self.add_button_classnames + classnames_add
|
classnames = self.add_button_classnames + classnames_add
|
||||||
cn = self.finalise_classname(classnames, classnames_exclude)
|
cn = self.finalise_classname(classnames, classnames_exclude)
|
||||||
return {
|
return {
|
||||||
@ -257,7 +265,11 @@ class ButtonHelper(object):
|
|||||||
'title': _('Add a new %s') % self.verbose_name,
|
'title': _('Add a new %s') % self.verbose_name,
|
||||||
}
|
}
|
||||||
|
|
||||||
def inspect_button(self, pk, classnames_add=[], classnames_exclude=[]):
|
def inspect_button(self, pk, classnames_add=None, classnames_exclude=None):
|
||||||
|
if classnames_add is None:
|
||||||
|
classnames_add = []
|
||||||
|
if classnames_exclude is None:
|
||||||
|
classnames_exclude = []
|
||||||
classnames = self.inspect_button_classnames + classnames_add
|
classnames = self.inspect_button_classnames + classnames_add
|
||||||
cn = self.finalise_classname(classnames, classnames_exclude)
|
cn = self.finalise_classname(classnames, classnames_exclude)
|
||||||
return {
|
return {
|
||||||
@ -267,7 +279,11 @@ class ButtonHelper(object):
|
|||||||
'title': _('Inspect this %s') % self.verbose_name,
|
'title': _('Inspect this %s') % self.verbose_name,
|
||||||
}
|
}
|
||||||
|
|
||||||
def edit_button(self, pk, classnames_add=[], classnames_exclude=[]):
|
def edit_button(self, pk, classnames_add=None, classnames_exclude=None):
|
||||||
|
if classnames_add is None:
|
||||||
|
classnames_add = []
|
||||||
|
if classnames_exclude is None:
|
||||||
|
classnames_exclude = []
|
||||||
classnames = self.edit_button_classnames + classnames_add
|
classnames = self.edit_button_classnames + classnames_add
|
||||||
cn = self.finalise_classname(classnames, classnames_exclude)
|
cn = self.finalise_classname(classnames, classnames_exclude)
|
||||||
return {
|
return {
|
||||||
@ -277,7 +293,11 @@ class ButtonHelper(object):
|
|||||||
'title': _('Edit this %s') % self.verbose_name,
|
'title': _('Edit this %s') % self.verbose_name,
|
||||||
}
|
}
|
||||||
|
|
||||||
def delete_button(self, pk, classnames_add=[], classnames_exclude=[]):
|
def delete_button(self, pk, classnames_add=None, classnames_exclude=None):
|
||||||
|
if classnames_add is None:
|
||||||
|
classnames_add = []
|
||||||
|
if classnames_exclude is None:
|
||||||
|
classnames_exclude = []
|
||||||
classnames = self.delete_button_classnames + classnames_add
|
classnames = self.delete_button_classnames + classnames_add
|
||||||
cn = self.finalise_classname(classnames, classnames_exclude)
|
cn = self.finalise_classname(classnames, classnames_exclude)
|
||||||
return {
|
return {
|
||||||
@ -287,8 +307,14 @@ class ButtonHelper(object):
|
|||||||
'title': _('Delete this %s') % self.verbose_name,
|
'title': _('Delete this %s') % self.verbose_name,
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_buttons_for_obj(self, obj, exclude=[], classnames_add=[],
|
def get_buttons_for_obj(self, obj, exclude=None, classnames_add=None,
|
||||||
classnames_exclude=[]):
|
classnames_exclude=None):
|
||||||
|
if exclude is None:
|
||||||
|
exclude = []
|
||||||
|
if classnames_add is None:
|
||||||
|
classnames_add = []
|
||||||
|
if classnames_exclude is None:
|
||||||
|
classnames_exclude = []
|
||||||
ph = self.permission_helper
|
ph = self.permission_helper
|
||||||
usr = self.request.user
|
usr = self.request.user
|
||||||
pk = quote(getattr(obj, self.opts.pk.attname))
|
pk = quote(getattr(obj, self.opts.pk.attname))
|
||||||
@ -313,7 +339,11 @@ class PageButtonHelper(ButtonHelper):
|
|||||||
unpublish_button_classnames = []
|
unpublish_button_classnames = []
|
||||||
copy_button_classnames = []
|
copy_button_classnames = []
|
||||||
|
|
||||||
def unpublish_button(self, pk, classnames_add=[], classnames_exclude=[]):
|
def unpublish_button(self, pk, classnames_add=None, classnames_exclude=None):
|
||||||
|
if classnames_add is None:
|
||||||
|
classnames_add = []
|
||||||
|
if classnames_exclude is None:
|
||||||
|
classnames_exclude = []
|
||||||
classnames = self.unpublish_button_classnames + classnames_add
|
classnames = self.unpublish_button_classnames + classnames_add
|
||||||
cn = self.finalise_classname(classnames, classnames_exclude)
|
cn = self.finalise_classname(classnames, classnames_exclude)
|
||||||
return {
|
return {
|
||||||
@ -323,7 +353,11 @@ class PageButtonHelper(ButtonHelper):
|
|||||||
'title': _('Unpublish this %s') % self.verbose_name,
|
'title': _('Unpublish this %s') % self.verbose_name,
|
||||||
}
|
}
|
||||||
|
|
||||||
def copy_button(self, pk, classnames_add=[], classnames_exclude=[]):
|
def copy_button(self, pk, classnames_add=None, classnames_exclude=None):
|
||||||
|
if classnames_add is None:
|
||||||
|
classnames_add = []
|
||||||
|
if classnames_exclude is None:
|
||||||
|
classnames_exclude = []
|
||||||
classnames = self.copy_button_classnames + classnames_add
|
classnames = self.copy_button_classnames + classnames_add
|
||||||
cn = self.finalise_classname(classnames, classnames_exclude)
|
cn = self.finalise_classname(classnames, classnames_exclude)
|
||||||
return {
|
return {
|
||||||
@ -333,8 +367,14 @@ class PageButtonHelper(ButtonHelper):
|
|||||||
'title': _('Copy this %s') % self.verbose_name,
|
'title': _('Copy this %s') % self.verbose_name,
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_buttons_for_obj(self, obj, exclude=[], classnames_add=[],
|
def get_buttons_for_obj(self, obj, exclude=None, classnames_add=None,
|
||||||
classnames_exclude=[]):
|
classnames_exclude=None):
|
||||||
|
if exclude is None:
|
||||||
|
exclude = []
|
||||||
|
if classnames_add is None:
|
||||||
|
classnames_add = []
|
||||||
|
if classnames_exclude is None:
|
||||||
|
classnames_exclude = []
|
||||||
ph = self.permission_helper
|
ph = self.permission_helper
|
||||||
usr = self.request.user
|
usr = self.request.user
|
||||||
pk = quote(getattr(obj, self.opts.pk.attname))
|
pk = quote(getattr(obj, self.opts.pk.attname))
|
||||||
|
Loading…
Reference in New Issue
Block a user