timezone fixed

This commit is contained in:
Stefan Kögl 2012-05-30 16:11:14 +02:00
parent a2af77f9f3
commit e626679786
7 changed files with 56 additions and 52 deletions

View File

@ -17,6 +17,7 @@ from tracbooking.model import *
from tracbooking.report import create_report from tracbooking.report import create_report
from tracbooking.utils import validate_id, time_parse, date_parse, get_tz, get_option_count, validate_email from tracbooking.utils import validate_id, time_parse, date_parse, get_tz, get_option_count, validate_email
from tracbooking.web_ui import UserUploadComponent from tracbooking.web_ui import UserUploadComponent
from ctdotools.utils import datetime_parse
def get_actions(myactions): def get_actions(myactions):
actions = [] actions = []
@ -104,6 +105,8 @@ class BookingAdminPanel(Component):
data = {} data = {}
e_id = None e_id = None
session_tzname, selected_tz = get_tz(req.session.get('tz', self.config.get("trac", "default_timezone") or None))
m = match(r'/admin/booking/events/(\d+)$', key) m = match(r'/admin/booking/events/(\d+)$', key)
if m: if m:
e_id = int(m.group(1)) e_id = int(m.group(1))
@ -113,6 +116,10 @@ class BookingAdminPanel(Component):
event = Event(self.env, 0, "", "", datetime.now(utc), datetime.now(utc)) event = Event(self.env, 0, "", "", datetime.now(utc), datetime.now(utc))
account = EventAccount(self.env, 0, 0, "", "", "", "", "", "") account = EventAccount(self.env, 0, 0, "", "", "", "", "", "")
assert account
assert event
if req.method == "POST": if req.method == "POST":
if req.args.get("add") and \ if req.args.get("add") and \
req.args.has_key("name") and \ req.args.has_key("name") and \
@ -122,26 +129,15 @@ class BookingAdminPanel(Component):
req.args.has_key("time_end"): req.args.has_key("time_end"):
name = req.args.get("name") name = req.args.get("name")
date_begin = date_parse(req.args.get("date_begin")) dt_begin = datetime_parse("%s %s" % (req.args["date_begin"], req.args["time_begin"]), selected_tz)
time_begin = time_parse(req.args.get("time_begin"))
dt_begin = datetime.combine(date_begin, time_begin)
dt_begin = dt_begin.replace(tzinfo=utc)
date_end = date_parse(req.args.get("date_end")) dt_end = datetime_parse("%s %s" % (req.args["date_end"], req.args["time_end"]), selected_tz)
time_end = time_parse(req.args.get("time_end"))
dt_end = datetime.combine(date_end, time_end)
dt_end = dt_end.replace(tzinfo=utc)
date_begin = date_parse(req.args.get("edit_deadline_date")) edit_deadline = datetime_parse("%s %s" % (req.args["edit_deadline_date"], req.args["edit_deadline_time"]), selected_tz)
time_begin = time_parse(req.args.get("edit_deadline_time"))
edit_deadline = datetime.combine(date_begin, time_begin)
edit_deadline = edit_deadline.replace(tzinfo=utc)
payment_deadline_date = date_parse(req.args.get("payment_deadline_date")) payment_deadline = datetime_parse("%s %s" % (req.args["payment_deadline_date"], req.args["payment_deadline_time"]), selected_tz)
payment_deadline_time = time_parse(req.args.get("payment_deadline_time"))
payment_deadline = datetime.combine(payment_deadline_date, payment_deadline_time)
payment_deadline = payment_deadline.replace(tzinfo=utc)
print req.args["date_begin"], req.args["time_begin"], dt_begin, dt_end
account_owner = req.args.get("account_owner") account_owner = req.args.get("account_owner")
account_no = req.args.get("account_no") account_no = req.args.get("account_no")
bank_name = req.args.get("bank_name") bank_name = req.args.get("bank_name")
@ -195,6 +191,7 @@ class BookingAdminPanel(Component):
data["event"] = event data["event"] = event
data["event_account"] = account data["event_account"] = account
data["events"] = Event.fetch_all(self.env) data["events"] = Event.fetch_all(self.env)
data["selected_tz"] = selected_tz
return "admin_events.html", data return "admin_events.html", data
def _render_options(self, req, cat, page, bookingtype): def _render_options(self, req, cat, page, bookingtype):

View File

@ -716,7 +716,7 @@ class EventAccount(object):
return self.ea_id != 0 return self.ea_id != 0
class Event(object): class Event(object):
def __init__(self, env, e_id, name, description, time_begin, time_end, register_deadline=datetime.now(utc), edit_deadline=datetime.now(utc), payment_deadline=datetime.now(utc), fetch_options=False, only_active=False, attendee_id=None): def __init__(self, env, e_id, name, description, time_begin, time_end, register_deadline=utc.localize(datetime.utcnow()), edit_deadline=utc.localize(datetime.utcnow()), payment_deadline=utc.localize(datetime.utcnow()), fetch_options=False, only_active=False, attendee_id=None):
self.env = env self.env = env
self.e_id = e_id self.e_id = e_id
self.name = name self.name = name
@ -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.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 Event(env, e_id, name, description, utc.localize(datetime.utcfromtimestamp(time_begin)), utc.localize(datetime.utcfromtimestamp(time_end)), utc.localize(datetime.utcfromtimestamp(register_deadline)), utc.localize(datetime.utcfromtimestamp(edit_deadline)), utc.localize(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.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)) res.append(Event(env, e_id, name, description, utc.localize(datetime.utcfromtimestamp(time_begin)), utc.localize(datetime.utcfromtimestamp(time_end)), utc.localize(datetime.utcfromtimestamp(register_deadline)), utc.localize(datetime.utcfromtimestamp(edit_deadline)), utc.localize(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.utcfromtimestamp(time_begin), datetime.utcfromtimestamp(time_end), datetime.utcfromtimestamp(register_deadline), datetime.utcfromtimestamp(edit_deadline), datetime.utcfromtimestamp(payment_deadline)) event = Event(env, e_id, "Kopie von " + name, description, utc.localize(datetime.utcfromtimestamp(time_begin)), utc.localize(datetime.utcfromtimestamp(time_end)), utc.localize(datetime.utcfromtimestamp(register_deadline)), utc.localize(datetime.utcfromtimestamp(edit_deadline)), utc.localize(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)
@ -809,16 +809,14 @@ class Event(object):
def commit(self): def commit(self):
db = self.env.get_db_cnx() db = self.env.get_db_cnx()
cursor = db.cursor() cursor = db.cursor()
a,b,c,d,e = to_timestamp(self.time_begin), to_timestamp(self.time_end), to_timestamp(self.register_deadline), to_timestamp(self.edit_deadline), to_timestamp(self.payment_deadline)
cursor.execute("INSERT INTO booking_event " \ cursor.execute("INSERT INTO booking_event " \
"(name, description, time_begin, time_end, register_deadline, edit_deadline, payment_deadline) " \ "(name, description, time_begin, time_end, register_deadline, edit_deadline, payment_deadline) " \
"VALUES(%s, %s, %s, %s, %s, %s, %s)", ( "VALUES(%s, %s, %s, %s, %s, %s, %s)", (
self.name, self.name,
self.description, self.description, a,b,c,d,e,
to_timestamp(self.time_begin), ))
to_timestamp(self.time_end),
to_timestamp(self.register_deadline),
to_timestamp(self.edit_deadline),
to_timestamp(self.payment_deadline)))
db.commit() db.commit()
self.e_id = db.get_last_id(cursor, 'booking_event') self.e_id = db.get_last_id(cursor, 'booking_event')
@ -836,6 +834,7 @@ class Event(object):
def update(self): def update(self):
db = self.env.get_db_cnx() db = self.env.get_db_cnx()
cursor = db.cursor() cursor = db.cursor()
a,b,c,d,e = to_timestamp(self.time_begin), to_timestamp(self.time_end), to_timestamp(self.register_deadline), to_timestamp(self.edit_deadline), to_timestamp(self.payment_deadline)
cursor.execute("""UPDATE booking_event cursor.execute("""UPDATE booking_event
SET name=%s, SET name=%s,
description=%s, description=%s,
@ -847,11 +846,7 @@ class Event(object):
WHERE e_id=%s;""", ( WHERE e_id=%s;""", (
self.name, self.name,
self.description, self.description,
to_timestamp(self.time_begin), a,b,c,d,e,
to_timestamp(self.time_end),
to_timestamp(self.register_deadline),
to_timestamp(self.edit_deadline),
to_timestamp(self.payment_deadline),
self.e_id)) self.e_id))
db.commit() db.commit()

View File

@ -29,8 +29,8 @@
<tr py:for="idx, event in enumerate(events)" <tr py:for="idx, event in enumerate(events)"
class="${idx % 2 and 'odd' or 'even'}"> class="${idx % 2 and 'odd' or 'even'}">
<td><a href="${req.href.admin('booking', 'events', event.e_id)}">${event.name}</a></td> <td><a href="${req.href.admin('booking', 'events', event.e_id)}">${event.name}</a></td>
<td><a href="${req.href.admin('booking', 'events', event.e_id)}">${event.time_begin}</a></td> <td><a href="${req.href.admin('booking', 'events', event.e_id)}">${event.time_begin.astimezone(selected_tz)}</a></td>
<td><a href="${req.href.admin('booking', 'events', event.e_id)}">${event.time_end}</a></td> <td><a href="${req.href.admin('booking', 'events', event.e_id)}">${event.time_end.astimezone(selected_tz)}</a></td>
<td><input type="checkbox" name="rsel" value="${event.e_id}"/></td> <td><input type="checkbox" name="rsel" value="${event.e_id}"/></td>
<td><input type="radio" name="copy" value="${event.e_id}"/></td> <td><input type="radio" name="copy" value="${event.e_id}"/></td>
<td><input type="radio" name="finish" value="${event.e_id}"/></td> <td><input type="radio" name="finish" value="${event.e_id}"/></td>
@ -54,22 +54,22 @@
<tr class="field"> <tr class="field">
<th><label for="gp_date_begin">Datum Begin:</label></th> <th><label for="gp_date_begin">Datum Begin:</label></th>
<td><input id="gp_date_begin" type="text" name="date_begin" size="10" maxlength="10" value="${event and event.time_begin.strftime('%d.%m.%Y') or None}"/> <td><input id="gp_date_begin" type="text" name="date_begin" size="10" maxlength="10" value="${event and event.time_begin.strftime('%d.%m.%Y') or None}"/>
<input id="gp_time_begin" type="text" name="time_begin" size="5" maxlength="5" value="${event and event.time_begin.strftime('%H:%M') or None}"/></td> <input id="gp_time_begin" type="text" name="time_begin" size="5" maxlength="5" value="${event and event.time_begin.astimezone(selected_tz).strftime('%H:%M') or None}"/></td>
</tr> </tr>
<tr class="field"> <tr class="field">
<th><label for="gp_date_end">Datum Ende:</label></th> <th><label for="gp_date_end">Datum Ende:</label></th>
<td><input id="gp_date_end" type="text" name="date_end" size="10" maxlength="10" value="${event and event.time_end.strftime('%d.%m.%Y') or None}"/> <td><input id="gp_date_end" type="text" name="date_end" size="10" maxlength="10" value="${event and event.time_end.strftime('%d.%m.%Y') or None}"/>
<input type="text" name="time_end" size="5" maxlength="5" value="${event and event.time_end.strftime('%H:%M') or None}"/></td> <input type="text" name="time_end" size="5" maxlength="5" value="${event and event.time_end.astimezone(selected_tz).strftime('%H:%M') or None}"/></td>
</tr> </tr>
<tr class="field"> <tr class="field">
<th><label for="gp_edit_deadline">Edit Deadline:</label></th> <th><label for="gp_edit_deadline">Edit Deadline:</label></th>
<td><input id="gp_edit_deadline" type="text" size="10" maxlength="10" name="edit_deadline_date" value="${event and event.edit_deadline.strftime('%d.%m.%Y') or None}"/> <td><input id="gp_edit_deadline" type="text" size="10" maxlength="10" name="edit_deadline_date" value="${event and event.edit_deadline.strftime('%d.%m.%Y') or None}"/>
<input type="text" name="edit_deadline_time" size="5" maxlength="5" value="${event and event.edit_deadline.strftime('%H:%M') or None}"/></td> <input type="text" name="edit_deadline_time" size="5" maxlength="5" value="${event and event.edit_deadline.astimezone(selected_tz).strftime('%H:%M') or None}"/></td>
</tr> </tr>
<tr class="field"> <tr class="field">
<th><label for="gp_payment_deadline">Bezahl Deadline:</label></th> <th><label for="gp_payment_deadline">Bezahl Deadline:</label></th>
<td><input id="gp_payment_deadline" type="text" size="10" maxlength="10" name="payment_deadline_date" value="${event and event.payment_deadline.strftime('%d.%m.%Y') or None}"/> <td><input id="gp_payment_deadline" type="text" size="10" maxlength="10" name="payment_deadline_date" value="${event and event.payment_deadline.strftime('%d.%m.%Y') or None}"/>
<input type="text" name="payment_deadline_time" size="5" maxlength="5" value="${event and event.payment_deadline.strftime('%H:%M') or None}"/></td> <input type="text" name="payment_deadline_time" size="5" maxlength="5" value="${event and event.payment_deadline.astimezone(selected_tz).strftime('%H:%M') or None}"/></td>
</tr> </tr>
<tr class="field"> <tr class="field">
<th><label for="gp_desc">Beschreibung:</label></th> <th><label for="gp_desc">Beschreibung:</label></th>

View File

@ -32,12 +32,12 @@
</tr>--> </tr>-->
<tr> <tr>
<th id="edit-deadline">Bestellungen können verändert werden bis zum:</th> <th id="edit-deadline">Bestellungen können verändert werden bis zum:</th>
<td headers="edit-deadline" id="edit-deadline-data">${event.edit_deadline.strftime('%d.%m.%Y %H:%M')} Uhr.</td> <td headers="edit-deadline" id="edit-deadline-data">${event.edit_deadline.astimezone(selected_tz).strftime('%d.%m.%Y %H:%M')} Uhr.</td>
</tr> </tr>
<!--</py:if> --> <!--</py:if> -->
<tr> <tr>
<th id="payment-deadline">Geld bitte auf unten angebenes Konto einzahlen bis zum:</th> <th id="payment-deadline">Geld bitte auf unten angebenes Konto einzahlen bis zum:</th>
<td headers="payment-deadline" id="payment-deadline-data">${event.payment_deadline.strftime('%d.%m.%Y %H:%M')} Uhr.</td> <td headers="payment-deadline" id="payment-deadline-data">${event.payment_deadline.astimezone(selected_tz).strftime('%d.%m.%Y %H:%M')} Uhr.</td>
</tr> </tr>
<tr> <tr>
<td colspan="2">Der Liefertermin wird per Mail bekannt gegeben, sofern Du eine Mailaddresse angegeben hast.</td> <td colspan="2">Der Liefertermin wird per Mail bekannt gegeben, sofern Du eine Mailaddresse angegeben hast.</td>

View File

@ -87,7 +87,7 @@ class BookingComponent(Component):
if self.env.config.get("booking", "autoregister"): if self.env.config.get("booking", "autoregister"):
event = Event.fetch_one(self.env, e_id) event = Event.fetch_one(self.env, e_id)
nick = req.authname nick = req.authname
rd = Attendee(self.env, 0, event.e_id, 0, nick, None, 0, 0, datetime.now(utc), 0) rd = Attendee(self.env, 0, event.e_id, 0, nick, None, 0, 0, utc.localize(datetime.utcnow()), 0)
rd.commit() rd.commit()
return self._process_status(req, rd) return self._process_status(req, rd)
return self._process_register(req) return self._process_register(req)
@ -113,7 +113,7 @@ class BookingComponent(Component):
def _process_register(self, req): def _process_register(self, req):
'''process add,change,delete actions for dates''' '''process add,change,delete actions for dates'''
data = {"now" : datetime.now(utc)} data = {"now" : utc.localize(datetime.utcnow())}
#a = Attendee.fetch_one(self.env, nick=req.authname) #a = Attendee.fetch_one(self.env, nick=req.authname)
#if a: #if a:
#req.redirect(req.href.booking("status")) #req.redirect(req.href.booking("status"))
@ -130,7 +130,7 @@ class BookingComponent(Component):
if email and not validate_email(email): if email and not validate_email(email):
add_warning(req, u"email ungültig") add_warning(req, u"email ungültig")
return "booking_register.html", data, None return "booking_register.html", data, None
rd = Attendee(self.env, 0, event.e_id, 0, nick, email, 0, 0, datetime.now(utc), 0) rd = Attendee(self.env, 0, event.e_id, 0, nick, email, 0, 0, utc.localize(datetime.utcnow()), 0)
rd.commit() rd.commit()
req.redirect(req.href.booking(e_id)) req.redirect(req.href.booking(e_id))
return 'booking_register.html', data, None return 'booking_register.html', data, None
@ -150,6 +150,7 @@ class BookingComponent(Component):
req.session.save() req.session.save()
#attendee.finished = False #attendee.finished = False
#attendee.update() #attendee.update()
session_tzname, selected_tz = get_tz(req.session.get("tz", self.env.config.get("trac", "default_timezone") or None))
if req.method == "POST": if req.method == "POST":
if not attendee.finished: if not attendee.finished:
failure = False failure = False
@ -269,7 +270,8 @@ class BookingComponent(Component):
get_option_count(attendee, i) get_option_count(attendee, i)
data = {"event" : event, data = {"event" : event,
"attendee" : attendee, "attendee" : attendee,
"now" : datetime.now(utc), "selected_tz" : selected_tz,
"now" : utc.localize(datetime.utcnow()),
"account_data" : EventAccount.fetch_by_event(self.env, event.e_id)} "account_data" : EventAccount.fetch_by_event(self.env, event.e_id)}
return 'booking_status.html', data, None return 'booking_status.html', data, None
@ -498,7 +500,7 @@ class UploadComponent(Component):
#def process_scheduled_task(self, parent): #def process_scheduled_task(self, parent):
#sqlString = "SELECT edit_deadline FROM booking_event;" #sqlString = "SELECT edit_deadline FROM booking_event;"
#rows = parent.queryDb(sqlString) #rows = parent.queryDb(sqlString)
#n = datetime.now(utc) #n = utc.localize(datetime.utcnow())
#for i in rows: #for i in rows:
#d = datetime.utcfromtimestamp(i[0]) #d = datetime.utcfromtimestamp(i[0])
#dt = d - n #dt = d - n

View File

@ -344,7 +344,8 @@ class EventRRule(object):
@staticmethod @staticmethod
def to_rrule(row, time_begin): def to_rrule(row, time_begin):
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
args = {"dtstart" : time_begin, "interval" : interval} args = {"dtstart" : time_begin, "interval" : interval}
if count!=None: if count!=None:
args["count"] = count args["count"] = count
@ -384,7 +385,9 @@ class EventRRule(object):
@staticmethod @staticmethod
def to_ical(row): def to_ical(row):
ttypes = ("YEARLY","MONTHLY","WEEKLY","DAILY") ttypes = ("YEARLY","MONTHLY","WEEKLY","DAILY")
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.utcfromtimestamp(until).strftime("%Y%m%dT%H%M%SZ")) s.append("UNTIL=%s" % datetime.utcfromtimestamp(until).strftime("%Y%m%dT%H%M%SZ"))
@ -436,8 +439,11 @@ class EventRRule(object):
#data.append((d, o)) #data.append((d, o))
data = map(None, map(int, byweekday), map(int, byweekdayocc)) data = map(None, map(int, byweekday), map(int, byweekdayocc))
s.append("BYDAY=%s" % ",".join( s.append("BYDAY=%s" % ",".join(
map(lambda x:"%s%s" % (x[1] != None and EventRRule.selectkeys[x[1]] or '', EventRRule.day_enum[x[0]]), map(lambda x:"%s%s" % (x[1] != None and
data))) EventRRule.selectkeys[x[1]] or
'', EventRRule.day_enum[x[0]]), data)
)
)
return ";".join(s) return ";".join(s)
def explain(self): def explain(self):
@ -461,7 +467,8 @@ class EventRRule(object):
res = list() res = list()
for x0, x1 in tmp: for x0, x1 in tmp:
if x1: if x1:
res.append("%s %s" % (unicode(self.weekday_names[x1]), unicode(self.day_names[x0]))) res.append("%s %s" % (unicode(self.weekday_names[x1]),
unicode(self.day_names[x0])))
else: else:
res.append(unicode(self.day_names[x0])) res.append(unicode(self.day_names[x0]))
#tmp = ", ".join(res) #tmp = ", ".join(res)
@ -501,7 +508,9 @@ class EventRRule(object):
"self.byweekdayocc %s" % self.byweekdayocc)) "self.byweekdayocc %s" % self.byweekdayocc))
class Event(object): class Event(object):
def __init__(self, env, e_id, name, author, time_created, time_modified, time_begin, time_end, location_id, initial_e_id=None, tags=None, attendees=None, is_periodic=False, wikipage=None): def __init__(self, env, e_id, name, author, time_created, time_modified,
time_begin, time_end, location_id, initial_e_id=None,
tags=None, attendees=None, is_periodic=False, wikipage=None):
"""maps an relation of the 'events' table to a python object """maps an relation of the 'events' table to a python object
@type e_id: int @type e_id: int
@ -544,6 +553,7 @@ class Event(object):
@type wikipage: unicode @type wikipage: unicode
@param wikipage: the link as plaintext without 'wiki' prefix, e.g: "events/wikipage-of-that-event", or "foo" @param wikipage: the link as plaintext without 'wiki' prefix, e.g: "events/wikipage-of-that-event", or "foo"
""" """
self.env = env self.env = env
self.e_id = e_id self.e_id = e_id
self.name = unicode(name) self.name = unicode(name)