diff options
| author | nch@tinyerp.com <> | 2009-12-08 09:45:17 +0530 |
|---|---|---|
| committer | nch@tinyerp.com <> | 2009-12-08 09:45:17 +0530 |
| commit | 3f9ed76869c572b42641e4e22e5435bb10fa5e46 (patch) | |
| tree | d957a2fe852c383a7c22148ccc15c20aff028d67 /addons/document_webdav/DAV/errors.py | |
| parent | d7a580e0bf1d031f3daa0bf657055ec50e307cfd (diff) | |
| parent | b1eb90aa06b4c74dd623f50f716b936a3b33a09a (diff) | |
[MERGE]
bzr revid: nch@tinyerp.com-20091208041517-n8932hvnsprkcme8
Diffstat (limited to 'addons/document_webdav/DAV/errors.py')
| -rwxr-xr-x | addons/document_webdav/DAV/errors.py | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/addons/document_webdav/DAV/errors.py b/addons/document_webdav/DAV/errors.py new file mode 100755 index 00000000000..9c0e7667913 --- /dev/null +++ b/addons/document_webdav/DAV/errors.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +""" + + Exceptions for the DAVserver implementation + +""" + +class DAV_Error(Exception): + """ in general we can have the following arguments: + + 1. the error code + 2. the error result element, e.g. a <multistatus> element + """ + + def __init__(self,*args): + if len(args)==1: + self.args=(args[0],"") + else: + self.args=args + +class DAV_Secret(DAV_Error): + """ the user is not allowed to know anything about it + + returning this for a property value means to exclude it + from the response xml element. + """ + + def __init__(self): + DAV_Error.__init__(self,0) + pass + +class DAV_NotFound(DAV_Error): + """ a requested property was not found for a resource """ + + def __init__(self,*args): + if len(args): + if isinstance(args[0],list): + stre = "Path %s not found!"%('/'.join(args[0])) + else: + stre = args[0] + DAV_Error.__init__(self,404,stre) + else: + DAV_Error.__init__(self,404) + + pass + +class DAV_Forbidden(DAV_Error): + """ a method on a resource is not allowed """ + + def __init__(self,*args): + if len(args): + DAV_Error.__init__(self,403,args[0]) + else: + DAV_Error.__init__(self,403) + pass + |
