more timezone fixes and a fix for locations
This commit is contained in:
parent
6a959c47df
commit
1d7fb7ceee
|
@ -99,7 +99,7 @@ class BookingAdminPanel(Component):
|
||||||
|
|
||||||
add_stylesheet (req, 'hw/css/booking.css')
|
add_stylesheet (req, 'hw/css/booking.css')
|
||||||
add_stylesheet (req, 'hw/css/ui.all.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
|
key = req.path_info
|
||||||
data = {}
|
data = {}
|
||||||
e_id = None
|
e_id = None
|
||||||
|
|
|
@ -19,7 +19,7 @@ class CountDownMacro(WikiMacroBase):
|
||||||
event_datetime = datetime(*tuple(time.strptime("2010, 07, 16", "%Y, %m, %d"))[:3])
|
event_datetime = datetime(*tuple(time.strptime("2010, 07, 16", "%Y, %m, %d"))[:3])
|
||||||
except Exception:
|
except Exception:
|
||||||
return ""
|
return ""
|
||||||
dt = event_datetime - datetime.now()
|
dt = event_datetime - datetime.utcnow()
|
||||||
hours = "%d:%d" % (dt.seconds / 3600, (dt.seconds % 3600) / 60)
|
hours = "%d:%d" % (dt.seconds / 3600, (dt.seconds % 3600) / 60)
|
||||||
days = str(dt.days)
|
days = str(dt.days)
|
||||||
return Markup("""
|
return Markup("""
|
||||||
|
|
|
@ -520,7 +520,7 @@ class Attendee(object):
|
||||||
if not row:
|
if not row:
|
||||||
return None
|
return None
|
||||||
a_id, e_id, ext_id, nick, email, finished, has_paid, time, actual_amount = row
|
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
|
@staticmethod
|
||||||
def fetch_all(env, e_id=0, fetch_options=False, fetch_variations=False):
|
def fetch_all(env, e_id=0, fetch_options=False, fetch_variations=False):
|
||||||
|
@ -538,7 +538,7 @@ class Attendee(object):
|
||||||
res = []
|
res = []
|
||||||
for row in rows:
|
for row in rows:
|
||||||
a_id, e_id, ext_id, nick, email, finished, has_paid, time, actual_amount = row
|
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
|
return res
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -564,7 +564,7 @@ class Attendee(object):
|
||||||
res.append(tmp)
|
res.append(tmp)
|
||||||
tmp = []
|
tmp = []
|
||||||
a_id, e_id, ext_id, nick, email, finished, has_paid, time, name, actual_amount = row
|
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
|
a.name = name
|
||||||
tmp.append(a)
|
tmp.append(a)
|
||||||
oldname = curname
|
oldname = curname
|
||||||
|
@ -752,7 +752,7 @@ class Event(object):
|
||||||
if not row:
|
if not row:
|
||||||
return None
|
return None
|
||||||
e_id, name, description, time_begin, time_end, register_deadline, edit_deadline, payment_deadline = row
|
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
|
@staticmethod
|
||||||
def fetch_all(env, fetch_options=False, only_active=False, attendee_id=None):
|
def fetch_all(env, fetch_options=False, only_active=False, attendee_id=None):
|
||||||
|
@ -765,7 +765,7 @@ class Event(object):
|
||||||
res = []
|
res = []
|
||||||
for row in rows:
|
for row in rows:
|
||||||
e_id, name, description, time_begin, time_end, register_deadline, edit_deadline, payment_deadline = row
|
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
|
return res
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -780,7 +780,7 @@ class Event(object):
|
||||||
if not row:
|
if not row:
|
||||||
return None
|
return None
|
||||||
e_id, name, description, time_begin, time_end, register_deadline, edit_deadline, payment_deadline = row
|
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.commit()
|
||||||
event_account = EventAccount.copy_by_event(env, e_id, event.e_id)
|
event_account = EventAccount.copy_by_event(env, e_id, event.e_id)
|
||||||
|
|
||||||
|
|
|
@ -500,7 +500,7 @@ class UploadComponent(Component):
|
||||||
#rows = parent.queryDb(sqlString)
|
#rows = parent.queryDb(sqlString)
|
||||||
#n = datetime.now(utc)
|
#n = datetime.now(utc)
|
||||||
#for i in rows:
|
#for i in rows:
|
||||||
#d = datetime.fromtimestamp(i[0], utc)
|
#d = datetime.utcfromtimestamp(i[0])
|
||||||
#dt = d - n
|
#dt = d - n
|
||||||
#if dt < timedelta(0,3600):
|
#if dt < timedelta(0,3600):
|
||||||
#parent.queryDb("UPDATE booking_available_option SET active=0 where ao_id in (1,2,3,7);", commit=True)
|
#parent.queryDb("UPDATE booking_available_option SET active=0 where ao_id in (1,2,3,7);", commit=True)
|
||||||
|
|
|
@ -56,7 +56,7 @@ class EventRDate(object):
|
||||||
if not row:
|
if not row:
|
||||||
return None
|
return None
|
||||||
return EventRDate(env, row[0], row[1], bool(row[2]),
|
return EventRDate(env, row[0], row[1], bool(row[2]),
|
||||||
datetime.fromtimestamp(row[3], utc))
|
datetime.utcfromtimestamp(row[3]))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def fetch_by_event(env, e_id):
|
def fetch_by_event(env, e_id):
|
||||||
|
@ -69,7 +69,7 @@ class EventRDate(object):
|
||||||
res = list()
|
res = list()
|
||||||
for row in rows:
|
for row in rows:
|
||||||
res.append(EventRDate(env, row[0], row[1], bool(row[2]),
|
res.append(EventRDate(env, row[0], row[1], bool(row[2]),
|
||||||
datetime.fromtimestamp(row[3], utc)))
|
datetime.utcfromtimestamp(row[3])))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def commit(self):
|
def commit(self):
|
||||||
|
@ -223,7 +223,7 @@ class EventRRule(object):
|
||||||
freq,
|
freq,
|
||||||
interval,
|
interval,
|
||||||
count,
|
count,
|
||||||
until and datetime.fromtimestamp(until, utc) or None,
|
until and datetime.utcfromtimestamp(until) or None,
|
||||||
bysetpos,
|
bysetpos,
|
||||||
bymonth,
|
bymonth,
|
||||||
bymonthday,
|
bymonthday,
|
||||||
|
@ -261,7 +261,7 @@ class EventRRule(object):
|
||||||
byweekday = set((byweekday, ))
|
byweekday = set((byweekday, ))
|
||||||
else:
|
else:
|
||||||
byweekday = set()
|
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
|
return lst, rs
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -349,7 +349,7 @@ class EventRRule(object):
|
||||||
if count!=None:
|
if count!=None:
|
||||||
args["count"] = count
|
args["count"] = count
|
||||||
if until:
|
if until:
|
||||||
args["until"] = datetime.fromtimestamp(until, utc)
|
args["until"] = datetime.utcfromtimestamp(until)
|
||||||
if bysetpos!=None:
|
if bysetpos!=None:
|
||||||
args["bysetpos"] = bysetpos
|
args["bysetpos"] = bysetpos
|
||||||
if bymonth!=None:
|
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
|
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),]
|
s = ["RRULE:FREQ=%s;INTERVAL=%s" % (ttypes[freq], interval),]
|
||||||
if until:
|
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:
|
if count!=None:
|
||||||
s.append("COUNT=%s" % count)
|
s.append("COUNT=%s" % count)
|
||||||
if bysetpos!=None:
|
if bysetpos!=None:
|
||||||
|
@ -587,7 +587,13 @@ class Event(object):
|
||||||
if not row:
|
if not row:
|
||||||
return None
|
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
|
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:
|
if show_next and is_periodic:
|
||||||
rrules = EventRRule.fetch_by_event_rrules(env, e_id, event.time_begin)
|
rrules = EventRRule.fetch_by_event_rrules(env, e_id, event.time_begin)
|
||||||
if rrules:
|
if rrules:
|
||||||
|
@ -627,8 +633,8 @@ class Event(object):
|
||||||
e_id,
|
e_id,
|
||||||
name,
|
name,
|
||||||
author,
|
author,
|
||||||
datetime.fromtimestamp(time_created, utc),
|
datetime.utcfromtimestamp(time_created),
|
||||||
datetime.fromtimestamp(time_modified, utc),
|
datetime.utcfromtimestamp(time_modified),
|
||||||
dt,
|
dt,
|
||||||
dt + delta,
|
dt + delta,
|
||||||
location_id,
|
location_id,
|
||||||
|
@ -652,16 +658,17 @@ class Event(object):
|
||||||
res = []
|
res = []
|
||||||
for row in 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
|
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,
|
event = Event(env, e_id, name, author,
|
||||||
datetime.fromtimestamp(time_created, utc),
|
utc.localize(datetime.utcfromtimestamp(time_created)),
|
||||||
datetime.fromtimestamp(time_modified, utc),
|
utc.localize(datetime.utcfromtimestamp(time_modified)),
|
||||||
time_begin, datetime.fromtimestamp(time_end, utc), location_id, initial_e_id,
|
time_begin,
|
||||||
|
utc.localize(datetime.utcfromtimestamp(time_end)), location_id, initial_e_id,
|
||||||
tags, attendees, is_periodic, wikipage)
|
tags, attendees, is_periodic, wikipage)
|
||||||
if is_periodic:
|
if is_periodic:
|
||||||
rrules = EventRRule.fetch_by_event_rrules(env, e_id, event.time_begin)
|
rrules = EventRRule.fetch_by_event_rrules(env, e_id, event.time_begin)
|
||||||
if rrules:
|
if rrules:
|
||||||
dt = rrules.after(datetime.now(utc), inc=True)
|
dt = rrules.after(datetime.utcnow(), inc=True)
|
||||||
if not dt:
|
if not dt:
|
||||||
res.append(event)
|
res.append(event)
|
||||||
continue
|
continue
|
||||||
|
@ -696,11 +703,12 @@ class Event(object):
|
||||||
res = []
|
res = []
|
||||||
for row in 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
|
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,
|
event = Event(env, e_id, name, author,
|
||||||
datetime.fromtimestamp(time_created, utc),
|
utc.localize(datetime.utcfromtimestamp(time_created)),
|
||||||
datetime.fromtimestamp(time_modified, utc),
|
utc.localize(datetime.utcfromtimestamp(time_modified)),
|
||||||
time_begin, datetime.fromtimestamp(time_end, utc), location_id, initial_e_id,
|
time_begin,
|
||||||
|
utc.localize(datetime.utcfromtimestamp(time_end)), location_id, initial_e_id,
|
||||||
tags, attendees, is_periodic, wikipage)
|
tags, attendees, is_periodic, wikipage)
|
||||||
res.append(event)
|
res.append(event)
|
||||||
if is_periodic:
|
if is_periodic:
|
||||||
|
@ -721,11 +729,12 @@ class Event(object):
|
||||||
res = []
|
res = []
|
||||||
for row in 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
|
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,
|
event = Event(env, e_id, name, author,
|
||||||
datetime.fromtimestamp(time_created, utc),
|
utc.localize(datetime.utcfromtimestamp(time_created)),
|
||||||
datetime.fromtimestamp(time_modified, utc),
|
utc.localize(datetime.utcfromtimestamp(time_modified)),
|
||||||
time_begin, datetime.fromtimestamp(time_end, utc), location_id, initial_e_id,
|
time_begin,
|
||||||
|
utc.localize(datetime.utcfromtimestamp(time_end)), location_id, initial_e_id,
|
||||||
tags, attendees, is_periodic, wikipage)
|
tags, attendees, is_periodic, wikipage)
|
||||||
event.rrules = EventRRule.fetch_by_event_ical(env, int(e_id))
|
event.rrules = EventRRule.fetch_by_event_ical(env, int(e_id))
|
||||||
event.alarms = [
|
event.alarms = [
|
||||||
|
@ -776,19 +785,22 @@ END:VALARM""" % (event.name, event.name)]
|
||||||
if rows:
|
if rows:
|
||||||
for row in 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
|
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(
|
res[time_begin.date()].append(
|
||||||
Event(env, e_id, name, author, datetime.fromtimestamp(time_created, utc),
|
Event(env, e_id, name, author,
|
||||||
datetime.fromtimestamp(time_modified, utc),
|
utc.localize(datetime.utcfromtimestamp(time_created)),
|
||||||
time_begin, datetime.fromtimestamp(time_end, utc), location_id, initial_e_id,
|
utc.localize(datetime.utcfromtimestamp(time_modified)),
|
||||||
|
time_begin,
|
||||||
|
utc.localize(datetime.utcfromtimestamp(time_end)),
|
||||||
|
location_id, initial_e_id,
|
||||||
tags, attendees, False, wikipage))
|
tags, attendees, False, wikipage))
|
||||||
rows = Event._data_fetch_by_period(env, start_dt, end_dt, is_periodic=True, locations=locations)
|
rows = Event._data_fetch_by_period(env, start_dt, end_dt, is_periodic=True, locations=locations)
|
||||||
if not rows:
|
if not rows:
|
||||||
return res
|
return res
|
||||||
for row in 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
|
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 = datetime.utcfromtimestamp(time_begin)
|
||||||
time_end = datetime.fromtimestamp(time_end, utc)
|
time_end = datetime.utcfromtimestamp(time_end)
|
||||||
delta = time_end - time_begin
|
delta = time_end - time_begin
|
||||||
rrules = EventRRule.fetch_by_event_rrules(env, e_id, time_begin)
|
rrules = EventRRule.fetch_by_event_rrules(env, e_id, time_begin)
|
||||||
if not rrules:
|
if not rrules:
|
||||||
|
@ -810,8 +822,8 @@ END:VALARM""" % (event.name, event.name)]
|
||||||
e_id,
|
e_id,
|
||||||
name,
|
name,
|
||||||
author,
|
author,
|
||||||
datetime.fromtimestamp(time_created, utc),
|
datetime.utcfromtimestamp(time_created),
|
||||||
datetime.fromtimestamp(time_modified, utc),
|
datetime.utcfromtimestamp(time_modified),
|
||||||
dt,
|
dt,
|
||||||
dt + delta,
|
dt + delta,
|
||||||
location_id,
|
location_id,
|
||||||
|
@ -834,21 +846,22 @@ END:VALARM""" % (event.name, event.name)]
|
||||||
if rows:
|
if rows:
|
||||||
for row in 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
|
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,
|
res.append(Event(env, e_id, name, author,
|
||||||
datetime.fromtimestamp(time_created, utc),
|
utc.localize(datetime.utcfromtimestamp(time_created)),
|
||||||
datetime.fromtimestamp(time_modified, utc),
|
utc.localize(datetime.utcfromtimestamp(time_modified)),
|
||||||
time_begin, datetime.fromtimestamp(time_end, utc),
|
time_begin,
|
||||||
|
utc.localize(datetime.utcfromtimestamp(time_end)),
|
||||||
location_id, initial_e_id, tags, attendees, False, wikipage))
|
location_id, initial_e_id, tags, attendees, False, wikipage))
|
||||||
rows = Event._data_fetch_by_period(env, start_dt, end_dt, True, locations=locations)
|
rows = Event._data_fetch_by_period(env, start_dt, end_dt, True, locations=locations)
|
||||||
if not rows:
|
if not rows:
|
||||||
return res
|
return res
|
||||||
for row in 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
|
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))
|
||||||
time_end = datetime.fromtimestamp(time_end, utc)
|
time_end = utc.localize(datetime.utcfromtimestamp(time_end))
|
||||||
time_created = datetime.fromtimestamp(time_created, utc)
|
time_created = utc.localize(datetime.utcfromtimestamp(time_created))
|
||||||
time_modified = datetime.fromtimestamp(time_modified, utc)
|
time_modified = utc.localize(datetime.utcfromtimestamp(time_modified))
|
||||||
delta = time_end - time_begin
|
delta = time_end - time_begin
|
||||||
rrules = EventRRule.fetch_by_event_rrules(env, e_id, time_begin)
|
rrules = EventRRule.fetch_by_event_rrules(env, e_id, time_begin)
|
||||||
followups = rrules.between(start_dt, end_dt, inc=True)
|
followups = rrules.between(start_dt, end_dt, inc=True)
|
||||||
|
@ -857,7 +870,7 @@ END:VALARM""" % (event.name, event.name)]
|
||||||
except Exception,e:
|
except Exception,e:
|
||||||
pass
|
pass
|
||||||
for i in followups:
|
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,
|
s = Event(env,
|
||||||
e_id,
|
e_id,
|
||||||
name,
|
name,
|
||||||
|
@ -879,7 +892,7 @@ END:VALARM""" % (event.name, event.name)]
|
||||||
|
|
||||||
def commit(self, conn=None):
|
def commit(self, conn=None):
|
||||||
db = conn and conn or self.env.get_db_cnx()
|
db = conn and conn or self.env.get_db_cnx()
|
||||||
t = datetime.now(utc)
|
t = utc.localize(datetime.utcnow())
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
try:
|
try:
|
||||||
cursor.execute("INSERT INTO events " \
|
cursor.execute("INSERT INTO events " \
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||||
<py:def function="render_event(event, with_day=False)">
|
<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>
|
<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>
|
<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 >${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> -->
|
<!-- <td >${dt.strftime('%H:%M')} ${dt.tzinfo.tzname(None)} - ${dt2.strftime('%H:%M')} ${dt2.tzinfo.tzname(None)}</td> -->
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<input py:if="event.e_id != 0" type="hidden" name="event_id" value="${event.e_id}"/>
|
<input py:if="event.e_id != 0" type="hidden" name="event_id" value="${event.e_id}"/>
|
||||||
<fieldset id="properties">
|
<fieldset id="properties">
|
||||||
<legend>${event.e_id and 'Edit Event' or 'Add Event'}</legend>
|
<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="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')}"/>
|
<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>
|
<input id="time_begin" type="text" size="5" maxlength="5" name="time_begin" value="${mydt.strftime('%H:%M')}"/> ${mydt.tzinfo.tzname(None)}</td>
|
||||||
|
|
|
@ -51,8 +51,8 @@
|
||||||
<body>
|
<body>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<h1>Recurrency Options for event '${event.name}'</h1>
|
<h1>Recurrency Options for event '${event.name}'</h1>
|
||||||
<h2 py:with="dt = event.time_begin.astimezone(selected_tz);
|
<h2 py:with="dt = selected_tz.normalize(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>
|
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="">
|
<form name="recurrence" id='recurrence' uri="" method="post" mime-type="text/plain" action="">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<div class="mybuttons">
|
<div class="mybuttons">
|
||||||
|
|
|
@ -269,7 +269,7 @@ class EventModule(Component):
|
||||||
event = event_realm(id=e_id)
|
event = event_realm(id=e_id)
|
||||||
yield (get_resource_url(self.env, event, req.href),
|
yield (get_resource_url(self.env, event, req.href),
|
||||||
name,
|
name,
|
||||||
datetime.fromtimestamp(ts, utc), author,
|
datetime.utcfromtimestamp(ts), author,
|
||||||
_("Click the link"))
|
_("Click the link"))
|
||||||
|
|
||||||
# IWikiSyntaxProvider methods
|
# IWikiSyntaxProvider methods
|
||||||
|
@ -707,13 +707,6 @@ class EventModule(Component):
|
||||||
req.session.save()
|
req.session.save()
|
||||||
req.redirect(req.href.event("edit", event.e_id))
|
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,
|
return "event_edit.html", {"event" : event,
|
||||||
"session_tzname" : session_tzname,
|
"session_tzname" : session_tzname,
|
||||||
|
@ -759,9 +752,6 @@ class EventModule(Component):
|
||||||
end = end.replace(hour=23, minute=0, second=59, microsecond=999)
|
end = end.replace(hour=23, minute=0, second=59, microsecond=999)
|
||||||
table, headers = self.__get_upcoming_table(n, end)
|
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
|
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):
|
def __display_events_by_day(self, req):
|
||||||
|
@ -998,8 +988,8 @@ class EventModule(Component):
|
||||||
"FROM events WHERE e_id=%s", (num,))
|
"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))
|
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:
|
for name, time_begin, time_end in cursor:
|
||||||
time_begin = utc.localize(datetime.fromtimestamp(time_begin, utc)).astimezone(selected_tz)
|
time_begin = utc.localize(datetime.utcfromtimestamp(time_begin)).astimezone(selected_tz)
|
||||||
time_end = utc.localize(datetime.datetime.fromtimestamp(time_end, utc)).astimezone(selected_tz)
|
time_end = utc.localize(datetime.datetime.utcfromtimestamp(time_end)).astimezone(selected_tz)
|
||||||
title = "%s (%s - %s %s)" % (name,
|
title = "%s (%s - %s %s)" % (name,
|
||||||
time_begin.strftime('%d.%m.%Y %H:%M'),
|
time_begin.strftime('%d.%m.%Y %H:%M'),
|
||||||
time_end.strftime('%d.%m.%Y %H:%M'), time_begin.tzinfo.tzname(None))
|
time_end.strftime('%d.%m.%Y %H:%M'), time_begin.tzinfo.tzname(None))
|
||||||
|
|
|
@ -129,7 +129,7 @@ class LocationModule(Component):
|
||||||
|
|
||||||
if kind == "delete":
|
if kind == "delete":
|
||||||
req.perm.require("LOCATION_DELETE")
|
req.perm.require("LOCATION_DELETE")
|
||||||
locations[location_id].delete()
|
ItemLocation.delete(self.env, location_id)
|
||||||
deleted.append(location_id)
|
deleted.append(location_id)
|
||||||
del locations[location_id]
|
del locations[location_id]
|
||||||
elif kind == "name":
|
elif kind == "name":
|
||||||
|
|
|
@ -41,7 +41,7 @@ class RendezVousVote(object):
|
||||||
if not row:
|
if not row:
|
||||||
return None
|
return None
|
||||||
vote_id, date_id, user, email, time_created, time_begin, time_end = row
|
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
|
@staticmethod
|
||||||
def exists(env, date_id, user, time_begin, time_end):
|
def exists(env, date_id, user, time_begin, time_end):
|
||||||
|
@ -70,7 +70,7 @@ class RendezVousVote(object):
|
||||||
res = []
|
res = []
|
||||||
for row in cursor:
|
for row in cursor:
|
||||||
vote_id, date_id, user, email, time_created, time_begin, time_end = row
|
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
|
return res
|
||||||
|
|
||||||
def commit(self):
|
def commit(self):
|
||||||
|
@ -157,7 +157,7 @@ class RendezVousDate(object):
|
||||||
if not row:
|
if not row:
|
||||||
return None
|
return None
|
||||||
date_id, rendezvous_id, author, email, time_created, time_begin, time_end, elected = row
|
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
|
@staticmethod
|
||||||
def exists(env, ts_begin, ts_end):
|
def exists(env, ts_begin, ts_end):
|
||||||
|
@ -183,7 +183,7 @@ class RendezVousDate(object):
|
||||||
res = []
|
res = []
|
||||||
for row in rows:
|
for row in rows:
|
||||||
date_id, rendezvous_id, author, email, time_created, time_begin, time_end, elected= row
|
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
|
return res
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -195,7 +195,7 @@ class RendezVousDate(object):
|
||||||
res = []
|
res = []
|
||||||
for row in rows:
|
for row in rows:
|
||||||
date_id, rendezvous_id, author, email, time_created, time_begin, time_end, elected = row
|
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
|
return res
|
||||||
|
|
||||||
def get_vote_count(self, authname=None):
|
def get_vote_count(self, authname=None):
|
||||||
|
@ -295,7 +295,7 @@ class RendezVousComment(object):
|
||||||
if not row:
|
if not row:
|
||||||
return None
|
return None
|
||||||
comment_id, rendezvous_id, author, comment, time_created = row
|
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
|
@staticmethod
|
||||||
def fetch_by_rendezvous(env, rendezvous_id):
|
def fetch_by_rendezvous(env, rendezvous_id):
|
||||||
|
@ -308,7 +308,7 @@ class RendezVousComment(object):
|
||||||
res = []
|
res = []
|
||||||
for row in rows:
|
for row in rows:
|
||||||
comment_id, rendezvous_id, author, comment, time_created = row
|
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
|
return res
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -320,7 +320,7 @@ class RendezVousComment(object):
|
||||||
res = []
|
res = []
|
||||||
for row in rows:
|
for row in rows:
|
||||||
comment_id, rendezvous_id, author, comment, time_created = row
|
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
|
return res
|
||||||
|
|
||||||
def commit(self):
|
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
|
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,
|
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
|
@staticmethod
|
||||||
def _fetch_some(env, fetch_dates, query, *args):
|
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
|
rendezvous_id, name, author, email, description, time_created, schedule_deadline, min_votes, type_id, status, location_id, is_date_fixed, tags = row
|
||||||
res.append(
|
res.append(
|
||||||
RendezVous(env, fetch_dates, rendezvous_id, name, author,
|
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))
|
min_votes, type_id, status, location_id, is_date_fixed, tags))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue