Пример #1
0
 def _setUpWidgets(self):
     adapted = self.schema(self.context)
     if adapted is not self.context:
         if not ILocation.providedBy(adapted):
             adapted = LocationProxy(adapted)
         adapted.__parent__ = self.context
     self.adapted = adapted
     setUpEditWidgets(self, self.schema, source=self.adapted,
                      names=self.fieldNames)
Пример #2
0
 def _setUpWidgets(self):
     adapted = self.schema(self.context)
     if adapted is not self.context:
         if not ILocation.providedBy(adapted):
             adapted = LocationProxy(adapted)
         adapted.__parent__ = self.context
     self.adapted = adapted
     setUpEditWidgets(self, self.schema, source=self.adapted,
                      names=self.fieldNames)
Пример #3
0
 def update_batch(self):
     if self.createBatch:
         content = self.getContentData().getContent()
         if not ILocation.providedBy(content):
             content = LocationProxy(content)
             content.__parent__ = self
             content.__name__ = ''
         self.batcher = Batcher(
             content, self.request, self.prefix, size=self.batchSize)
         self.batcher.update(self.lines)
Пример #4
0
def assertLocation(adapter, parent):
    """Assert locatable adapters.

    This function asserts that the adapter get location-proxied if
    it doesn't provide ILocation itself. Further more the returned
    locatable adapter get its parent set if its __parent__ attribute
    is currently None.
    """
    # handle none-locatable adapters (A)
    if not ILocation.providedBy(adapter):
        locatable = LocationProxy(adapter)
        locatable.__parent__ = parent
        return locatable

    # handle locatable, parentless adapters (B)
    if adapter.__parent__ is None:
        adapter.__parent__ = parent
        return adapter

    # handle locatable, parentful adapters (C)
    return adapter
Пример #5
0
def assertLocation(adapter, parent):
    """Assert locatable adapters.

    This function asserts that the adapter get location-proxied if
    it doesn't provide ILocation itself. Further more the returned
    locatable adapter get its parent set if its __parent__ attribute
    is currently None.
    """
    # handle none-locatable adapters (A)
    if not ILocation.providedBy(adapter):
        locatable = LocationProxy(adapter)
        locatable.__parent__ = parent
        return locatable

    # handle locatable, parentless adapters (B)
    if adapter.__parent__ is None:
        adapter.__parent__ = parent
        return adapter

    # handle locatable, parentful adapters (C)
    return adapter