[Cubicweb] Misunderstanding of dataimport _create_copyfrom_buffer function

LANQUETUIT Cyril Cyril.LANQUETUIT at cea.fr
Mon May 19 14:24:58 CEST 2014


Hello,

In function _create_copyfrom_buffer of file dataimport.py, in the following part of code:

                        # If a replace_sep is given, replace
                        # the separator instead of returning None
                        # (and thus avoid empty buffer)
                        if replace_sep:
                            value = value.replace(_char, replace_sep)
                        else:
                            return


when the separator is set to '' (the default value when MassiveObjectStore is used for store)
the replace_sep is evaluate to false so the else clause is executed, the function _create_copyfrom_buffer return an empty buffer
then this following error is raised:

File "/home/cl239099/cubicweb/cubes/dataio/dataimport.py", line 831, in flush_entities
    raise ValueError('Error in buffer creation for etype %s' % etype)
ValueError: Error in buffer creation for etype Question

I don't understand exactly what the code should do or should be but if the clause

if replace_sep:

is replaced by something like

if (replace_sep != None):

the else clause won't be executed in this case...

please could you examinate this issue and correct it if needed or let me know what is wrong in the precedent discribed comportement

Thank's,
Cyril
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20140519/d5418414/attachment-0164.html>


More information about the Cubicweb mailing list