{ "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.file webdav integration\n============================\n\n >>> import z3c.etree\n >>> import zope.event\n >>> from zope.lifecycleevent import ObjectCreatedEvent\n >>> from zope.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('text/plain', {'charset': 'ascii'})\n >>> fp = f.open('w')\n >>> fp.write('%s\\n' %('x' * 10) * 5)\n >>> fp.close()\n\nEmit the `CreateObjectEvent' to generate lastmodified and created dates.\n\n >>> zope.event.notify(ObjectCreatedEvent(f))\n >>> getRootFolder()['testfile.txt'] = f\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,+ELLIPSIS\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\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.zopefile\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.zopefile", "package_url": "https://pypi.org/project/z3c.davapp.zopefile/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/z3c.davapp.zopefile/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://launchpad.net/z3c.dav" }, "release_url": "https://pypi.org/project/z3c.davapp.zopefile/1.0b1/", "requires_dist": null, "requires_python": null, "summary": "Define the WebDAV data model for the File and Image objects from the\n`zope.file' module.", "version": "1.0b1" }, "last_serial": 802012, "releases": { "1.0b1": [ { "comment_text": "", "digests": { "md5": "36a6ddd749a38ebc78b88307933fd68c", "sha256": "194c583b263b03dbe733ecf60b7768ac9e4826d541039e0adce91db905cc18bf" }, "downloads": -1, "filename": "z3c.davapp.zopefile-1.0b1.tar.gz", "has_sig": false, "md5_digest": "36a6ddd749a38ebc78b88307933fd68c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5910, "upload_time": "2008-02-27T18:38:50", "url": "https://files.pythonhosted.org/packages/46/41/6caa70acc10d4811922a7ba1c72d90b4fe58c51964ba6cd577ea2fc5f74f/z3c.davapp.zopefile-1.0b1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "36a6ddd749a38ebc78b88307933fd68c", "sha256": "194c583b263b03dbe733ecf60b7768ac9e4826d541039e0adce91db905cc18bf" }, "downloads": -1, "filename": "z3c.davapp.zopefile-1.0b1.tar.gz", "has_sig": false, "md5_digest": "36a6ddd749a38ebc78b88307933fd68c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5910, "upload_time": "2008-02-27T18:38:50", "url": "https://files.pythonhosted.org/packages/46/41/6caa70acc10d4811922a7ba1c72d90b4fe58c51964ba6cd577ea2fc5f74f/z3c.davapp.zopefile-1.0b1.tar.gz" } ] }