~ubuntu-branches/ubuntu/trusty/desktopcouch/trusty

« back to all changes in this revision

Viewing changes to desktopcouch/records/server.py

  • Committer: Ken VanDine
  • Date: 2010-09-15 13:44:49 UTC
  • mfrom: (1.5.7 upstream)
  • Revision ID: ken.vandine@canonical.com-20100915134449-z85ue5na2h9v40e9
* Add Ubuntu One pairing to desktopcouch, the code looks for
  credentials at start time and will listen to them while the dbus
  service is running.
* On couchdb failure, reconnect with logic that starts up the
  couchdb server again and uses the new port. Instead of giving
  python-couchdb view objects to the user, give an object we own
  that implements reconnecting to the server on errors, and proxies
  commands otherwise. (LP: #522538)
* Support new Basic auth for HTTP that our bookmark file
  requires. Make Basic-auth part of compulsory INI file. (LP:
  #599745)
* When a stored record exists and is marked as deleted, and a user
  tries to store a new record with the same ID, do some ugly work to
  make the user's record be the deleted-record's successor. (LP:
  #462245)
* Removed debian/patches/lp_599745.patch since it was included in
  upstream.
* Fix errors in parameters in new code. (LP: #634396 #634784)

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
    def __init__(self, database, uri=None, record_factory=None, create=False,
50
50
                 server_class=OAuthCapableServer, oauth_tokens=None,
51
51
                 ctx=desktopcouch.local_files.DEFAULT_CONTEXT):
52
 
        if not uri:
53
 
            port = desktopcouch.find_port(ctx=ctx)
54
 
            uri = "http://localhost:%s" % port
 
52
        self.ctx = ctx
 
53
        self.server_uri = uri
55
54
        super(CouchDatabase, self).__init__(
56
55
                database, uri, record_factory=record_factory, create=create,
57
56
                server_class=server_class, oauth_tokens=oauth_tokens, ctx=ctx)
 
57
 
 
58
    def _reconnect(self):
 
59
        if not self.server_uri:
 
60
            port = desktopcouch.find_port(ctx=self.ctx)
 
61
            uri = "http://localhost:%s" % port
 
62
        else:
 
63
            uri = self.server_uri
 
64
        super(CouchDatabase, self)._reconnect(uri=uri)
 
65