コード例 #1
0
 def add_talk_by_prompt(self):
     print "------------------------------ Adding a Talk -------------------------------\n"
     presentation = Presentation("")
     
     presentation.title = raw_input("Type the presentation title: ").strip()
     
     while(not len(presentation.title) > 0):
         presentation.title = raw_input("Please, type the presentation title: ").strip() 
     
     presentation.speaker = raw_input("Type the presentation speaker: ").strip()
     
     while(not len(presentation.speaker) > 0):
         presentation.speaker = raw_input("Please, type the presentation speaker: ").strip()
     
     presentation.description = raw_input("Type the presentation description or press <ENTER> to pass: "******"Type the speaker level or press <ENTER> to pass: "******"Type the event that held the presentation or press <ENTER> to pass: "******"Type the room where the presentation will be performed or press <ENTER> to pass: "******"Type the presentation time (format: dd/MM/yyyy HH:mm) or press <ENTER> to pass: "******"Wrong date format, please type the presentation time (format: dd/MM/yyyy HH:mm) or press <ENTER> to pass: "******"###################### Talk Added ############################"
     else:
         print "############### Error: Talk Already Exists ###################"
コード例 #2
0
 def update_talk_by_prompt(self, id): 
     presentation = self.db.get_presentation(id)
     if presentation:                  
         print "#### You have choosen to edit the following talk ###"
         
         self.show_talk_by_id(id)     
                             
         new_title = raw_input("Type the new presentation title (<ENTER> to keep old data): ")
         title = new_title if len(new_title) > 0 else presentation.title
             
         new_speaker = raw_input("Type the new presentation speaker (<ENTER> to keep old data): ")
         speaker = new_speaker if len(new_speaker) > 0 else presentation.speaker
             
         new_room = raw_input("Type the new room where the presentation will be performed (<ENTER> to keep old data): ")  
         room = new_room if len(new_room) > 0 else presentation.room
         
         new_event = raw_input("Type the new event that held the presentation (<ENTER> to keep old data): ")
         event = new_event if len(new_event) > 0 else presentation.event
             
         
         
         new_presentation = Presentation("")
         
         new_presentation.talk_id = id
         new_presentation.title = title
         new_presentation.speaker = speaker
         new_presentation.event = event
         new_presentation.room = room
         
         self.db.update_presentation(id, new_presentation)
         
         print "### Talk Updated! ###"
         
     else:
         print "There's no such presentation"