[geany/www.geany.org] 9b8a30: And again, django.utils.timezone.now()

Enrico Tröger git-noreply at xxxxx
Sun Jan 5 18:46:51 UTC 2014


Branch:      refs/heads/master
Author:      Enrico Tröger <enrico.troeger at uvena.de>
Committer:   Enrico Tröger <enrico.troeger at uvena.de>
Date:        Sun, 05 Jan 2014 18:46:51 UTC
Commit:      9b8a304cfed49212e16c5984c6bb7f4d5f3c3b7c
             https://github.com/geany/www.geany.org/commit/9b8a304cfed49212e16c5984c6bb7f4d5f3c3b7c

Log Message:
-----------
And again, django.utils.timezone.now()


Modified Paths:
--------------
    pastebin/forms.py

Modified: pastebin/forms.py
7 files changed, 4 insertions(+), 3 deletions(-)
===================================================================
@@ -12,11 +12,12 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+from datetime import timedelta
 from django import forms
+from django.utils import timezone
 from django.utils.translation import ugettext_lazy as _
 from pastebin.highlight import LEXER_LIST, LEXER_DEFAULT
 from pastebin.models import Snippet, Spamword
-import datetime
 
 
 #===============================================================================
@@ -72,8 +73,8 @@ def save(self, parent=None, *args, **kwargs):
             self.instance.parent = parent
 
         # Add expire datestamp
-        self.instance.expires = datetime.datetime.now() + \
-            datetime.timedelta(seconds=int(self.cleaned_data['expire_options']))
+        self.instance.expires = timezone.now() + \
+            timedelta(seconds=int(self.cleaned_data['expire_options']))
 
         # Save snippet in the db
         forms.ModelForm.save(self, *args, **kwargs)



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list