• Jérome Perrin's avatar
    Merge !496 Replace \r\n by \n in ZSQL Methods' arguments · aa603a2c
    Jérome Perrin authored
    Since 76cc938e we have diffs each time we edit ZSQL Methods. This is a "big commit" to change all remaining ZSQL methods. I checked diffs one by one, but I would appreciate others check this as well and confirm that it's OK to do so.
    
    From the root of repository, I did :
    
    ```
    grep -rl Products.ZSQLMethods.SQL  . | grep '\.xml$' | xargs ~/bin/zsql_backslash_n.py
    ```
    
    With a script containing
    ```python
    
    from lxml import etree
    import sys
    
    for filename in sys.argv[1:]:
      with open(filename) as f:
        tree = etree.parse(f)
        root = tree.getroot()
        for el in tree.xpath('//item/key/string[text() = "arguments_src"]/../../value/string'):
          if el.text:
            el.text = el.text.replace(r'\r\n', r'\n')
    
        # force <string> element to have a text, so that they export as <string></string> and not <string/>
        for el in tree.xpath('//string[not(text())]'):
          el.text = ''
    
      with open(filename, 'w') as f:
        f.write(
            '<?xml version="1.0"?>\n'
            + etree.tostring(root, pretty_print=True, encoding="utf-8"))
    
      print filename
    ```
    ( script snippet: $277 )
    
    /cc @jm @georgios.dagkakis @Nicolas
    
    /reviewed-on !496
    
    Conflicts:
    	product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_getitem_by_path.xml
    	product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_getitem_by_uid.xml
    	product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_produce_reserved_uid_list.xml
    aa603a2c
z_related_strict_membership_preferred_gap.xml 1.02 KB