本文整理汇总了Python中zkpylons.model.location.Location.find_by_id方法的典型用法代码示例。如果您正苦于以下问题:Python Location.find_by_id方法的具体用法?Python Location.find_by_id怎么用?Python Location.find_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zkpylons.model.location.Location
的用法示例。
在下文中一共展示了Location.find_by_id方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: edit
# 需要导入模块: from zkpylons.model.location import Location [as 别名]
# 或者: from zkpylons.model.location.Location import find_by_id [as 别名]
def edit(self, id):
c.location = Location.find_by_id(id)
defaults = h.object_to_defaults(c.location, 'location')
form = render('/location/edit.mako')
return htmlfill.render(form, defaults)
示例2: _delete
# 需要导入模块: from zkpylons.model.location import Location [as 别名]
# 或者: from zkpylons.model.location.Location import find_by_id [as 别名]
def _delete(self, id):
c.location = Location.find_by_id(id)
meta.Session.delete(c.location)
meta.Session.commit()
h.flash("Location has been deleted.")
redirect_to('index')
示例3: delete
# 需要导入模块: from zkpylons.model.location import Location [as 别名]
# 或者: from zkpylons.model.location.Location import find_by_id [as 别名]
def delete(self, id):
"""Delete the location
GET will return a form asking for approval.
POST requests will delete the item.
"""
c.location = Location.find_by_id(id)
return render('/location/confirm_delete.mako')
示例4: _edit
# 需要导入模块: from zkpylons.model.location import Location [as 别名]
# 或者: from zkpylons.model.location.Location import find_by_id [as 别名]
def _edit(self, id):
location = Location.find_by_id(id)
for key in self.form_result['location']:
setattr(location, key, self.form_result['location'][key])
# update the objects with the validated form data
meta.Session.commit()
h.flash("The Location has been updated successfully.")
redirect_to(action='index', id=None)
示例5: ical
# 需要导入模块: from zkpylons.model.location import Location [as 别名]
# 或者: from zkpylons.model.location.Location import find_by_id [as 别名]
def ical(self, id):
c.schedule_collection = Location.find_by_id(id).schedule
ical = vobject.iCalendar()
for schedule in c.schedule_collection:
if not schedule.time_slot.heading:
event = ical.add('vevent')
event.add('uid').value = str(schedule.id) + '@' + Config.get('event_host')
# Created
tz = timezone(Config.get('time_zone'))
event.add('created').value = schedule.creation_timestamp.replace(tzinfo=tz)
# Last Modified
event.add('dtstamp').value = schedule.last_modification_timestamp.replace(tzinfo=tz)
event.add('last-modified').value = schedule.last_modification_timestamp.replace(tzinfo=tz)
# Start and End Time
event.add('dtstart').value = schedule.time_slot.start_time.replace(tzinfo=tz)
event.add('dtend').value = schedule.time_slot.end_time.replace(tzinfo=tz)
# Title and Author (need to add Author here)
event.add('summary').value = schedule.event.computed_title() + '. ' + h.list_to_string(schedule.event.computed_speakers())
# Abstract, if we have one
event.add('description').value = schedule.event.computed_abstract()
# Add a URL
if schedule.event.proposal:
event.add('url').value = h.url_for(qualified=True, controller='schedule', action='view_talk', id=schedule.event.proposal.id)
elif not (schedule.event.url is None or schedule.event.url == ''):
if schedule.event.url.startswith('https://') or schedule.event.url.startswith('http://'):
event.add('url').value = h.url_for(str(schedule.event.url))
else:
event.add('url').value = h.url_for(str(schedule.event.url), qualified=True)
concurrent_schedules = schedule.event.schedule_by_time_slot(schedule.time_slot)
for concurrent_schedule in concurrent_schedules:
if concurrent_schedule != schedule:
if concurrent_schedule in c.schedule_collection:
c.schedule_collection.remove(concurrent_schedule)
locations = [concurrent_schedule.location.display_name for concurrent_schedule in concurrent_schedules]
event.add('location').value = h.list_to_string(locations)
response.charset = 'utf8'
response.headers['content-type'] = 'text/calendar; charset=utf8'
response.headers.add('content-transfer-encoding', 'binary')
response.headers.add('Pragma', 'cache')
response.headers.add('Cache-Control', 'max-age=3600,public')
return ical.serialize()
示例6: view
# 需要导入模块: from zkpylons.model.location import Location [as 别名]
# 或者: from zkpylons.model.location.Location import find_by_id [as 别名]
def view(self, id):
c.location = Location.find_by_id(id)
return render('/location/view.mako')