1. 10 Mar, 2015 4 commits
  2. 09 Mar, 2015 1 commit
  3. 06 Mar, 2015 3 commits
  4. 05 Mar, 2015 3 commits
  5. 04 Mar, 2015 4 commits
  6. 03 Mar, 2015 1 commit
  7. 02 Mar, 2015 4 commits
  8. 26 Feb, 2015 3 commits
  9. 25 Feb, 2015 1 commit
  10. 24 Feb, 2015 2 commits
  11. 23 Feb, 2015 1 commit
    • Kirill Smelkov's avatar
      BigFile: Fix non-range download of just created big file · 4d8f0c33
      Kirill Smelkov authored
      If in erp5 I go to big_file_module and 'Add Big File' action and then try to
      download just-created empty bigfile I get a crash:
      
          curl ... --data 'format=raw'  http://localhost:8889/erp5/big_file_module/18
      
          ...
          <h2>Site Error</h2>
      
          <p>An error was encountered while publishing this
           resource.</p>
      
          <p>
            <strong>Error Type:
              AttributeError
            </strong>
            <br />
            <strong>Error Value:
              'str' object has no attribute 'iterate'
            </strong>
            <br />
          </p>
      
      with exception traceback
      
          Traceback (innermost last):
            Module ZPublisher.Publish, line 138, in publish
              request, bind=1)
            Module ZPublisher.mapply, line 77, in mapply
              if debug is not None: return debug(object,args,context)
            Module ZPublisher.Publish, line 48, in call_object
              result=apply(object,args) # Type s<cr> to step into published object.
            Module Products.ERP5.Document.BigFile, line 297, in index_html
              for chunk in data.iterate():
          AttributeError: 'str' object has no attribute 'iterate'
      
      I've compared BigFile code with the sample place in File code from Zope/src/OFS
      (which is base class for BigFile)
      
          https://github.com/zopefoundation/Zope/blob/2.13/src/OFS/Image.py#L420
      
      and in index_html(), if we requested the data itself, there it sees whether
      self.data is either
      
          1) simply bytes (= str in python2), or
      
          2) linked-list of Pdata
      
      and in BigFile we currently miss handling 1) case.
      
      ~~~~
      
      BigFile, it looks, was copied-and-modified from Zope.OFS.Image.File first in
      65121be7 (Support streaming big file in DMS.) Then in index_html download there
      was only an 'iterate over btree chunks' case. Later in dff53681 (Get
      modification date from btree.) a case for
      
          if data is None:
            return ''
      
      was added before btree iteration.
      
      Here we also restore original Zope code for returning file content if it is
      string instance directly, because as it is experimentally observed, that case
      can also happen.
      
      The patch does not add tests, because currently BigFile class does not have
      tests at all (at least I could not find them).
      Reviewed-by: Romain Courteaud's avatarRomain Courteaud <romain@nexedi.com>
      4d8f0c33
  12. 21 Feb, 2015 3 commits
  13. 18 Feb, 2015 1 commit
  14. 17 Feb, 2015 9 commits