{ "info": { "author": "Michael Kerrin", "author_email": "michael.kerrin@openapp.ie", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Zope3", "Intended Audience :: Developers", "License :: OSI Approved :: Zope Public License", "Programming Language :: Python" ], "description": "================================\nzope.app.file webdav integration\n================================\n\n >>> import z3c.etree\n >>> from zope.app.file.file import File\n\n >>> etree = z3c.etree.getEngine()\n\nCreate a content object called `textfile.txt` in the root folder.\n\n >>> f = File('%s\\n' %('x' * 10) * 5, 'text/plain')\n >>> getRootFolder()['testfile.txt'] = f\n\nGET\n===\n\nThe default view for the content object needs to be setup in order for WebDAV\nclients to be able to get the data for the DAV compliant resource.\n\n >>> resp = http(\"\"\"\n ... GET /testfile.txt HTTP/1.1\n ... \"\"\", handle_errors = False)\n >>> resp.getStatus()\n 200\n >>> resp.getHeader('content-type')\n 'text/plain'\n >>> resp.getHeader('content-length')\n '55'\n >>> print resp.getBody()\n xxxxxxxxxx\n xxxxxxxxxx\n xxxxxxxxxx\n xxxxxxxxxx\n xxxxxxxxxx\n\nPUT\n===\n\n???\n\nPROPFIND\n========\n\nQuery the WebDAV data model for the file object. The following properties\ncurrently make up the data model for zope.file:\n\n+ {DAV:}creationdate\n\n+ {DAV:}displayname\n\n+ {DAV:}getcontentlength\n\n+ {DAV:}getcontenttype\n\n+ {DAV:}getlastmodified\n\n+ {DAV:}resourcetype\n\nQuery all properties on our test file.\n\n >>> resp = webdav(\"\"\"\n ... PROPFIND /testfile.txt HTTP/1.1\n ... \"\"\", handle_errors = False)\n\n >>> print resp.getBody() #doctest:+XMLDATA\n \n \n http://localhost/testfile.txt\n \n \n \n \n \n text/plain\n 55\n \n \n HTTP/1.1 200 Ok\n \n \n \n\nThe `{DAV:}getetag` and `{DAV:}getcontentlanguage` properties are not defined\n(yet) on a file object.\n\n >>> resp.getMSProperty('http://localhost/testfile.txt', '{DAV:}getetag')\n Traceback (most recent call last):\n ...\n KeyError: \"'{DAV:}getetag' property not found for resource http://localhost/testfile.txt (200)\"\n >>> resp.getMSProperty(\n ... 'http://localhost/testfile.txt', '{DAV:}getcontentlanguage')\n Traceback (most recent call last):\n ...\n KeyError: \"'{DAV:}getcontentlanguage' property not found for resource http://localhost/testfile.txt (200)\"\n\nPROPPATCH\n=========\n\nWe need to be logged in to update a property.\n\n >>> reqbody = \"\"\"\n ... \n ... \n ... Test title\n ... \n ... \n ... \"\"\"\n >>> resp = webdav(\"\"\"\n ... PROPPATCH /testfile.txt HTTP/1.1\n ... Content-Type: application/xml\n ... Content-Length: %d\n ...\n ... %s\"\"\" %(len(reqbody), reqbody))\n >>> resp.getStatus()\n 401\n\nNow update the title of the file.\n\n >>> resp = webdav(\"\"\"\n ... PROPPATCH /testfile.txt HTTP/1.1\n ... Authorization: Basic mgr:mgrpw\n ... Content-Type: application/xml\n ... Content-Length: %d\n ...\n ... %s\"\"\" %(len(reqbody), reqbody), handle_errors = False)\n >>> resp.getStatus()\n 207\n >>> resp.getHeader('content-type')\n 'application/xml'\n >>> print resp.getBody() #doctest:+XMLDATA\n \n \n http://localhost/testfile.txt\n \n \n \n \n HTTP/1.1 200 Ok\n \n \n \n\nRetrieve the displayname property using PROPFIND and notice the difference.\n\n >>> reqbody = \"\"\"\n ... \n ... \n ... \n ... \n ... \"\"\"\n >>> resp = webdav(\"\"\"\n ... PROPFIND /testfile.txt HTTP/1.1\n ... Content-type: application/xml\n ... Content-Length: %d\n ...\n ... %s\"\"\" %(len(reqbody), reqbody), handle_errors = False)\n >>> resp.getStatus()\n 207\n >>> resp.getHeader('content-type')\n 'application/xml'\n >>> print resp.getBody() #doctest:+XMLDATA\n \n \n http://localhost/testfile.txt\n \n \n Test title\n \n HTTP/1.1 200 Ok\n \n \n \n\nThe `{DAV:}getcontentlength` property is a live property, and as such we\ncannot modify it.\n\n >>> reqbody = \"\"\"\n ... \n ... \n ... 24\n ... \n ... \n ... \"\"\"\n >>> resp = webdav(\"\"\"\n ... PROPPATCH /testfile.txt HTTP/1.1\n ... Authorization: Basic mgr:mgrpw\n ... Content-type: application/xml \n ... Content-length: %d\n ...\n ... %s\"\"\" %(len(reqbody), reqbody))\n >>> resp.getStatus()\n 207\n >>> resp.getHeader('content-type')\n 'application/xml'\n >>> print resp.getBody() #doctest:+XMLDATA\n \n \n http://localhost/testfile.txt\n \n \n \n \n HTTP/1.1 403 Forbidden\n \n \n \n\nOpaque properties\n=================\n\nSet two dead properties on our resource.\n\n >>> reqbody = \"\"\"\n ... \n ... \n ... PROPERTY 1\n ... PROPERTY 2\n ... \n ... \n ... \n ... \"\"\"\n >>> resp = webdav(\"\"\"\n ... PROPPATCH /testfile.txt HTTP/1.1\n ... Authorization: Basic mgr:mgrpw\n ... Content-type: application/xml\n ... Content-length: %d\n ...\n ... %s\"\"\" %(len(reqbody), reqbody), handle_errors = True)\n\n >>> resp.getStatus()\n 207\n >>> resp.getHeader('content-type')\n 'application/xml'\n >>> print resp.getBody() #doctest:+XMLDATA\n \n \n http://localhost/testfile.txt\n \n \n \n \n \n HTTP/1.1 200 Ok\n \n \n \n\nQuery these new properties.\n\n >>> reqbody = \"\"\"\n ... \n ... \n ... \n ... \n ... \n ... \"\"\"\n >>> resp = webdav(\"\"\"\n ... PROPFIND /testfile.txt HTTP/1.1\n ... Content-type: application/xml\n ... Content-length: %d\n ...\n ... %s\"\"\" %(len(reqbody), reqbody))\n >>> resp.getStatus()\n 207\n >>> resp.getHeader('content-type')\n 'application/xml'\n >>> print resp.getBody() #doctest:+XMLDATA\n \n \n http://localhost/testfile.txt\n \n \n PROPERTY 1\n PROPERTY 2\n \n HTTP/1.1 200 Ok\n \n \n \n\nUpdate the first property and remove the second.\n\n >>> reqbody = \"\"\"\n ... \n ... \n ... Only opaque property\n ... \n ... \n ... \n ... \n ... \n ... \n ... \n ... \"\"\"\n >>> resp = webdav(\"\"\"\n ... PROPPATCH /testfile.txt HTTP/1.1\n ... Authorization: Basic mgr:mgrpw\n ... Content-type: application/xml\n ... Content-length: %d\n ...\n ... %s\"\"\" %(len(reqbody), reqbody))\n >>> resp.getStatus()\n 207\n >>> resp.getHeader('content-type')\n 'application/xml'\n >>> print resp.getBody() #doctest:+XMLDATA\n \n \n http://localhost/testfile.txt\n \n \n \n \n \n HTTP/1.1 200 Ok\n \n \n \n\nNow check that the opaque properties were updated successfully.\n\n >>> reqbody = \"\"\"\n ... \n ... \n ... \n ... \n ... \n ... \"\"\"\n >>> resp = webdav(\"\"\"\n ... PROPFIND /testfile.txt HTTP/1.1\n ... Content-type: application/xml\n ... Content-length: %d\n ...\n ... %s\"\"\" %(len(reqbody), reqbody))\n >>> resp.getStatus()\n 207\n >>> resp.getHeader('content-type')\n 'application/xml'\n >>> print resp.getBody() #doctest:+XMLDATA\n \n \n http://localhost/testfile.txt\n \n \n Only opaque property\n \n HTTP/1.1 200 Ok\n \n \n \n \n \n HTTP/1.1 404 Not Found\n \n \n \n\n\n=================================\nChanges in z3c.davapp.zopeappfile\n=================================", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://launchpad.net/z3c.dav", "keywords": null, "license": "ZPL", "maintainer": null, "maintainer_email": null, "name": "z3c.davapp.zopeappfile", "package_url": "https://pypi.org/project/z3c.davapp.zopeappfile/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/z3c.davapp.zopeappfile/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://launchpad.net/z3c.dav" }, "release_url": "https://pypi.org/project/z3c.davapp.zopeappfile/1.0b1/", "requires_dist": null, "requires_python": null, "summary": "Define the WebDAV data model for the File and Image objects from the\n`zope.app.file' module.", "version": "1.0b1" }, "last_serial": 802011, "releases": { "1.0b": [ { "comment_text": "", "digests": { "md5": "59f9eac3017ed7f2d09261b147f8b55b", "sha256": "46d8dfaa64b8c97436798275ecafb03aeaa3739b13ddc697ab7aaa2f541ef751" }, "downloads": -1, "filename": "z3c.davapp.zopeappfile-1.0b.tar.gz", "has_sig": false, "md5_digest": "59f9eac3017ed7f2d09261b147f8b55b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3835, "upload_time": "2007-07-07T20:09:23", "url": "https://files.pythonhosted.org/packages/9e/66/164cb4b03d63d3fe4234fd0ce5ca4a6c442c79f7194fbafcd85fc8e5f901/z3c.davapp.zopeappfile-1.0b.tar.gz" } ], "1.0b1": [ { "comment_text": "", "digests": { "md5": "d485cc18881bdbbb7fd5ee6f3936dee3", "sha256": "41e2cef0c20715bb5c5b6a6808cb30fa58133b87f6f85a67f02bd0a273b6b7e7" }, "downloads": -1, "filename": "z3c.davapp.zopeappfile-1.0b1.tar.gz", "has_sig": false, "md5_digest": "d485cc18881bdbbb7fd5ee6f3936dee3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4825, "upload_time": "2008-02-27T18:26:55", "url": "https://files.pythonhosted.org/packages/dc/ce/0a2430cad5cbb0b02da38148e8e99e35cc81a72c0f76c950fb670e905034/z3c.davapp.zopeappfile-1.0b1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d485cc18881bdbbb7fd5ee6f3936dee3", "sha256": "41e2cef0c20715bb5c5b6a6808cb30fa58133b87f6f85a67f02bd0a273b6b7e7" }, "downloads": -1, "filename": "z3c.davapp.zopeappfile-1.0b1.tar.gz", "has_sig": false, "md5_digest": "d485cc18881bdbbb7fd5ee6f3936dee3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4825, "upload_time": "2008-02-27T18:26:55", "url": "https://files.pythonhosted.org/packages/dc/ce/0a2430cad5cbb0b02da38148e8e99e35cc81a72c0f76c950fb670e905034/z3c.davapp.zopeappfile-1.0b1.tar.gz" } ] }