make schema factory work with new objects not yet linked to a container
This commit is contained in:
parent
dd7e27f7cd
commit
5b87a574c4
1 changed files with 6 additions and 1 deletions
|
@ -36,7 +36,12 @@ class PersonSchemaFactory(BasePersonSchemaFactory):
|
|||
def __call__(self, interface, **kw):
|
||||
schema = super(PersonSchemaFactory, self).__call__(interface, **kw)
|
||||
if 'knowledge' in schema.fields.keys():
|
||||
kelements = IOptions(self.context.getLoopsRoot())('knowledge.element')
|
||||
kelements = []
|
||||
request = kw.get('request')
|
||||
if request is not None:
|
||||
v = request.annotations.get('loops.view', {}).get('nodeView')
|
||||
if v is not None:
|
||||
kelements = IOptions(v.loopsRoot)('knowledge.element')
|
||||
if kelements:
|
||||
schema.fields['knowledge'].target_types = kelements
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue