652 # - None: not started, |
652 # - None: not started, |
653 # - False: currently generated, |
653 # - False: currently generated, |
654 # - True: generation done. |
654 # - True: generation done. |
655 self._generated = None |
655 self._generated = None |
656 self.mandatory = mandatory |
656 self.mandatory = mandatory |
|
657 |
|
658 def copy(self): |
|
659 """return a copy of the part |
|
660 |
|
661 The new part have the very same content but no partid assigned yet. |
|
662 Parts with generated data cannot be copied.""" |
|
663 assert not util.safehasattr(self.data, 'next') |
|
664 return self.__class__(self.type, self._mandatoryparams, |
|
665 self._advisoryparams, self._data, self.mandatory) |
657 |
666 |
658 # methods used to defines the part content |
667 # methods used to defines the part content |
659 def __setdata(self, data): |
668 def __setdata(self, data): |
660 if self._generated is not None: |
669 if self._generated is not None: |
661 raise error.ReadOnlyPartError('part is being generated') |
670 raise error.ReadOnlyPartError('part is being generated') |