• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python event.Event类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中model.event.Event的典型用法代码示例。如果您正苦于以下问题:Python Event类的具体用法?Python Event怎么用?Python Event使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Event类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_show_event

   def test_show_event(self):
      event = Event()
      event.put()

      path = "/events/" + str(event.key().id())

      response = self.testapp.get(path)
      self.assertEqual(200, response.status_int)
开发者ID:JoaoVasques,项目名称:AEISTMobile-Backoffice,代码行数:8,代码来源:test_event.py


示例2: get

 def get(self, id):
     event = Event.mc_get(id)
     if event.id and event.zsite_id == self.current_user_id:
         if event.cid == EVENT_STATE_INIT:
             return self.redirect('/po/event/%s'%id)
         return self.render(event=event)
     self.redirect('/po/event')
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:7,代码来源:po_event.py


示例3: get

    def get(self, id):
        user_id = self.current_user_id
        po = self._po(user_id, id)

        if po is None:
            return
        po_zsite_id = po.zsite_id

        if po_zsite_id and po_zsite_id != self.zsite_id:
            return self.redirect(
                '%s/po/edit/%s'%(link(po_zsite_id), id)
            )
        cid = po.cid
        if cid == CID_EVENT_FEEDBACK:
            self.event = Event.mc_get(po.rid)

        if cid == CID_NOTE:
            template = 'ctrl/zsite/po/note.htm'
        else:
            template = 'ctrl/zsite/po/po.htm'
        self.render(
            template,
            po=po,
            cid=po.cid,
            pic_list=pic_list_edit(user_id, id)
        )
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:26,代码来源:po.py


示例4: _event

 def _event(self, id):
     o = Event.mc_get(id)
     if o and o.state > EVENT_STATE_RM:
         if o.zsite_id == self.zsite_id:
             return o
         return self.redirect(link(o.zsite_id)+self.request.path)
     return self.redirect('/')
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:7,代码来源:event.py


示例5: query_by_code

def query_by_code(code):
    try:
        event = Event.get(Event.code == code)
        result = shortcuts.model_to_dict(event)
    except peewee.DoesNotExist:
        result = {}
    return result
开发者ID:zy4290,项目名称:qilaihi.club,代码行数:7,代码来源:event.py


示例6: post

 def post(self, id):
     current_user_id = self.current_user_id
     event = Event.mc_get(id)
     txt = self.get_argument('txt', '')
     if event and event.can_admin(current_user_id) and txt:
         po_event_notice_new(current_user_id, id, txt)
     self.finish('{}')
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:7,代码来源:event.py


示例7: get

        def get(self, *args):
            event = Event.get_by_id(long(args[0]))

            if event:
                event.delete()

            self.redirect('/events')
开发者ID:AEIST,项目名称:old-AEISTMobile-Backoffice,代码行数:7,代码来源:EventController.py


示例8: test_edit_event

	def test_edit_event(self):
		event = Event(name="Event", description="Description1", location="Lisbon", date="2013-04-28", time="13:00", linkFacebook="http://www.facebook.com")
		event.put()
		ident = event.key().id()
		params = {
			'name': "New event",
			'description': "Description2",
			'location': "Porto",
			'date': "2013-04-28",
			'time': "22:00",
			'facebook_link': "http://www.google.com"
		}

		path = "/events/edit/" + str(event.key().id())
		response = self.testapp.post(path, params)

		event = Event.get_by_id(ident)

		self.assertEqual(1, Event.all().count())
		self.assertEqual(302, response.status_int)
		self.assertEqual("New event", event.name)
		self.assertEqual("Description2", event.description)
		self.assertEqual("Porto", event.location)
		self.assertEqual("2013-04-28", event.date)
		self.assertEqual("22:00", event.time)
		self.assertEqual("http://www.google.com", event.linkFacebook)
开发者ID:AEIST,项目名称:old-AEISTMobile-Backoffice,代码行数:26,代码来源:test_event.py


示例9: post

 def post(self):
     args = event_parser.parse_args()
     newEvent = Event(
         tag = args.tag,
         name = args.name,
         description = args.description,
         venue = Venue.query.get_by_name(args.venue["name"]),
         time = args.time,
         date = args.date,
         image = args.image,
         gests = map(lambda gest: gest["username"], args.gests),
         requirement = map(lambda req: Requirement(name=req["name"],quantity=req["quantity"]), args.requirement),
         capacity = args.capacity,
         visibility = Visibility.query.get(args.visibility),
         owner = currentUser()
     )
     newEvent.save()
     log.info("Crea un Evento con: {'tag':'%s'}" % newEvent.tag)
     return newEvent, 201
开发者ID:arq1nnySu,项目名称:enjoy-events-back,代码行数:19,代码来源:eventService.py


示例10: test_new_event

   def test_new_event(self):
      params = {
         'name': "Event",
         'description': "Description",
         'local': "Lisbon",
         'date': "2013-04-27",
         'time': "21:00",
         'facebook_link': "http://www.facebook.com"
      }

      response = self.testapp.post('/events/new', params)
      self.assertEqual(1, Event.all().count())
开发者ID:JoaoVasques,项目名称:AEISTMobile-Backoffice,代码行数:12,代码来源:test_event.py


示例11: event_weekly

def event_weekly(begin):
    mail = weekly_mail_pop()
    event_list = Event.where(state=EVENT_STATE_BEGIN).where('id>%s', begin)
    if event_list:
        last_id = event_list[-1].id
        event_li = event_city_list(event_list)
        for i in ormiter(Zsite, 'cid=%s and state>=%s' % (CID_USER, ZSITE_STATE_ACTIVE)):
            event_weekly_mail(i, event_li, mail)
            #print i.id
            #sys.stdout.flush()
            time.sleep(0.01)
        return last_id
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:12,代码来源:event_weekly.py


示例12: test_new_event

	def test_new_event(self):
		params = {
			'name': "Event",
			'description': "Descrição",
			'location': "Lisbon",
			'date': "2013-04-27",
			'time': "21:00",
			'facebook_link': "http://www.facebook.com"
		}

		self.testapp.post('/events/new', params)

		results = Event.all().fetch(1, 0)
		event = results[0]

		self.assertEqual(1, Event.all().count())
		self.assertEqual("Event", event.name)
		self.assertEqual(u"Descrição", event.description)
		self.assertEqual("Lisbon", event.location)
		self.assertEqual("2013-04-27", event.date)
		self.assertEqual("21:00", event.time)
		self.assertEqual("http://www.facebook.com", event.linkFacebook)
开发者ID:AEIST,项目名称:old-AEISTMobile-Backoffice,代码行数:22,代码来源:test_event.py


示例13: get

    def get(self, id):
        po = self.po(id)
        if po is None:
            return

        zsite_id = self.zsite_id
        user_id = self.current_user_id
        can_admin = po.can_admin(user_id)
        can_view = po.can_view(user_id)

        if can_view and user_id:
            self.mark()

        cid = po.cid
        if cid == CID_PRODUCT:
            return self.redirect(po.user.link)

        if cid == CID_EVENT:
            zsite_tag_id = tag_name = None
            event = Event.mc_get(id)
            if event.state <= EVENT_STATE_TO_REVIEW:
                tag_link = '/event/to_review'
            else:
                tag_link = '/event'
        elif cid == CID_EVENT_NOTICE:
            zsite_tag_id = tag_name = None
            tag_link = '/%s'%po.rid
        else:
            zsite_tag_id, tag_name = zsite_tag_id_tag_name_by_po_id(po.user_id, id)
            if zsite_tag_id:
                tag_link = '/tag/%s' % zsite_tag_id
            else:
                tag_link = '/po/cid/%s'%cid

        prev_id, next_id = po_prev_next(
            po, zsite_tag_id
        )

        buzz_reply_hide(user_id,po.id)

        return self.render(
            self.template,
            po=po,
            can_admin=can_admin,
            can_view=can_view,
            zsite_tag_id=zsite_tag_id,
            prev_id=prev_id,
            next_id=next_id,
            tag_name=tag_name,
            tag_link=tag_link
        )
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:51,代码来源:po_view.py


示例14: test_delete_event

   def test_delete_event(self):
      event = Event()
      event.put()
      self.assertEqual(1, Event.all().count())

      path = "/events/delete/" + str(event.key().id())

      response = self.testapp.get(path)
      self.assertEqual(0, Event.all().count())
开发者ID:JoaoVasques,项目名称:AEISTMobile-Backoffice,代码行数:9,代码来源:test_event.py


示例15: query_fulltext_code

def query_fulltext_code(code):
    pinyin = Pinyin()
    initials = []
    for letter in pinyin.get_initials(code, splitter=' ').lower().split(' '):
        if letter.isalpha():
            initials.append(letter * 4)
    logging.debug(initials)
    analysed_code = pinyin.get_pinyin(code, splitter=u' ') + ' ' + ' '.join(initials)
    logging.debug(analysed_code)
    clause = "MATCH(`codepinyin`, `codepinyininitials`) AGAINST (%s)"
    query = yield dbutil.do(Event.select(SQL('*, ' + clause + ' AS similarity', analysed_code)).where(
        SQL(clause, analysed_code)).limit(4).dicts)
    events = [event for event in query]
    logging.debug(events)
    return events
开发者ID:zy4290,项目名称:qilaihi.club,代码行数:15,代码来源:event.py


示例16: get

        def get(self, ident):
            event = Event.get_by_id(long(ident))
            self.response.headers['Content-Type'] = 'application/json'

            eventData = {
                "name": event.name,
                "description": event.description,
                "location": event.location,
                "date": event.date.strftime('%d-%m-%Y'),
                "time": event.time,
                "facebook_link": event.linkFacebook,
                "image": base64.b64encode(str(event.image))
            }
            jsonEventData = json.dumps(eventData)
            self.response.write(jsonEventData)
开发者ID:AEIST,项目名称:old-AEISTMobile-Backoffice,代码行数:15,代码来源:DataController.py


示例17: post

        def post(self, ident):
            event = Event.get_by_id(long(ident))
            event.name = self.request.get("name")
            event.description = self.request.get("description")
            event.local = self.request.get("local")
            event.date = self.request.get("date")
            event.time = self.request.get("time")
            event.link_facebook = self.request.get("facebook_link")
            event.eventTag = "default-tag"
            event.author = "default"

            if self.request.get("image"):
                event.image = db.Blob(images.resize(self.request.get("image"), 300))

            db.put(event)
            self.redirect("/events")
开发者ID:JoaoVasques,项目名称:AEISTMobile-Backoffice,代码行数:16,代码来源:EventController.py


示例18: getEvent

def getEvent(ident):
    event = Event.get_by_id(long(ident))

    jsonEventInfo = {}
    jsonEventInfo['name'] = str(event.name)
    jsonEventInfo['description'] = str(event.description)
    jsonEventInfo['local'] = str(event.local)
    jsonEventInfo['date'] = str(event.date)
    jsonEventInfo['time'] = str(event.time)
    jsonEventInfo['facebook_link'] = str(event.linkFacebook)
    jsonEventInfo['image_key'] = str(event.imageKey)
    jsonEventInfo['author'] = str(event.author)
    jsonEventInfo['image_link'] = '/events/images/' + str(ident)

    event = jsonEventInfo
    return event
开发者ID:JoaoVasques,项目名称:AEISTMobile-Backoffice,代码行数:16,代码来源:EventController.py


示例19: post

 def post(self):
     try:
         data = json.loads(self.request.body.decode())
         logging.debug(data)
         # 默认查询第一页
         page_number = data.get('page_number', 1)
         # 默认每页显示4条数据
         items_per_page = data.get('items_per_page', 4)
         query = yield dbutil.do(
             Event.select().order_by(-Event.createtime).paginate(
                 page_number, items_per_page).dicts)
         result = [event for event in query]
         self.write(Response(status=1, msg='ok', result=result).json())
     except Exception as e:
         self.write(Response(msg='sorry,亲,活动查询失败').json())
         logging.exception('CreateEventHandler error: {0}'.format(str(e)))
开发者ID:zy4290,项目名称:qilaihi.club,代码行数:16,代码来源:eventservice.py


示例20: save_half_inning

 def save_half_inning(self, inning):
     at_bats = inning.findall('atbat')
     for at_bat in at_bats:
         attrib = at_bat.attrib
         event = Event()
         event.pitcher = int(attrib['pitcher'])
         event.batter = int(attrib['batter'])
         event.description = attrib['des']
         event.event = attrib['event']
         event.game_id = self.game_id
         self.collection.add_event(event)
开发者ID:yoloismymoto,项目名称:baseball,代码行数:11,代码来源:events_parser.py



注:本文中的model.event.Event类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python group.Group类代码示例发布时间:2022-05-27
下一篇:
Python elements.PeriodicTable类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap