[web/component] guard against invalid page_size form parameter
Same as dff28956f37e, except the almost same code exists in two places
(yay us).
from__future__importprint_functionfrombase64importb64decode,b64encodetry:uri,newdn=__args__exceptValueError:print('USAGE: cubicweb-ctl shell <instance> ldap_change_base_dn.py -- <ldap source uri> <new dn>')print()print('you should not have updated your sources file yet')olddn=repo.sources_by_uri[uri].config['user-base-dn']assertolddn!=newdnraw_input("Ensure you've stopped the instance, type enter when done.")foreid,extidinsql("SELECT eid, extid FROM entities WHERE source='%s'"%uri):olduserdn=b64decode(extid)newuserdn=olduserdn.replace(olddn,newdn)ifnewuserdn!=olduserdn:print(olduserdn,'->',newuserdn)sql("UPDATE entities SET extid='%s' WHERE eid=%s"%(b64encode(newuserdn),eid))commit()print('you can now update the sources file to the new dn and restart the instance')