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

« back to all changes in this revision

Viewing changes to document_webdav_old/webdav/DAV/errors.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
    Exceptions for the DAVserver implementation
 
5
 
 
6
"""
 
7
 
 
8
class DAV_Error(Exception):
 
9
    """ in general we can have the following arguments:
 
10
 
 
11
        1. the error code
 
12
        2. the error result element, e.g. a <multistatus> element
 
13
    """
 
14
 
 
15
    def __init__(self,*args):
 
16
        if len(args)==1:
 
17
            self.args=(args[0],"")
 
18
        else:
 
19
            self.args=args
 
20
    
 
21
class DAV_Secret(DAV_Error):
 
22
    """ the user is not allowed to know anything about it
 
23
    
 
24
    returning this for a property value means to exclude it
 
25
    from the response xml element.
 
26
    """
 
27
 
 
28
    def __init__(self):
 
29
        DAV_Error.__init__(self,0)
 
30
        pass
 
31
 
 
32
class DAV_NotFound(DAV_Error):
 
33
    """ a requested property was not found for a resource """
 
34
    
 
35
    def __init__(self,*args):
 
36
        if len(args):
 
37
            DAV_Error.__init__(self,404,args[0])
 
38
        else:
 
39
            DAV_Error.__init__(self,404)
 
40
 
 
41
        pass
 
42
 
 
43
class DAV_Forbidden(DAV_Error):
 
44
    """ a method on a resource is not allowed """
 
45
    
 
46
    def __init__(self,*args):
 
47
        if len(args):
 
48
            DAV_Error.__init__(self,403,args[0])
 
49
        else:
 
50
            DAV_Error.__init__(self,403)
 
51
        pass
 
52