set guestbook StringProperty to be indexed=False
[gae-samples.git] / tasks / templatefilters.py
blob005963a4cb8645d1695b66d9d3c6e76be53d4912
1 #!/usr/bin/env python
3 # Copyright 2008 Google Inc.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 """Django template filters for the Task List application."""
19 __author__ = 'Bret Taylor'
21 import datetime
22 import time
24 from google.appengine.ext.webapp import template
27 def rfc3339date(date):
28 """Formats the given date in RFC 3339 format for feeds."""
29 if not date: return ''
30 date = date + datetime.timedelta(seconds=-time.timezone)
31 if time.daylight:
32 date += datetime.timedelta(seconds=time.altzone)
33 return date.strftime('%Y-%m-%dT%H:%M:%SZ')
36 # Register the filter functions with Django
37 register = template.create_template_register()
38 register.filter(rfc3339date)