~openerp-commiter/openobject-addons/extra-6.0

« back to all changes in this revision

Viewing changes to document_webdav_old/webdav/DAV/delete.py

  • Committer: Fabien Pinckaers
  • Date: 2008-12-12 09:09:57 UTC
  • Revision ID: fp@tinyerp.com-20081212090957-cson0n0jove7dt7i
document_webdav

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
"""
 
4
 
 
5
    python davserver
 
6
    Copyright (C) 1999 Christian Scholz (ruebe@aachen.heimat.de)
 
7
 
 
8
    This library is free software; you can redistribute it and/or
 
9
    modify it under the terms of the GNU Library General Public
 
10
    License as published by the Free Software Foundation; either
 
11
    version 2 of the License, or (at your option) any later version.
 
12
 
 
13
    This library is distributed in the hope that it will be useful,
 
14
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
    Library General Public License for more details.
 
17
 
 
18
    You should have received a copy of the GNU Library General Public
 
19
    License along with this library; if not, write to the Free
 
20
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
21
 
 
22
 
 
23
"""
 
24
import os
 
25
import string
 
26
import urllib
 
27
from StringIO import StringIO
 
28
 
 
29
from status import STATUS_CODES
 
30
from utils import gen_estring, quote_uri, make_xmlresponse
 
31
from davcmd import deltree
 
32
 
 
33
class DELETE:
 
34
 
 
35
    def __init__(self,uri,dataclass):
 
36
        self.__dataclass=dataclass
 
37
        self.__uri=uri
 
38
 
 
39
    def delcol(self):
 
40
        """ delete a collection """
 
41
 
 
42
        dc=self.__dataclass
 
43
        result=dc.deltree(self.__uri)
 
44
 
 
45
        if not len(result.items()):
 
46
            return None # everything ok
 
47
 
 
48
        # create the result element
 
49
        return make_xmlresponse(result)
 
50
 
 
51
    def delone(self):
 
52
        """ delete a resource """
 
53
 
 
54
        dc=self.__dataclass
 
55
        result=dc.delone(self.__uri)
 
56
        
 
57
        if not result: return None
 
58
        if not len(result.items()):
 
59
            return None # everything ok
 
60
 
 
61
        # create the result element
 
62
        return make_xmlresponse(result)
 
63