Ejemplo n.º 1
0
 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)
        def post(self):
            event = Event()
            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.linkFacebook = 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))

            event.put()
            self.redirect("/events")
        def post(self):
            event = Event()
            date_string = self.request.get("date")
            
            event.name = self.request.get("name")
            event.description = self.request.get("description")
            event.location = self.request.get("location")
            event.date = datetime.strptime(date_string, '%Y-%m-%d').date()
            event.time = self.request.get("time")
            event.linkFacebook = 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"), 600))

            event.put()
            self.redirect("/events")