##// END OF EJS Templates
bundle2: track life cycle of parts...
Pierre-Yves David -
r21601:7ff01bef default
parent child Browse files
Show More
@@ -552,8 +552,17 b' class bundlepart(object):'
552 self.data = data
552 self.data = data
553 self.mandatoryparams = mandatoryparams
553 self.mandatoryparams = mandatoryparams
554 self.advisoryparams = advisoryparams
554 self.advisoryparams = advisoryparams
555 # status of the part's generation:
556 # - None: not started,
557 # - False: currently generated,
558 # - True: generation done.
559 self._generated = None
555
560
561 # methods used to generates the bundle2 stream
556 def getchunks(self):
562 def getchunks(self):
563 if self._generated is not None:
564 raise RuntimeError('part can only be consumed once')
565 self._generated = False
557 #### header
566 #### header
558 ## parttype
567 ## parttype
559 header = [_pack(_fparttypesize, len(self.type)),
568 header = [_pack(_fparttypesize, len(self.type)),
@@ -591,6 +600,7 b' class bundlepart(object):'
591 yield chunk
600 yield chunk
592 # end of payload
601 # end of payload
593 yield _pack(_fpayloadsize, 0)
602 yield _pack(_fpayloadsize, 0)
603 self._generated = True
594
604
595 def _payloadchunks(self):
605 def _payloadchunks(self):
596 """yield chunks of a the part payload
606 """yield chunks of a the part payload
General Comments 0
You need to be logged in to leave comments. Login now