[geany/www.geany.org] 258ea6: Use aware datetime objects
Enrico Tröger
git-noreply at xxxxx
Tue May 14 22:31:54 UTC 2013
Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger at uvena.de>
Committer: Enrico Tröger <enrico.troeger at uvena.de>
Date: Tue, 14 May 2013 22:31:54 UTC
Commit: 258ea630e61328bb8cf950d5423b1bc33ed883a3
https://github.com/geany/www.geany.org/commit/258ea630e61328bb8cf950d5423b1bc33ed883a3
Log Message:
-----------
Use aware datetime objects
Modified Paths:
--------------
pastebin/api/create.py
Modified: pastebin/api/create.py
9 files changed, 5 insertions(+), 4 deletions(-)
===================================================================
@@ -3,16 +3,17 @@
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
-#
+#
# 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 datetime, timedelta
+from datetime import timedelta
+from django.utils.timezone import now
from pastebin.forms import SnippetForm
from pastebin.highlight import LEXER_LIST_ALL, LEXER_DEFAULT
from pastebin.models import Snippet
@@ -131,7 +132,7 @@ def _preprocess_data(self):
def _create_snippet(self):
cleaned_data = self._snippet_form.cleaned_data
expire_options = int(cleaned_data.get('expire_options', 3600))
- expires = datetime.now() + timedelta(seconds=expire_options)
+ expires = now() + timedelta(seconds=expire_options)
self._snippet = Snippet.objects.create(
content=cleaned_data['content'],
--------------
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