cubicweb #3306421 add_entity_type fails with final type [waiting feedback]


>>> add_entity_type('Geography')
Traceback (most recent call last):
 File "<console>", line 1, in <module>
 File "/home/auc/confs/unlish/cubicweb/server/", line 928, in cmd_add_entity_type
 File "/home/auc/confs/unlish/cubicweb/server/", line 312, in commit
 File "/home/auc/confs/unlish/cubicweb/", line 525, in decorator
   return func(self, *args, **kwargs)
 File "/home/auc/confs/unlish/cubicweb/", line 751, in commit
   return self._repo.commit(self.sessionid, **self._txid())
 File "/home/auc/confs/unlish/cubicweb/server/", line 852, in commit
   return session.commit()
 File "/home/auc/confs/unlish/cubicweb/server/", line 1252, in commit
 File "/home/auc/confs/unlish/cubicweb/server/", line 760, in handle_event
   getattr(self, event)()
 File "/home/auc/confs/unlish/cubicweb/hooks/", line 480, in precommit_event
   insert_rdef_on_subclasses(session, eschema, rschema, rdefdef, props)
 File "/home/auc/confs/unlish/cubicweb/hooks/", line 97, in insert_rdef_on_subclasses
   cstrtypemap = ss.cstrtype_mapping(session)
 File "/home/auc/confs/unlish/cubicweb/server/", line 79, in cstrtype_mapping
   map = dict(cursor.execute('Any T, X WHERE X is CWConstraintType, X name T'))
 File "/home/auc/confs/unlish/cubicweb/server/", line 1182, in execute
   rset = self._execute(self, rql, kwargs, build_descr)
 File "/home/auc/confs/unlish/cubicweb/server/", line 642, in execute
   results = plan.execute()
 File "/home/auc/confs/unlish/cubicweb/server/", line 184, in execute
   result = step.execute()
 File "/home/auc/confs/unlish/cubicweb/server/", line 416, in execute
 File "/home/auc/confs/unlish/cubicweb/server/sources/", line 534, in syntax_tree_search
   cursor = self.doexec(session, sql, args)
 File "/home/auc/confs/unlish/cubicweb/server/sources/", line 743, in doexec
   cursor.execute(str(query), args)
InternalError: current transaction is aborted, commands ignored until end of transaction block

I suspect it does too much. I have experimented with a stripped-down variant of add_entity_type and it may be good enough. add_entity_type should probably check whether the schema is final and not perform some of its heavy duties in this case.

done in<not specified>
closed by<not specified>