From 25cca13779f69bdd665b37e6ce9296540be823e3 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Mon, 17 Aug 2015 14:25:35 -0300 Subject: [refactor] removing getters and setters from couch.py This is not needed, the behavior under them is the same as an assignment. --- common/src/leap/soledad/common/couch.py | 43 +++------------------------------ 1 file changed, 4 insertions(+), 39 deletions(-) diff --git a/common/src/leap/soledad/common/couch.py b/common/src/leap/soledad/common/couch.py index d61eac51..96e00fa2 100644 --- a/common/src/leap/soledad/common/couch.py +++ b/common/src/leap/soledad/common/couch.py @@ -104,9 +104,9 @@ class CouchDocument(SoledadDocument): :type syncable: bool """ SoledadDocument.__init__(self, doc_id, rev, json, has_conflicts) - self._couch_rev = None + self.couch_rev = None self._conflicts = None - self._transactions = None + self.transactions = None def _ensure_fetch_conflicts(self, get_conflicts_fun): """ @@ -167,22 +167,6 @@ class CouchDocument(SoledadDocument): self._conflicts) self.has_conflicts = len(self._conflicts) > 0 - def _get_couch_rev(self): - return self._couch_rev - - def _set_couch_rev(self, rev): - self._couch_rev = rev - - couch_rev = property(_get_couch_rev, _set_couch_rev) - - def _get_transactions(self): - return self._transactions - - def _set_transactions(self, rev): - self._transactions = rev - - transactions = property(_get_transactions, _set_transactions) - # monkey-patch the u1db http app to use CouchDocument http_app.Document = CouchDocument @@ -1563,7 +1547,7 @@ class CouchServerState(ServerState): :param couch_url: The URL for the couch database. :type couch_url: str """ - self._couch_url = couch_url + self.couch_url = couch_url def open_database(self, dbname): """ @@ -1576,7 +1560,7 @@ class CouchServerState(ServerState): :rtype: CouchDatabase """ return CouchDatabase( - self._couch_url, + self.couch_url, dbname, ensure_ddocs=False) @@ -1610,22 +1594,3 @@ class CouchServerState(ServerState): delete databases. """ raise Unauthorized() - - def _set_couch_url(self, url): - """ - Set the couchdb URL - - :param url: CouchDB URL - :type url: str - """ - self._couch_url = url - - def _get_couch_url(self): - """ - Return CouchDB URL - - :rtype: str - """ - return self._couch_url - - couch_url = property(_get_couch_url, _set_couch_url, doc='CouchDB URL') -- cgit v1.2.3