| 1 |
|
| 2 |
OVERVIEW |
| 3 |
-------- |
| 4 |
|
| 5 |
Here is a little overview of the package: |
| 6 |
|
| 7 |
A. In the pywebdav/lib/ package: |
| 8 |
|
| 9 |
1. AuthHTTPServer |
| 10 |
This works on top of either the BasicHTTPServer or the |
| 11 |
BufferingHTTPServer and implements basic authentication. |
| 12 |
|
| 13 |
2. WebDAVServer |
| 14 |
This server uses AuthHTTPServer for the base functionality. It also uses |
| 15 |
a dav interface class for interfacing with the actual data storage (e.g. |
| 16 |
a filesystem or a database). |
| 17 |
|
| 18 |
B. In the pywebdav/server/ directory: |
| 19 |
|
| 20 |
1. server.py |
| 21 |
Main file for server. Serves as a start point for the WebDAV server |
| 22 |
|
| 23 |
2. fshandler.py |
| 24 |
Backend for the DAV server. Makes him serving content from the filesystem. |
| 25 |
Have a deeper look at it if you want to implement backends to other data sources |
| 26 |
|
| 27 |
3. fileauth.py |
| 28 |
Handler for authentication. Nothing very special about it. |
| 29 |
|
| 30 |
4. dbconn.py |
| 31 |
Mysql Database Handler. |
| 32 |
|
| 33 |
5. INI_Parse.py |
| 34 |
Parses the config.ini file. |
| 35 |
|
| 36 |
6. config.ini |
| 37 |
PyWebDav configuration file. |
| 38 |
|
| 39 |
|
| 40 |
Information |
| 41 |
---------- |
| 42 |
|
| 43 |
This document describes the architecture of the python davserver. |
| 44 |
|
| 45 |
The main programm is stored in pywebdav/lib/WebDAVServer.py. It exports a class |
| 46 |
WebDAVServer which is subclassed from AuthServer. |
| 47 |
|
| 48 |
The AuthServer class implements Basic Authentication in order to make |
| 49 |
connections somewhat more secure. |
| 50 |
|
| 51 |
For processing requests the WebDAVServer class needs some connection to |
| 52 |
the actual data on server. In contrast to a normal web server this |
| 53 |
data must not simply be stored on a filesystem but can also live in |
| 54 |
databases and the like. |
| 55 |
|
| 56 |
Thus the WebDAVServer class needs an interface |
| 57 |
to this data which is implemented via an interface class (in our |
| 58 |
example stored in fshandler.py). This class will be instantiated by the |
| 59 |
WebDAVServer class and be used when needed (e.g. retrieving properties, |
| 60 |
creating new resources, obtaining existing resources etc.). |
| 61 |
|
| 62 |
When it comes to parsing XML (like in the PROPFIND and PROPPATCH |
| 63 |
methods) the WebDAVServer class uses for each method another extra class |
| 64 |
stored e.g. in propfind.py. This class parses the XML body and |
| 65 |
createsan XML response while obtaining data from the interface |
| 66 |
class. Thus all the XML parsing is factored out into the specific |
| 67 |
method classes. |
| 68 |
|
| 69 |
In order to create your own davserver for your own purposes you have to do the |
| 70 |
following: |
| 71 |
|
| 72 |
- subclass the WebDAVServer class and write your own get_userinfo() method for |
| 73 |
identifying users. |
| 74 |
|
| 75 |
- create your own interface class for interfacing with your actual data. |
| 76 |
You might use the existing class as skeleton and explanation of which |
| 77 |
methods are needed. |
| 78 |
|
| 79 |
That should be basically all you need to do. Have a look at |
| 80 |
pywebdav/server/fileauth.py in order to get an example how to subclass |
| 81 |
WebDAVServer. |
| 82 |
|
| 83 |
=== |
| 84 |
* describe the methods which need to be implemented. |