catapela avatar catapela committed d4679da

solve Timezone problem - see issues

Comments (0)

Files changed (2)

dynamicLink/models.py

 import random
 import os
 import datetime
+from django.utils import timezone
 
 class Download(models.Model):
     slug = models.SlugField(verbose_name=_('slug'), blank=False, unique=True)
     def timeout_time(self):
         """If timout time is reached it returs True"""
         if not self.timeout_hours == 0: # never timeout through time
-            if self.timestamp_creation + datetime.timedelta(hours=self.timeout_hours) < datetime.datetime.now():
+            if self.timestamp_creation + datetime.timedelta(hours=self.timeout_hours) < timezone.now():
                 return True
 
     def timeout(self):
         """Is shown at the admit list display"""
         if self.timeout_hours == 0:
             return '<span style="color: #FF7F00; ">%s</span>' % unicode(_(u'never expires'))
-        return (self.timestamp_creation + datetime.timedelta(hours=self.timeout_hours)) - datetime.datetime.now()
+        return (self.timestamp_creation + datetime.timedelta(hours=self.timeout_hours)) - timezone.now()
 
     def set_link(self, file, slug='autogenerated', timeout=None, maxclicks=None):
         self.slug = slug

dynamicLink/version.py

 # -*- coding:utf-8 -*-
 # This Python file uses the following encoding: utf-8
 
-import django
-import sys
-
-VERSION = (0,5,6,0)
+VERSION = (0,5,6,1)
 RELEASE_DJANGO = ((1,2),(1,3),(1,4))
 PYTHON_MIN = (2,4)
 REQUIRES ="""
 Modification date: 03.08.2011
 
 Hints:
+- 0.5.6.1   Timezone bug changes
 - 0.5.6     Example Project runs with Django 1.4
 - 0.5.5     dynamicLink.CKISNT() function added.
 - 0.5.4.1   Canges in setup.py - READM will now alsow be installed. Now if a package
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.