[entropy.client.interfaces.db] make AvailablePackagesRepository.remote_revision() work again (fixes Magneto)

This commit is contained in:
Fabio Erculiani
2011-05-03 18:47:25 +02:00
parent 1d47dfd019
commit 374f19d2c5
2 changed files with 14 additions and 3 deletions

View File

@@ -34,7 +34,8 @@ from entropy.db.exceptions import IntegrityError, OperationalError, Error, \
DatabaseError
from entropy.core.settings.base import SystemSettings
from entropy.services.client import WebService
from entropy.client.services.interfaces import RepositoryWebService
from entropy.client.services.interfaces import RepositoryWebService, \
RepositoryWebServiceFactory
import entropy.tools
@@ -177,7 +178,14 @@ class AvailablePackagesRepositoryUpdater(object):
@property
def _webservices(self):
if self.__webservices is None:
self.__webservices = self._entropy.RepositoryWebServices()
if hasattr(self._entropy, "RepositoryWebServices"):
self.__webservices = self._entropy.RepositoryWebServices()
else:
# in case self._entropy is a simple TextInterface()
# like how it's called in remote_revision().
self.__webservices = RepositoryWebServiceFactory(self._entropy)
# cross fingers!
return self.__webservices
@property

View File

@@ -33,6 +33,7 @@ from entropy.cache import EntropyCacher
from entropy.const import const_debug_write, const_setup_file, etpConst, \
const_convert_to_rawstring, const_isunicode, const_isstring, \
const_convert_to_unicode, const_isstring, const_debug_enabled
from entropy.core.settings.base import SystemSettings
from entropy.exceptions import EntropyException
import entropy.tools
import entropy.dep
@@ -237,6 +238,8 @@ class WebService(object):
def __init__(self, entropy_client, repository_id):
"""
WebService constructor.
NOTE: This base class must NOT use any Entropy Client specific method
and MUST rely on what is provided by it's parent class TextInterface.
@param entropy_client: Entropy Client interface
@type entropy_client: entropy.client.interfaces.client.Client
@@ -313,7 +316,7 @@ class WebService(object):
Get SystemSettings instance
"""
if self.__settings is None:
self.__settings = self._entropy.Settings()
self.__settings = SystemSettings()
return self.__settings
@property