~ubuntu-branches/debian/sid/openchange/sid

« back to all changes in this revision

Viewing changes to python/openchange/urlutils.py

  • Committer: Package Import Robot
  • Author(s): Jelmer Vernooij
  • Date: 2012-04-12 20:07:57 UTC
  • mfrom: (11 sid)
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: package-import@ubuntu.com-20120412200757-k933d9trljmxj1l4
Tags: 1:1.0-4
* openchangeserver: Add dependency on openchangeproxy.
* Rebuild against newer version of Samba 4.
* Use dpkg-buildflags.
* Migrate to Git, update Vcs-Git header.
* Switch to debhelper 9.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
import os
23
23
 
24
 
 
25
 
class UnsupportedMapistoreBackend(Exception):
26
 
    
27
 
    def __init__(self, backend):
28
 
        super(UnsupportedMapistoreBackend, self).__init__("unsupported mapistore backend type: %s" % backend)
29
 
 
30
 
 
31
24
def openchangedb_url(lp):
32
25
    return os.path.join(lp.get("private dir"), "openchange.ldb")
33
 
 
34
 
 
35
 
def openchangedb_mapistore_dir(lp):
36
 
    return os.path.join(lp.get("private dir"), "mapistore")
37
 
 
38
 
 
39
 
def openchangedb_mapistore_url(lp, backend):
40
 
    if backend in ("fsocpf", None):
41
 
        return "fsocpf://%s" % openchangedb_mapistore_dir(lp)
42
 
    elif backend == "sqlite":
43
 
        return "sqlite://%s" % openchangedb_mapistore_dir(lp)
44
 
    raise UnsupportedMapistoreBackend(backend)
45
 
 
46
 
 
47
 
def openchangedb_mapistore_url_split(url):
48
 
    if url.startswith("fsocpf://"):
49
 
        return url.partition("fsocpf://")[1:]
50
 
    if url.startswith("sqlite://"):
51
 
        return url.partition("sqlite://")[1:]
52
 
 
53
 
 
54
 
def openchangedb_suffix_for_mapistore_url(url):
55
 
    if (url.startswith("fsocpf://")):
56
 
        return ""
57
 
    if (url.startswith("sqlite://")):
58
 
        return ".db"
59
 
    return ""