summaryrefslogtreecommitdiff
path: root/src/meetingtools/extensions
diff options
context:
space:
mode:
authorLeif Johansson <leifj@sunet.se>2012-10-04 15:39:08 +0200
committerLeif Johansson <leifj@sunet.se>2012-10-04 15:39:08 +0200
commit2bdad0ae7a3a6e4ec5116becd39910388b679ed2 (patch)
tree5afdfba0a93c1af50d53bdc245d57cc4053e109a /src/meetingtools/extensions
parent873e7823970352d591deee5f67f47c5436ee0e84 (diff)
restructure
Diffstat (limited to 'src/meetingtools/extensions')
-rw-r--r--src/meetingtools/extensions/__init__.py0
-rw-r--r--src/meetingtools/extensions/templatetags/__init__.py0
-rw-r--r--src/meetingtools/extensions/templatetags/datehumanize.py36
-rw-r--r--src/meetingtools/extensions/templatetags/roomurl.py19
4 files changed, 0 insertions, 55 deletions
diff --git a/src/meetingtools/extensions/__init__.py b/src/meetingtools/extensions/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/src/meetingtools/extensions/__init__.py
+++ /dev/null
diff --git a/src/meetingtools/extensions/templatetags/__init__.py b/src/meetingtools/extensions/templatetags/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/src/meetingtools/extensions/templatetags/__init__.py
+++ /dev/null
diff --git a/src/meetingtools/extensions/templatetags/datehumanize.py b/src/meetingtools/extensions/templatetags/datehumanize.py
deleted file mode 100644
index 9b75cae..0000000
--- a/src/meetingtools/extensions/templatetags/datehumanize.py
+++ /dev/null
@@ -1,36 +0,0 @@
-from django import template
-from django.template import defaultfilters
-
-register = template.Library()
-
-MOMENT = 120 # duration in seconds within which the time difference
- # will be rendered as 'a moment ago'
-
-def datehumanize(value):
- """
- Finds the difference between the datetime value given and now()
- and returns appropriate humanize form
- """
-
- from datetime import datetime
-
- if isinstance(value, datetime):
- value = value.replace(tzinfo=None)
- delta = datetime.now() - value
- if delta.days > 6:
- return value.strftime("on %b %d") # May 15
- if delta.days > 1:
- return value.strftime("on %A") # Wednesday
- elif delta.days == 1:
- return 'yesterday' # yesterday
- elif delta.seconds > 3600:
- return str(delta.seconds / 3600 ) + ' hours ago' # 3 hours ago
- elif delta.seconds > MOMENT:
- return str(delta.seconds/60) + ' minutes ago' # 29 minutes ago
- else:
- return 'a moment ago' # a moment ago
- return defaultfilters.date(value)
- else:
- return str(value)
-datehumanize.is_safe = True
-register.filter(datehumanize) \ No newline at end of file
diff --git a/src/meetingtools/extensions/templatetags/roomurl.py b/src/meetingtools/extensions/templatetags/roomurl.py
deleted file mode 100644
index e5abe57..0000000
--- a/src/meetingtools/extensions/templatetags/roomurl.py
+++ /dev/null
@@ -1,19 +0,0 @@
-from django import template
-
-register = template.Library()
-
-MOMENT = 120 # duration in seconds within which the time difference
- # will be rendered as 'a moment ago'
-
-def roomurl(room):
- """
- Display the public 'go' URL of a meetingroom
- """
- path = room.id
- if room.urlpath:
- path = room.urlpath
-
- return "/go/%s" % path
-
-roomurl.is_safe = True
-register.filter(roomurl) \ No newline at end of file