[edit controller] fix handling of removal of subentities from an edit form
In CubicWeb 3.18 the semantics of dropping a composite relation were changed.
It had before the effect of deleting the subentities.
Now the edit controller must handle this by itself (it was not adapted then by
mistake).
So if it detects the removal of a composite relation (on the browser side, the
user clicked on the "remove" action), the subentity is now explicitly deleted.
It was chosen not to change the form generation but the EditController:
- to ensure pre-3.18 forms backward compat
- to avoid the introduction of a specific entity-deletion API (RQL is probably
our best API for complex DB operations)
Related to #8529868.
#!/usr/bin/python"""usage: fix-po-encodings [filename...]change the encoding of the po files passed as arguments to utf-8"""import sysimport reimport codecsdef change_encoding(filename, target='UTF-8'): fdesc = open(filename) data = fdesc.read() fdesc.close() encoding = find_encoding(data) if encoding == target: return data = fix_encoding(data, target) data = unicode(data, encoding) fdesc = codecs.open(filename, 'wb', encoding=target) fdesc.write(data) fdesc.close()def find_encoding(data): regexp = re.compile(r'"Content-Type:.* charset=([a-zA-Z0-9-]+)\\n"', re.M) mo = regexp.search(data) if mo is None: raise ValueError('No encoding declaration') return mo.group(1)def fix_encoding(data, target_encoding): regexp = re.compile(r'("Content-Type:.* charset=)(.*)(\\n")', re.M) return regexp.sub(r'\1%s\3' % target_encoding, data)for filename in sys.argv[1:]: print filename change_encoding(filename)