Esempio n. 1
0
 def getTerm(self, value):
     try:
         return super(MissingTermsMixin, self).getTerm(value)
     except LookupError:
         try:
             return self.complete_voc().getTerm(value)
         except LookupError:
             pass
     if (IContextAware.providedBy(self.widget) and not self.widget.ignoreContext):
         curValue = getMultiAdapter((self.widget.context, self.field), IDataManager).query()
         if curValue == value:
             return self._makeMissingTerm(value)
     raise
 def getTerm(self, value):
     try:
         return super(MissingTermsMixin, self).getTerm(value)
     except LookupError:
         try:
             return self.complete_voc().getTerm(value)
         except LookupError:
             pass
     if (IContextAware.providedBy(self.widget) and not self.widget.ignoreContext):
         curValue = getMultiAdapter((self.widget.context, self.field), IDataManager).query()
         if curValue == value:
             return self._makeMissingTerm(value)
     raise
Esempio n. 3
0
 def getTermByToken(self, token):
     try:
         return super(MissingTermsMixin, self).getTermByToken(token)
     except LookupError:
         try:
             return self.complete_voc().getTermByToken(token)
         except LookupError:
             pass
     if (IContextAware.providedBy(self.widget) and not self.widget.ignoreContext):
         value = getMultiAdapter((self.widget.context, self.field), IDataManager).query()
         term = self._makeMissingTerm(value)
         if term.token == token:
             return term
     raise LookupError(token)
 def getTermByToken(self, token):
     try:
         return super(MissingTermsMixin, self).getTermByToken(token)
     except LookupError:
         try:
             return self.complete_voc().getTermByToken(token)
         except LookupError:
             pass
     if (IContextAware.providedBy(self.widget) and not self.widget.ignoreContext):
         value = getMultiAdapter((self.widget.context, self.field), IDataManager).query()
         term = self._makeMissingTerm(value)
         if term.token == token:
             return term
     raise LookupError(token)