Moved inside the function so its re-evaluated for every testcase.

This commit is contained in:
Martin Mahner 2013-12-18 12:54:13 +01:00
parent 983d8d1dc8
commit fae95e1e2a

View file

@ -14,8 +14,6 @@ EXPIRE_CHOICES = getattr(settings, 'DPASTE_EXPIRE_CHOICES', (
))
EXPIRE_DEFAULT = getattr(settings, 'DPASTE_EXPIRE_DEFAULT', EXPIRE_CHOICES[2][0])
MAX_CONTENT_LENGTH = getattr(settings, 'DPASTE_MAX_CONTENT_LENGTH', 250*1024*1024)
MAX_SNIPPETS_PER_USER = getattr(settings, 'DPASTE_MAX_SNIPPETS_PER_USER', 15)
class SnippetForm(forms.ModelForm):
content = forms.CharField(
@ -78,6 +76,8 @@ class SnippetForm(forms.ModelForm):
return self.cleaned_data
def save(self, parent=None, *args, **kwargs):
MAX_SNIPPETS_PER_USER = getattr(settings, 'DPASTE_MAX_SNIPPETS_PER_USER', 15)
# Set parent snippet
if parent:
self.instance.parent = parent