more timezone fixes and a fix for locations

This commit is contained in:
Stefan Kögl 2012-04-25 07:30:22 +02:00
parent 6a959c47df
commit 1d7fb7ceee
11 changed files with 80 additions and 77 deletions

View File

@ -99,7 +99,7 @@ class BookingAdminPanel(Component):
add_stylesheet (req, 'hw/css/booking.css')
add_stylesheet (req, 'hw/css/ui.all.css')
add_script (req, 'hw/script/jquery-ui-1.6.custom.min.js')
add_script (req, 'hw/scripts/jquery-ui-1.6.custom.min.js')
key = req.path_info
data = {}
e_id = None

View File

@ -19,7 +19,7 @@ class CountDownMacro(WikiMacroBase):
event_datetime = datetime(*tuple(time.strptime("2010, 07, 16", "%Y, %m, %d"))[:3])
except Exception:
return ""
dt = event_datetime - datetime.now()
dt = event_datetime - datetime.utcnow()
hours = "%d:%d" % (dt.seconds / 3600, (dt.seconds % 3600) / 60)
days = str(dt.days)
return Markup("""

View File

@ -520,7 +520,7 @@ class Attendee(object):
if not row:
return None
a_id, e_id, ext_id, nick, email, finished, has_paid, time, actual_amount = row
return Attendee(env, a_id, e_id, ext_id, nick, email, finished, has_paid, datetime.fromtimestamp(time, utc), actual_amount, fetch_options=fetch_options, fetch_variations=fetch_variations)
return Attendee(env, a_id, e_id, ext_id, nick, email, finished, has_paid, datetime.utcfromtimestamp(time), actual_amount, fetch_options=fetch_options, fetch_variations=fetch_variations)
@staticmethod
def fetch_all(env, e_id=0, fetch_options=False, fetch_variations=False):
@ -538,7 +538,7 @@ class Attendee(object):
res = []
for row in rows:
a_id, e_id, ext_id, nick, email, finished, has_paid, time, actual_amount = row
res.append(Attendee(env, a_id, e_id, ext_id, nick, email, finished, has_paid, datetime.fromtimestamp(time, utc), actual_amount, fetch_options=fetch_options, fetch_variations=fetch_variations))
res.append(Attendee(env, a_id, e_id, ext_id, nick, email, finished, has_paid, datetime.utcfromtimestamp(time), actual_amount, fetch_options=fetch_options, fetch_variations=fetch_variations))
return res
@staticmethod
@ -564,7 +564,7 @@ class Attendee(object):
res.append(tmp)
tmp = []
a_id, e_id, ext_id, nick, email, finished, has_paid, time, name, actual_amount = row
a = Attendee(env, a_id, e_id, ext_id, nick, email, finished, has_paid, datetime.fromtimestamp(time, utc), actual_amount, fetch_options)
a = Attendee(env, a_id, e_id, ext_id, nick, email, finished, has_paid, datetime.utcfromtimestamp(time), actual_amount, fetch_options)
a.name = name
tmp.append(a)
oldname = curname
@ -752,7 +752,7 @@ class Event(object):
if not row:
return None
e_id, name, description, time_begin, time_end, register_deadline, edit_deadline, payment_deadline = row
return Event(env, e_id, name, description, datetime.fromtimestamp(time_begin, utc), datetime.fromtimestamp(time_end, utc), datetime.fromtimestamp(register_deadline, utc), datetime.fromtimestamp(edit_deadline, utc), datetime.fromtimestamp(payment_deadline, utc), fetch_options=fetch_options, only_active=only_active, attendee_id=attendee_id)
return Event(env, e_id, name, description, datetime.utcfromtimestamp(time_begin), datetime.utcfromtimestamp(time_end), datetime.utcfromtimestamp(register_deadline), datetime.utcfromtimestamp(edit_deadline), datetime.utcfromtimestamp(payment_deadline), fetch_options=fetch_options, only_active=only_active, attendee_id=attendee_id)
@staticmethod
def fetch_all(env, fetch_options=False, only_active=False, attendee_id=None):
@ -765,7 +765,7 @@ class Event(object):
res = []
for row in rows:
e_id, name, description, time_begin, time_end, register_deadline, edit_deadline, payment_deadline = row
res.append(Event(env, e_id, name, description, datetime.fromtimestamp(time_begin, utc), datetime.fromtimestamp(time_end, utc), datetime.fromtimestamp(register_deadline, utc), datetime.fromtimestamp(edit_deadline, utc), datetime.fromtimestamp(payment_deadline, utc), fetch_options=fetch_options, only_active=only_active, attendee_id=attendee_id))
res.append(Event(env, e_id, name, description, datetime.utcfromtimestamp(time_begin), datetime.utcfromtimestamp(time_end), datetime.utcfromtimestamp(register_deadline), datetime.utcfromtimestamp(edit_deadline), datetime.utcfromtimestamp(payment_deadline), fetch_options=fetch_options, only_active=only_active, attendee_id=attendee_id))
return res
@staticmethod
@ -780,7 +780,7 @@ class Event(object):
if not row:
return None
e_id, name, description, time_begin, time_end, register_deadline, edit_deadline, payment_deadline = row
event = Event(env, e_id, "Kopie von " + name, description, datetime.fromtimestamp(time_begin, utc), datetime.fromtimestamp(time_end, utc), datetime.fromtimestamp(register_deadline, utc), datetime.fromtimestamp(edit_deadline, utc), datetime.fromtimestamp(payment_deadline, utc))
event = Event(env, e_id, "Kopie von " + name, description, datetime.utcfromtimestamp(time_begin), datetime.utcfromtimestamp(time_end), datetime.utcfromtimestamp(register_deadline), datetime.utcfromtimestamp(edit_deadline), datetime.utcfromtimestamp(payment_deadline))
event.commit()
event_account = EventAccount.copy_by_event(env, e_id, event.e_id)

View File

@ -500,7 +500,7 @@ class UploadComponent(Component):
#rows = parent.queryDb(sqlString)
#n = datetime.now(utc)
#for i in rows:
#d = datetime.fromtimestamp(i[0], utc)
#d = datetime.utcfromtimestamp(i[0])
#dt = d - n
#if dt < timedelta(0,3600):
#parent.queryDb("UPDATE booking_available_option SET active=0 where ao_id in (1,2,3,7);", commit=True)

View File

@ -56,7 +56,7 @@ class EventRDate(object):
if not row:
return None
return EventRDate(env, row[0], row[1], bool(row[2]),
datetime.fromtimestamp(row[3], utc))
datetime.utcfromtimestamp(row[3]))
@staticmethod
def fetch_by_event(env, e_id):
@ -69,7 +69,7 @@ class EventRDate(object):
res = list()
for row in rows:
res.append(EventRDate(env, row[0], row[1], bool(row[2]),
datetime.fromtimestamp(row[3], utc)))
datetime.utcfromtimestamp(row[3])))
return res
def commit(self):
@ -223,7 +223,7 @@ class EventRRule(object):
freq,
interval,
count,
until and datetime.fromtimestamp(until, utc) or None,
until and datetime.utcfromtimestamp(until) or None,
bysetpos,
bymonth,
bymonthday,
@ -261,7 +261,7 @@ class EventRRule(object):
byweekday = set((byweekday, ))
else:
byweekday = set()
lst.append(EventRRule(env, err_id, e_id, exclude, freq, interval, count, until and datetime.fromtimestamp(until, utc) or None, bysetpos, bymonth, bymonthday, byyearday, byweeknumber, byweekday, byweekdayocc))
lst.append(EventRRule(env, err_id, e_id, exclude, freq, interval, count, until and datetime.utcfromtimestamp(until) or None, bysetpos, bymonth, bymonthday, byyearday, byweeknumber, byweekday, byweekdayocc))
return lst, rs
@staticmethod
@ -349,7 +349,7 @@ class EventRRule(object):
if count!=None:
args["count"] = count
if until:
args["until"] = datetime.fromtimestamp(until, utc)
args["until"] = datetime.utcfromtimestamp(until)
if bysetpos!=None:
args["bysetpos"] = bysetpos
if bymonth!=None:
@ -387,7 +387,7 @@ class EventRRule(object):
err_id, e_id, exclude, freq, interval, count, until, bysetpos, bymonth, bymonthday, byyearday, byweeknumber, byweekday, byweekdayocc = row
s = ["RRULE:FREQ=%s;INTERVAL=%s" % (ttypes[freq], interval),]
if until:
s.append("UNTIL=%s" % datetime.fromtimestamp(until, utc).strftime("%Y%m%dT%H%M%SZ"))
s.append("UNTIL=%s" % datetime.utcfromtimestamp(until).strftime("%Y%m%dT%H%M%SZ"))
if count!=None:
s.append("COUNT=%s" % count)
if bysetpos!=None:
@ -587,7 +587,13 @@ class Event(object):
if not row:
return None
e_id, name, author, time_created, time_modified, time_begin, time_end, location_id, initial_e_id, tags, attendees, is_periodic, wikipage = row
event = Event(env, e_id, name, author, datetime.fromtimestamp(time_created, utc), datetime.fromtimestamp(time_modified, utc), datetime.fromtimestamp(time_begin, utc), datetime.fromtimestamp(time_end, utc), location_id, initial_e_id, tags, attendees, bool(is_periodic), wikipage)
event = Event(env, e_id, name, author,
utc.localize(datetime.utcfromtimestamp(time_created)),
utc.localize(datetime.utcfromtimestamp(time_modified)),
utc.localize(datetime.utcfromtimestamp(time_begin)),
utc.localize(datetime.utcfromtimestamp(time_end)),
location_id, initial_e_id, tags, attendees, bool(is_periodic), wikipage)
if show_next and is_periodic:
rrules = EventRRule.fetch_by_event_rrules(env, e_id, event.time_begin)
if rrules:
@ -627,8 +633,8 @@ class Event(object):
e_id,
name,
author,
datetime.fromtimestamp(time_created, utc),
datetime.fromtimestamp(time_modified, utc),
datetime.utcfromtimestamp(time_created),
datetime.utcfromtimestamp(time_modified),
dt,
dt + delta,
location_id,
@ -652,16 +658,17 @@ class Event(object):
res = []
for row in rows:
e_id, name, author, time_created, time_modified, time_begin, time_end, location_id, initial_e_id, tags, attendees, is_periodic, wikipage = row
time_begin = datetime.fromtimestamp(time_begin, utc)
time_begin = utc.localize(datetime.utcfromtimestamp(time_begin))
event = Event(env, e_id, name, author,
datetime.fromtimestamp(time_created, utc),
datetime.fromtimestamp(time_modified, utc),
time_begin, datetime.fromtimestamp(time_end, utc), location_id, initial_e_id,
utc.localize(datetime.utcfromtimestamp(time_created)),
utc.localize(datetime.utcfromtimestamp(time_modified)),
time_begin,
utc.localize(datetime.utcfromtimestamp(time_end)), location_id, initial_e_id,
tags, attendees, is_periodic, wikipage)
if is_periodic:
rrules = EventRRule.fetch_by_event_rrules(env, e_id, event.time_begin)
if rrules:
dt = rrules.after(datetime.now(utc), inc=True)
dt = rrules.after(datetime.utcnow(), inc=True)
if not dt:
res.append(event)
continue
@ -696,11 +703,12 @@ class Event(object):
res = []
for row in rows:
e_id, name, author, time_created, time_modified, time_begin, time_end, location_id, initial_e_id, tags, attendees, is_periodic, wikipage = row
time_begin = datetime.fromtimestamp(time_begin, utc)
time_begin = utc.localize(datetime.utcfromtimestamp(time_begin))
event = Event(env, e_id, name, author,
datetime.fromtimestamp(time_created, utc),
datetime.fromtimestamp(time_modified, utc),
time_begin, datetime.fromtimestamp(time_end, utc), location_id, initial_e_id,
utc.localize(datetime.utcfromtimestamp(time_created)),
utc.localize(datetime.utcfromtimestamp(time_modified)),
time_begin,
utc.localize(datetime.utcfromtimestamp(time_end)), location_id, initial_e_id,
tags, attendees, is_periodic, wikipage)
res.append(event)
if is_periodic:
@ -721,11 +729,12 @@ class Event(object):
res = []
for row in rows:
e_id, name, author, time_created, time_modified, time_begin, time_end, location_id, initial_e_id, tags, attendees, is_periodic, wikipage = row
time_begin = datetime.fromtimestamp(time_begin, utc)
time_begin = utc.localize(datetime.utcfromtimestamp(time_begin))
event = Event(env, e_id, name, author,
datetime.fromtimestamp(time_created, utc),
datetime.fromtimestamp(time_modified, utc),
time_begin, datetime.fromtimestamp(time_end, utc), location_id, initial_e_id,
utc.localize(datetime.utcfromtimestamp(time_created)),
utc.localize(datetime.utcfromtimestamp(time_modified)),
time_begin,
utc.localize(datetime.utcfromtimestamp(time_end)), location_id, initial_e_id,
tags, attendees, is_periodic, wikipage)
event.rrules = EventRRule.fetch_by_event_ical(env, int(e_id))
event.alarms = [
@ -776,19 +785,22 @@ END:VALARM""" % (event.name, event.name)]
if rows:
for row in rows:
e_id, name, author, time_created, time_modified, time_begin, time_end, location_id, initial_e_id, tags, attendees, is_periodic, wikipage = row
time_begin = datetime.fromtimestamp(time_begin, utc)
time_begin = utc.localize(datetime.utcfromtimestamp(time_begin))
res[time_begin.date()].append(
Event(env, e_id, name, author, datetime.fromtimestamp(time_created, utc),
datetime.fromtimestamp(time_modified, utc),
time_begin, datetime.fromtimestamp(time_end, utc), location_id, initial_e_id,
Event(env, e_id, name, author,
utc.localize(datetime.utcfromtimestamp(time_created)),
utc.localize(datetime.utcfromtimestamp(time_modified)),
time_begin,
utc.localize(datetime.utcfromtimestamp(time_end)),
location_id, initial_e_id,
tags, attendees, False, wikipage))
rows = Event._data_fetch_by_period(env, start_dt, end_dt, is_periodic=True, locations=locations)
if not rows:
return res
for row in rows:
e_id, name, author, time_created, time_modified, time_begin, time_end, location_id, initial_e_id, tags, attendees, is_periodic, wikipage = row
time_begin = datetime.fromtimestamp(time_begin, utc)
time_end = datetime.fromtimestamp(time_end, utc)
time_begin = datetime.utcfromtimestamp(time_begin)
time_end = datetime.utcfromtimestamp(time_end)
delta = time_end - time_begin
rrules = EventRRule.fetch_by_event_rrules(env, e_id, time_begin)
if not rrules:
@ -810,8 +822,8 @@ END:VALARM""" % (event.name, event.name)]
e_id,
name,
author,
datetime.fromtimestamp(time_created, utc),
datetime.fromtimestamp(time_modified, utc),
datetime.utcfromtimestamp(time_created),
datetime.utcfromtimestamp(time_modified),
dt,
dt + delta,
location_id,
@ -834,21 +846,22 @@ END:VALARM""" % (event.name, event.name)]
if rows:
for row in rows:
e_id, name, author, time_created, time_modified, time_begin, time_end, location_id, initial_e_id, tags, attendees, is_periodic, wikipage = row
time_begin = datetime.fromtimestamp(time_begin, utc)
time_begin = utc.localize(datetime.utcfromtimestamp(time_begin))
res.append(Event(env, e_id, name, author,
datetime.fromtimestamp(time_created, utc),
datetime.fromtimestamp(time_modified, utc),
time_begin, datetime.fromtimestamp(time_end, utc),
utc.localize(datetime.utcfromtimestamp(time_created)),
utc.localize(datetime.utcfromtimestamp(time_modified)),
time_begin,
utc.localize(datetime.utcfromtimestamp(time_end)),
location_id, initial_e_id, tags, attendees, False, wikipage))
rows = Event._data_fetch_by_period(env, start_dt, end_dt, True, locations=locations)
if not rows:
return res
for row in rows:
e_id, name, author, time_created, time_modified, time_begin, time_end, location_id, initial_e_id, tags, attendees, is_periodic, wikipage = row
time_begin = datetime.fromtimestamp(time_begin, utc)
time_end = datetime.fromtimestamp(time_end, utc)
time_created = datetime.fromtimestamp(time_created, utc)
time_modified = datetime.fromtimestamp(time_modified, utc)
time_begin = utc.localize(datetime.utcfromtimestamp(time_begin))
time_end = utc.localize(datetime.utcfromtimestamp(time_end))
time_created = utc.localize(datetime.utcfromtimestamp(time_created))
time_modified = utc.localize(datetime.utcfromtimestamp(time_modified))
delta = time_end - time_begin
rrules = EventRRule.fetch_by_event_rrules(env, e_id, time_begin)
followups = rrules.between(start_dt, end_dt, inc=True)
@ -857,7 +870,7 @@ END:VALARM""" % (event.name, event.name)]
except Exception,e:
pass
for i in followups:
dt = datetime(i.year, i.month, i.day, time_begin.hour, time_begin.minute, tzinfo=utc)
dt = utc.localize(datetime(i.year, i.month, i.day, time_begin.hour, time_begin.minute))
s = Event(env,
e_id,
name,
@ -879,7 +892,7 @@ END:VALARM""" % (event.name, event.name)]
def commit(self, conn=None):
db = conn and conn or self.env.get_db_cnx()
t = datetime.now(utc)
t = utc.localize(datetime.utcnow())
cursor = db.cursor()
try:
cursor.execute("INSERT INTO events " \

View File

@ -3,7 +3,7 @@
xmlns:xi="http://www.w3.org/2001/XInclude">
<py:def function="render_event(event, with_day=False)">
<h2>${event.name}<span py:if="'EVENTS_MODIFY' in perm" class="edit"><a style="color:#f00;" href="${href.event('edit', event.e_id)}">edit</a></span></h2>
<table py:with="dt = event.time_begin.astimezone(selected_tz);dt2 = event.time_end.astimezone(selected_tz)">
<table py:with="dt = selected_tz.normalize(event.time_begin.astimezone(selected_tz));dt2 = selected_tz.normalize(event.time_end.astimezone(selected_tz))">
<tr>
<td >${with_day==True and dt.strftime('%Y.%m.%d') or None} ${dt.strftime('%H:%M')} - ${with_day==True and dt2.strftime('%Y.%m.%d') or None} ${dt2.strftime('%H:%M')}</td>
<!-- <td >${dt.strftime('%H:%M')} ${dt.tzinfo.tzname(None)} - ${dt2.strftime('%H:%M')} ${dt2.tzinfo.tzname(None)}</td> -->

View File

@ -25,7 +25,7 @@
<input py:if="event.e_id != 0" type="hidden" name="event_id" value="${event.e_id}"/>
<fieldset id="properties">
<legend>${event.e_id and 'Edit Event' or 'Add Event'}</legend>
<table class="event-wizard" py:with="mydt = event.time_begin.astimezone(selected_tz);dt2 = event.time_end.astimezone(selected_tz)">
<table class="event-wizard" py:with="mydt = selected_tz.normalize(event.time_begin.astimezone(selected_tz));dt2 = selected_tz.normalize(event.time_end.astimezone(selected_tz))">
<tr><th><label for="name">Title:</label></th><td><input id="name" type="text" size="60" maxlength="200" name="name" value="${event.name}"/></td></tr>
<tr><th><label for="time_begin">Date begin:</label></th><td><input id="date_begin" type="text" size="10" maxlength="10" name="date_begin" value="${mydt.strftime('%d.%m.%Y')}"/>
<input id="time_begin" type="text" size="5" maxlength="5" name="time_begin" value="${mydt.strftime('%H:%M')}"/> ${mydt.tzinfo.tzname(None)}</td>

View File

@ -51,8 +51,8 @@
<body>
<div id="content">
<h1>Recurrency Options for event '${event.name}'</h1>
<h2 py:with="dt = event.time_begin.astimezone(selected_tz);
dt2 = event.time_end.astimezone(selected_tz)">${dt.strftime("%A, %d.%m.%Y %H:%M")} ${dt.tzinfo.tzname(None)} - ${dt2.strftime("%A, %d.%m.%Y %H:%M")} ${dt2.tzinfo.tzname(None)}</h2>
<h2 py:with="dt = selected_tz.normalize(event.time_begin.astimezone(selected_tz));
dt2 = selected_tz.normalize(event.time_end.astimezone(selected_tz))">${dt.strftime("%A, %d.%m.%Y %H:%M")} ${dt.tzinfo.tzname(None)} - ${dt2.strftime("%A, %d.%m.%Y %H:%M")} ${dt2.tzinfo.tzname(None)}</h2>
<form name="recurrence" id='recurrence' uri="" method="post" mime-type="text/plain" action="">
<fieldset>
<div class="mybuttons">

View File

@ -269,7 +269,7 @@ class EventModule(Component):
event = event_realm(id=e_id)
yield (get_resource_url(self.env, event, req.href),
name,
datetime.fromtimestamp(ts, utc), author,
datetime.utcfromtimestamp(ts), author,
_("Click the link"))
# IWikiSyntaxProvider methods
@ -707,13 +707,6 @@ class EventModule(Component):
req.session.save()
req.redirect(req.href.event("edit", event.e_id))
print
print "selected_tz", type(selected_tz)
print "session_tzname", type(session_tzname)
print "vars", selected_tz.__dict__
print "vars", vars(event.time_begin.tzinfo)
print "time_begin", event.time_begin.astimezone(selected_tz)
print "time_end", event.time_end.astimezone(selected_tz)
return "event_edit.html", {"event" : event,
"session_tzname" : session_tzname,
@ -759,9 +752,6 @@ class EventModule(Component):
end = end.replace(hour=23, minute=0, second=59, microsecond=999)
table, headers = self.__get_upcoming_table(n, end)
#ical_file = file("/home/hotshelf/icalout.ics")
#ical = parse_ical(self.env, ical_file)
return "events.html", {"table" : table, "headers" : headers, "session_tzname" : session_tzname, "format" : "%a, %d.%m.%Y", "selected_tz" : selected_tz, "title" : _("Upcoming Events for"), "title2" : "%s - %s" % (n.strftime('%A, %d.%m.%Y %H:%M'), end.strftime('%A, %d.%m.%Y %H:%M')), "now" : n, "end" : end}, None
def __display_events_by_day(self, req):
@ -998,8 +988,8 @@ class EventModule(Component):
"FROM events WHERE e_id=%s", (num,))
session_tzname, selected_tz = get_tz(formatter.req.session.get("tz", self.env.config.get("trac", "default_timezone") or None))
for name, time_begin, time_end in cursor:
time_begin = utc.localize(datetime.fromtimestamp(time_begin, utc)).astimezone(selected_tz)
time_end = utc.localize(datetime.datetime.fromtimestamp(time_end, utc)).astimezone(selected_tz)
time_begin = utc.localize(datetime.utcfromtimestamp(time_begin)).astimezone(selected_tz)
time_end = utc.localize(datetime.datetime.utcfromtimestamp(time_end)).astimezone(selected_tz)
title = "%s (%s - %s %s)" % (name,
time_begin.strftime('%d.%m.%Y %H:%M'),
time_end.strftime('%d.%m.%Y %H:%M'), time_begin.tzinfo.tzname(None))

View File

@ -129,7 +129,7 @@ class LocationModule(Component):
if kind == "delete":
req.perm.require("LOCATION_DELETE")
locations[location_id].delete()
ItemLocation.delete(self.env, location_id)
deleted.append(location_id)
del locations[location_id]
elif kind == "name":

View File

@ -41,7 +41,7 @@ class RendezVousVote(object):
if not row:
return None
vote_id, date_id, user, email, time_created, time_begin, time_end = row
return RendezVousVote(env, vote_id, date_id, user, email, datetime.fromtimestamp(time_created, utc), datetime.fromtimestamp(time_begin, utc), datetime.fromtimestamp(time_end, utc))
return RendezVousVote(env, vote_id, date_id, user, email, datetime.utcfromtimestamp(time_created), datetime.utcfromtimestamp(time_begin), datetime.utcfromtimestamp(time_end))
@staticmethod
def exists(env, date_id, user, time_begin, time_end):
@ -70,7 +70,7 @@ class RendezVousVote(object):
res = []
for row in cursor:
vote_id, date_id, user, email, time_created, time_begin, time_end = row
res.append(RendezVousVote(env, vote_id, date_id, user, email, datetime.fromtimestamp(time_created, utc), datetime.fromtimestamp(time_begin, utc), datetime.fromtimestamp(time_end, utc)))
res.append(RendezVousVote(env, vote_id, date_id, user, email, datetime.utcfromtimestamp(time_created), datetime.utcfromtimestamp(time_begin), datetime.utcfromtimestamp(time_end)))
return res
def commit(self):
@ -157,7 +157,7 @@ class RendezVousDate(object):
if not row:
return None
date_id, rendezvous_id, author, email, time_created, time_begin, time_end, elected = row
return RendezVousDate(env, date_id, rendezvous_id, author, email, datetime.fromtimestamp(time_created, utc), datetime.fromtimestamp(time_begin, utc), datetime.fromtimestamp(time_end, utc), elected, fetch_votes)
return RendezVousDate(env, date_id, rendezvous_id, author, email, datetime.utcfromtimestamp(time_created), datetime.utcfromtimestamp(time_begin), datetime.utcfromtimestamp(time_end), elected, fetch_votes)
@staticmethod
def exists(env, ts_begin, ts_end):
@ -183,7 +183,7 @@ class RendezVousDate(object):
res = []
for row in rows:
date_id, rendezvous_id, author, email, time_created, time_begin, time_end, elected= row
res.append(RendezVousDate(env, date_id, rendezvous_id, author, email, datetime.fromtimestamp(time_created, utc), datetime.fromtimestamp(time_begin, utc), datetime.fromtimestamp(time_end, utc), elected, fetch_votes))
res.append(RendezVousDate(env, date_id, rendezvous_id, author, email, datetime.utcfromtimestamp(time_created), datetime.utcfromtimestamp(time_begin), datetime.utcfromtimestamp(time_end), elected, fetch_votes))
return res
@staticmethod
@ -195,7 +195,7 @@ class RendezVousDate(object):
res = []
for row in rows:
date_id, rendezvous_id, author, email, time_created, time_begin, time_end, elected = row
res.append(RendezVousDate(env, date_id, rendezvous_id, author, email, datetime.fromtimestamp(time_created, utc), datetime.fromtimestamp(time_begin, utc), datetime.fromtimestamp(time_end, utc), elected, fetch_votes))
res.append(RendezVousDate(env, date_id, rendezvous_id, author, email, datetime.utcfromtimestamp(time_created), datetime.utcfromtimestamp(time_begin), datetime.utcfromtimestamp(time_end), elected, fetch_votes))
return res
def get_vote_count(self, authname=None):
@ -295,7 +295,7 @@ class RendezVousComment(object):
if not row:
return None
comment_id, rendezvous_id, author, comment, time_created = row
return RendezVousComment(env, comment_id, rendezvous_id, author, comment, datetime.fromtimestamp(time_created, utc))
return RendezVousComment(env, comment_id, rendezvous_id, author, comment, datetime.utcfromtimestamp(time_created))
@staticmethod
def fetch_by_rendezvous(env, rendezvous_id):
@ -308,7 +308,7 @@ class RendezVousComment(object):
res = []
for row in rows:
comment_id, rendezvous_id, author, comment, time_created = row
res.append(RendezVousComment(env, comment_id, rendezvous_id, author, comment, datetime.fromtimestamp(time_created, utc)))
res.append(RendezVousComment(env, comment_id, rendezvous_id, author, comment, datetime.utcfromtimestamp(time_created)))
return res
@staticmethod
@ -320,7 +320,7 @@ class RendezVousComment(object):
res = []
for row in rows:
comment_id, rendezvous_id, author, comment, time_created = row
res.append(RendezVousComment(env, comment_id, rendezvous_id, author, comment, datetime.fromtimestamp(time_created, utc)))
res.append(RendezVousComment(env, comment_id, rendezvous_id, author, comment, datetime.utcfromtimestamp(time_created)))
return res
def commit(self):
@ -551,7 +551,7 @@ class RendezVous(object):
rendezvous_id, name, author, email, description, time_created, schedule_deadline, min_votes, type_id, status, location_id, is_date_fixed, tags = row
return RendezVous(env, fetch_dates, rendezvous_id, name, author, email, description,
datetime.fromtimestamp(time_created, utc), datetime.fromtimestamp(schedule_deadline, utc), min_votes, type_id, status, location_id, is_date_fixed, tags)
datetime.utcfromtimestamp(time_created), datetime.utcfromtimestamp(schedule_deadline), min_votes, type_id, status, location_id, is_date_fixed, tags)
@staticmethod
def _fetch_some(env, fetch_dates, query, *args):
@ -569,7 +569,7 @@ class RendezVous(object):
rendezvous_id, name, author, email, description, time_created, schedule_deadline, min_votes, type_id, status, location_id, is_date_fixed, tags = row
res.append(
RendezVous(env, fetch_dates, rendezvous_id, name, author,
email, description, datetime.fromtimestamp(time_created, utc), datetime.fromtimestamp(schedule_deadline, utc),
email, description, datetime.utcfromtimestamp(time_created), datetime.utcfromtimestamp(schedule_deadline),
min_votes, type_id, status, location_id, is_date_fixed, tags))
return res