SourceForge has been redesigned. Learn more.
Close

#99 SQLAlchemy warnings during PUT & PROPATCH

0.49
closed
nobody
Model
General-Bug
2016-07-14
2012-11-26
No

Saving a file results in an SQLAlchemy warning

"PUT /dav/Projects/test123/Documents/ComericaPositivePayIn.yaml HTTP/1.0" 204 -
/home/awilliam/projects/coils/lib/python2.7/site-packages/sqlalchemy/orm/attributes.py:453: SAWarning: Multiple rows returned with uselist=False for lazily-loaded attribute 'Document._version' 
  value = self.callable_(state, passive)

PROPATCH causes the same thing

"PROPPATCH /dav/Projects/test123/Documents/ComericaPositivePayIn.yaml HTTP/1.0" 207 -
/home/awilliam/projects/coils/lib/python2.7/site-packages/sqlalchemy/orm/attributes.py:453: SAWarning: Multiple rows returned with uselist=False for lazily-loaded attribute 'Document._version' 
  value = self.callable_(state, passive)

Discussion

  • Adam Tauno Williams

    The warning seems to be on the PROPFIND before the PUT. But that PROPFIND is really boring, and I can execute it via curl and not get a warning.

    PROPFIND /dav/Projects/test123/Documents/ComericaPositivePayIn.yaml        
    HTTP/1.1
    Host: 127.0.0.1
    Depth: 0
    Content-Type: application/xml
    Apply-To-Redirect-Ref: T
    Accept-Encoding: gzip, deflate
    User-Agent: gvfs/1.14.1
    Accept-Language: en-us, en;q=0.9
    Connection: Keep-Alive
    Authorization: Basic YXdpbGxpYW06ZnJlZDEyMw==
    Content-Length: 235
    
    <?xml version="1.0" encoding="utf-8" ?>
     <D:propfind xmlns:D="DAV:">
      <D:prop>
        <D:creationdate/>
        <D:displayname/>
        <D:getcontentlength/>
        <D:getcontenttype/>
        <D:getetag/>
        <D:getlastmodified/>
        <D:resourcetype/>
          </D:prop>
         </D:propfind>
    
    HTTP/1.1 207 Multistatus
    Server: nginx/1.0.15
    Date: Tue, 27 Nov 2012 10:33:32 GMT
    Content-Type: text/xml; charset="utf-8"
    Connection: keep-alive
    Content-Length: 888
    X-Dav-Error: 200 No error
    Ms-Author-Via: DAV
    
    <?xml version="1.0" encoding="utf-8"?>
    <D:multistatus xmlns:G="http://groupdav.org/" xmlns:E="urn:ietf:params:xml:ns:carddav" xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav" xmlns:B="http://icewarp.com/ns/" xmlns:A="http://apache.org/dav/props/">
      <D:response><D:href>/dav/Projects/test123/Documents/ComericaPositivePayIn.yaml</D:href>
        <D:propstat>
          <D:status>HTTP/1.1 200 OK</D:status>
          <D:prop>
            <D:getcontenttype>application/octet-stream</D:getcontenttype>
            <D:resourcetype/>
            <D:displayname>ComericaPositivePayIn.yaml</D:displayname>
            <D:getlastmodified>Tue, 27 Nov 2012 05:32:24 GMT</D:getlastmodified>
            <D:getetag>97170:9</D:getetag>
            <D:creationdate>Mon, 26 Nov 2012 22:48:16 GMT</D:creationdate>
            <D:getcontentlength>783</D:getcontentlength>
          </D:prop>
        </D:propstat>
      </D:response>
    </D:multistatus>
    
     
  • Adam Tauno Williams

    Agree, I can PUT multiple times to the exact same URL and not see the warning, from PUT. Argh! Where is that warning being generated.

     
  • Adam Tauno Williams

    So a PROPPATCH can induce this message very time.

    curl -X PROPPATCH -u awilliam:fred123 \
     -d '<?xml version="1.0" encoding="utf-8" ?>
         <D:propertyupdate xmlns:D="DAV:" xmlns:Z="urn:schemas-microsoft-com:">
           <D:set>
            <D:prop>
             <Z:Win32CreationTime>Mon, 26 Nov 2012 22:48:16 GMT</Z:Win32CreationTime>
             <Z:Win32LastAccessTime>Tue, 27 Nov 2012 10:46:41 GMT</Z:Win32LastAccessTime>
             <Z:Win32LastModifiedTime>Tue, 27 Nov 2012 10:46:41 GMT</Z:Win32LastModifiedTime>
            </D:prop>
           </D:set>
         </D:propertyupdate>' \
      http://127.0.0.1:8080/dav/Projects/test123/Documents/XLSUpdateStanzas.txt
    
     
  • Adam Tauno Williams

    Huh, this message results from the entity repr method -

    self.log.debug('Committed PROPPATCH to {0}'.format(self.entity))
    
     
  • Adam Tauno Williams

    AH! Yikes, there is a very stupid missing Foreign Key constraint between Document and DocumentVersion, that caused this mess.

     
  • Adam Tauno Williams

    • status: open --> closed
     
  • Adam Tauno Williams

    Fixed, see patch.
    Might also improve performance nicely.

     
  • Adam Tauno Williams

    • Layer: --> Model
    • Type: --> General-Bug
     

Log in to post a comment.