예제 #1
0
 def __getitem__(self, name):
     composite = aq_parent(aq_inner(self))
     slots = composite.filled_slots
     try:
         return slots[name]
     except (KeyError, AttributeError):
         # Generate a new slot.
         s = Slot(name)
         if composite._v_generating:
             # Persist the slot immediately.
             slots._setObject(s.getId(), s)
         else:
             # Persist automatically if the slot changes
             jar = AddOnChangeJar(slots)
             s._p_jar = jar
         return s.__of__(slots)
예제 #2
0
파일: composite.py 프로젝트: goschtl/zope
 def __getitem__(self, name):
     composite = aq_parent(aq_inner(self))
     slots = composite.filled_slots
     try:
         return slots[name]
     except (KeyError, AttributeError):
         # Generate a new slot.
         s = Slot(name)
         if composite._v_generating:
             # Persist the slot immediately.
             slots._setObject(s.getId(), s)
         else:
             # Persist automatically if the slot changes
             jar = AddOnChangeJar(slots)
             s._p_jar = jar
         return s.__of__(slots)