def execute(self): self.add_description('Add flash shots in bulk') # add from shot 00001 to 00050 if they do not exist already count = 0 for x in xrange(1, 51): shot_code = '%0.5d'%x shot_code = "%s-%s" %(self.seq_code, shot_code) shot = FlashShot.get_by_code(shot_code) if not shot: print "[%s] to be created." %shot_code shot = FlashShot.create(shot_code, self.seq_code, 'Shot %s' %shot_code) # assuming this is one of the values in project settings # shot_status shot.set_value('status', 'online') shot.commit() count += 1 else: print "[%s] already exists." %shot_code print "%d shot(s) created." %count
def __init__(my, sobject): super(FlashFinalSequenceRenderContext,my).__init__() my.set_sobject(sobject) my.set_context("publish") # set a default render polixy my.set_policy(None) shot = FlashShot.get_by_code(sobject.get_value('shot_code')) my.set_shot(shot)