def __of__(self, parent): # Accesses the database, returning an acquisition # wrapper around the connected object rather than around self. try: return self._getOrOpenObject(parent) except: return Acquisition.ImplicitAcquisitionWrapper(self, parent)
def update(self): super(z3c.form.browser.textarea.TextAreaWidget, self).update() z3c.form.browser.widget.addFieldClass(self) # We'll wrap context in the current site *if* it's not already # wrapped. This allows the template to acquire tools with # ``context/portal_this`` if context is not wrapped already. # Any attempts to satisfy the Kupu template in a less idiotic # way failed: if getattr(self.form.context, 'aq_inner', None) is None: self.form.context = Acquisition.ImplicitAcquisitionWrapper( self.form.context, getSite())
def makeLibraries(self): # need to use Plone specific tool for Acquisition. Sucks. libs = PloneKupuLibraryTool() self.portal = Acquisition.ImplicitAcquisitionWrapper( FakePortal(), self.app.REQUEST) context = FakeContextObject() libs = libs.__of__(self.portal) self.context = context.__of__(self.portal) libs.addLibrary('foo_id', 'Foobar', 'foobar', 'foosrc', 'fooicon') libs.addLibrary('bar_id', 'Barfoo', 'barfoo', 'barsrc', 'baricon') libs.addLibrary('baz_id', 'Baz', 'foobarbaz', 'bazsrc', 'bazicon') return libs
def __of__(self, parent): try: self = Acquisition.ImplicitAcquisitionWrapper(self, parent) self._updateFromFS() return self except: from zLOG import LOG, ERROR import sys LOG('FS Z SQL Method', ERROR, 'Error during __of__', error=sys.exc_info()) raise
def __of__(self, parent): self = Acquisition.ImplicitAcquisitionWrapper(self, parent) self._updateFromFS() return self
def __call__(self, *args, **kw): w, m, parent = self._ugh self = m.__of__(Acquisition.ImplicitAcquisitionWrapper(w, parent)) return apply(self, args, kw)
def __getattr__(self, name): w, m, parent = self._ugh self = m.__of__(Acquisition.ImplicitAcquisitionWrapper(w, parent)) return getattr(self, name)
def __of__(self, parent): w, m, p = self._ugh return m.__of__(Acquisition.ImplicitAcquisitionWrapper(w, parent))