[datafeed] allow to use cwclientlib for datafeed's queries (closes #5456849)
HTTP based URLs will be handled by a CWProxy if:
- cwclientlib is available and
- the URL matches a cwclientlibrc config entry
Otherwise, fallback to previous implementation.
See https://www.cubicweb.org/project/cwclientlib
:Warning:
This comes with an API modification of DataFeedParser.retrieve_url: it used
to accept data and headers arguments to build GET or POST (if data was given)
queries, but this was not used by any known code and imply more complicated
code.
"""execute this script if you've migration to file >= 1.9.0 with cubicweb <= 3.9.2FYI, this migration occurred :* on our intranet on July 07 2010* on our extranet on July 16 2010"""try:backupinstance,=__args__exceptValueError:print'USAGE: cubicweb-ctl shell <instance> repair_file_1-9_migration.py -- <backup instance id>'printprint'you should restored the backup on a new instance, accessible through pyro'fromcubicwebimportcwconfig,dbapifromcubicweb.server.sessionimporthooks_controldefaultadmin=repo.config.default_admin_configbackupcfg=cwconfig.instance_configuration(backupinstance)backupcfg.repairing=Truebackuprepo,backupcnx=dbapi.in_memory_repo_cnx(backupcfg,defaultadmin['login'],password=defaultadmin['password'],host='localhost')backupcu=backupcnx.cursor()withhooks_control(session,session.HOOKS_DENY_ALL):rql('SET X is Y WHERE X is File, Y name "File", NOT X is Y')rql('SET X is_instance_of Y WHERE X is File, Y name "File", NOT X is_instance_of Y')forrtype,inbackupcu.execute('DISTINCT Any RTN WHERE X relation_type RT, RT name RTN,''X from_entity Y, Y name "Image", X is CWRelation, ''EXISTS(XX is CWRelation, XX relation_type RT, ''XX from_entity YY, YY name "File")'):ifrtypein('is','is_instance_of'):continueprintrtypeforfeid,xeidinbackupcu.execute('Any F,X WHERE F %s X, F is IN (File,Image)'%rtype):print'restoring relation %s between file %s and %s'%(rtype,feid,xeid),printrql('SET F %s X WHERE F eid %%(f)s, X eid %%(x)s, NOT F %s X'%(rtype,rtype),{'f':feid,'x':xeid})forrtype,inbackupcu.execute('DISTINCT Any RTN WHERE X relation_type RT, RT name RTN,''X to_entity Y, Y name "Image", X is CWRelation, ''EXISTS(XX is CWRelation, XX relation_type RT, ''XX to_entity YY, YY name "File")'):printrtypeforfeid,xeidinbackupcu.execute('Any F,X WHERE X %s F, F is IN (File,Image)'%rtype):print'restoring relation %s between %s and file %s'%(rtype,xeid,feid),printrql('SET X %s F WHERE F eid %%(f)s, X eid %%(x)s, NOT X %s F'%(rtype,rtype),{'f':feid,'x':xeid})commit()