當前位置: 首頁>>代碼示例>>Python>>正文


Python event.Event類代碼示例

本文整理匯總了Python中model.event.Event的典型用法代碼示例。如果您正苦於以下問題:Python Event類的具體用法?Python Event怎麽用?Python Event使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Event類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的model.event.Event類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。