equal
deleted
inserted
replaced
1653 return getChoicesMethod |
1653 return getChoicesMethod |
1654 |
1654 |
1655 |
1655 |
1656 def generateSetChoiceByTypeMethod(factory, choice_types): |
1656 def generateSetChoiceByTypeMethod(factory, choice_types): |
1657 choices = dict([(choice["name"], choice) for choice in choice_types]) |
1657 choices = dict([(choice["name"], choice) for choice in choice_types]) |
|
1658 |
1658 def setChoiceMethod(self, content_type): |
1659 def setChoiceMethod(self, content_type): |
1659 if not choices.has_key(content_type): |
1660 if not choices.has_key(content_type): |
1660 raise ValueError("Unknown \"%s\" choice type for \"content\"!" % content_type) |
1661 raise ValueError("Unknown \"%s\" choice type for \"content\"!" % content_type) |
1661 choices[content_type]["elmt_type"] = FindTypeInfos(factory, choices[content_type]["elmt_type"]) |
1662 choices[content_type]["elmt_type"] = FindTypeInfos(factory, choices[content_type]["elmt_type"]) |
1662 new_content = choices[content_type]["elmt_type"]["initial"]() |
1663 new_content = choices[content_type]["elmt_type"]["initial"]() |
1666 return setChoiceMethod |
1667 return setChoiceMethod |
1667 |
1668 |
1668 |
1669 |
1669 def generateAppendChoiceByTypeMethod(maxOccurs, factory, choice_types): |
1670 def generateAppendChoiceByTypeMethod(maxOccurs, factory, choice_types): |
1670 choices = dict([(choice["name"], choice) for choice in choice_types]) |
1671 choices = dict([(choice["name"], choice) for choice in choice_types]) |
|
1672 |
1671 def appendChoiceMethod(self, content_type): |
1673 def appendChoiceMethod(self, content_type): |
1672 if not choices.has_key(content_type): |
1674 if not choices.has_key(content_type): |
1673 raise ValueError("Unknown \"%s\" choice type for \"content\"!" % content_type) |
1675 raise ValueError("Unknown \"%s\" choice type for \"content\"!" % content_type) |
1674 choices[content_type]["elmt_type"] = FindTypeInfos(factory, choices[content_type]["elmt_type"]) |
1676 choices[content_type]["elmt_type"] = FindTypeInfos(factory, choices[content_type]["elmt_type"]) |
1675 if maxOccurs == "unbounded" or len(self.content) < maxOccurs: |
1677 if maxOccurs == "unbounded" or len(self.content) < maxOccurs: |
1682 return appendChoiceMethod |
1684 return appendChoiceMethod |
1683 |
1685 |
1684 |
1686 |
1685 def generateInsertChoiceByTypeMethod(maxOccurs, factory, choice_types): |
1687 def generateInsertChoiceByTypeMethod(maxOccurs, factory, choice_types): |
1686 choices = dict([(choice["name"], choice) for choice in choice_types]) |
1688 choices = dict([(choice["name"], choice) for choice in choice_types]) |
|
1689 |
1687 def insertChoiceMethod(self, index, content_type): |
1690 def insertChoiceMethod(self, index, content_type): |
1688 if not choices.has_key(content_type): |
1691 if not choices.has_key(content_type): |
1689 raise ValueError("Unknown \"%s\" choice type for \"content\"!" % content_type) |
1692 raise ValueError("Unknown \"%s\" choice type for \"content\"!" % content_type) |
1690 choices[type]["elmt_type"] = FindTypeInfos(factory, choices[content_type]["elmt_type"]) |
1693 choices[type]["elmt_type"] = FindTypeInfos(factory, choices[content_type]["elmt_type"]) |
1691 if maxOccurs == "unbounded" or len(self.content) < maxOccurs: |
1694 if maxOccurs == "unbounded" or len(self.content) < maxOccurs: |