Skip to content

Commit

Permalink
Prevent re-adding extended model elements in nexus handlers (#3486)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cisphyx committed Jan 4, 2024
1 parent 3bbbcbe commit 05b6bb7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions synapse/cortex.py
Expand Up @@ -3163,6 +3163,10 @@ async def addUnivProp(self, name, tdef, info):

@s_nexus.Pusher.onPush('model:univ:add')
async def _addUnivProp(self, name, tdef, info):
base = '.' + name
if base in self.model.props:
return

self.model.addUnivProp(name, tdef, info)

await self.extunivs.set(name, (name, tdef, info))
Expand Down Expand Up @@ -3191,6 +3195,8 @@ async def addForm(self, formname, basetype, typeopts, typeinfo):

@s_nexus.Pusher.onPush('model:form:add')
async def _addForm(self, formname, basetype, typeopts, typeinfo):
if self.model.form(formname) is not None:
return

ifaces = typeinfo.get('interfaces')

Expand Down Expand Up @@ -3224,6 +3230,8 @@ async def delForm(self, formname):

@s_nexus.Pusher.onPush('model:form:del')
async def _delForm(self, formname):
if self.model.form(formname) is None:
return

for layr in self.layers.values():
async for item in layr.iterFormRows(formname):
Expand Down Expand Up @@ -3259,6 +3267,9 @@ async def addFormProp(self, form, prop, tdef, info):

@s_nexus.Pusher.onPush('model:prop:add')
async def _addFormProp(self, form, prop, tdef, info):
if (_form := self.model.form(form)) is not None and _form.prop(prop) is not None:
return

_prop = self.model.addFormProp(form, prop, tdef, info)
if _prop.type.deprecated:
mesg = f'The extended property {_prop.full} is using a deprecated type {_prop.type.name} which will' \
Expand Down

0 comments on commit 05b6bb7

Please sign in to comment.