summaryrefslogtreecommitdiff
path: root/app/lib/django_comments/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/lib/django_comments/forms.py')
-rw-r--r--app/lib/django_comments/forms.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/app/lib/django_comments/forms.py b/app/lib/django_comments/forms.py
index c1324e9..7b7eafd 100644
--- a/app/lib/django_comments/forms.py
+++ b/app/lib/django_comments/forms.py
@@ -56,8 +56,6 @@ class CommentSecurityForm(forms.Form):
def clean_timestamp(self):
"""Make sure the timestamp isn't too far (default is > 2 hours) in the past."""
ts = self.cleaned_data["timestamp"]
- if time.time() - ts > DEFAULT_COMMENTS_TIMEOUT:
- raise forms.ValidationError("Timestamp check failed")
return ts
def generate_security_data(self):
@@ -105,7 +103,7 @@ class CommentDetailsForm(CommentSecurityForm):
comment = forms.CharField(label=_('Comment'), widget=forms.Textarea,
max_length=COMMENT_MAX_LENGTH)
- def get_comment_object(self):
+ def get_comment_object(self, site_id=None):
"""
Return a new (unsaved) comment object based on the information in this
form. Assumes that the form is already validated and will throw a
@@ -118,7 +116,7 @@ class CommentDetailsForm(CommentSecurityForm):
raise ValueError("get_comment_object may only be called on valid forms")
CommentModel = self.get_comment_model()
- new = CommentModel(**self.get_comment_create_data())
+ new = CommentModel(**self.get_comment_create_data(site_id=site_id))
new = self.check_for_duplicate_comment(new)
return new
@@ -131,7 +129,7 @@ class CommentDetailsForm(CommentSecurityForm):
"""
return get_model()
- def get_comment_create_data(self):
+ def get_comment_create_data(self, site_id=None):
"""
Returns the dict of data to be used to create a comment. Subclasses in
custom comment apps that override get_comment_model can override this
@@ -145,7 +143,7 @@ class CommentDetailsForm(CommentSecurityForm):
user_url=self.cleaned_data["url"],
comment=self.cleaned_data["comment"],
submit_date=timezone.now(),
- site_id=settings.SITE_ID,
+ site_id=site_id or getattr(settings, "SITE_ID", None),
is_public=True,
is_removed=False,
)