Exemplo n.º 1
0
 def __init__(self, db, mirror, user_id=None, password=None, uploader=None,
              soap_client=None):
     self._db = db
     self.mirror = mirror
     if self.mirror:
         self.scaler = ImageScaler(db, [self.mirror], uploader=uploader)
     else:
         self.scaler = None
     integration = Configuration.integration("Content Cafe")
     self.user_id = user_id or integration['username']
     self.password = password or integration['password']
     self.log = logging.getLogger("Content Cafe API")
     self.soap_client = (
         soap_client or ContentCafeSOAPClient(self.user_id, self.password)
     )
    get_one_or_create,
    production_session,
)

log = logging.getLogger(name="Metadata Wrangler configuration import")


def log_import(integration_or_setting):
    log.info("CREATED: %r" % integration_or_setting)


_db = production_session()
try:
    Configuration.load()

    shadowcat_conf = Configuration.integration('Shadowcat')
    if shadowcat_conf and shadowcat_conf.get('url'):
        shadowcat = EI(name=EI.NYPL_SHADOWCAT,
                       protocol=EI.NYPL_SHADOWCAT,
                       goal=EI.METADATA_GOAL)
        _db.add(shadowcat)
        shadowcat.url = shadowcat_conf.get('url')
        log_import(shadowcat)

    content_cafe_conf = Configuration.integration('Content Cafe')
    if content_cafe_conf:
        content_cafe = EI(name=EI.CONTENT_CAFE,
                          protocol=EI.CONTENT_CAFE,
                          goal=EI.METADATA_GOAL)
        _db.add(content_cafe)
Exemplo n.º 3
0
 def values(cls):
     config = Configuration.integration(Configuration.NOVELIST_INTEGRATION)
     profile = config.get(Configuration.NOVELIST_PROFILE)
     password = config.get(Configuration.NOVELIST_PASSWORD)
     return (profile, password)
Exemplo n.º 4
0
 def from_config(cls, _db):
     config = Configuration.integration(Configuration.NOVELIST_INTEGRATION)
     profile, password = cls.values()
     if not (profile and password):
         raise ValueError("No NoveList client configured.")
     return cls(_db, profile, password)
Exemplo n.º 5
0
 def values(cls):
     config = Configuration.integration(Configuration.NOVELIST_INTEGRATION)
     profile = config.get(Configuration.NOVELIST_PROFILE)
     password = config.get(Configuration.NOVELIST_PASSWORD)
     return (profile, password)
Exemplo n.º 6
0
 def from_config(cls, _db):
     config = Configuration.integration(Configuration.NOVELIST_INTEGRATION)
     profile, password = cls.values()
     if not (profile and password):
         raise ValueError("No NoveList client configured.")
     return cls(_db, profile, password)
    ExternalIntegration as EI,
    get_one_or_create,
    production_session,
)

log = logging.getLogger(name="Metadata Wrangler configuration import")

def log_import(integration_or_setting):
    log.info("CREATED: %r" % integration_or_setting)


_db = production_session()
try:
    Configuration.load()

    shadowcat_conf = Configuration.integration('Shadowcat')
    if shadowcat_conf and shadowcat_conf.get('url'):
        shadowcat = EI(
            name=EI.NYPL_SHADOWCAT,
            protocol=EI.NYPL_SHADOWCAT,
            goal=EI.METADATA_GOAL
        )
        _db.add(shadowcat)
        shadowcat.url = shadowcat_conf.get('url')
        log_import(shadowcat)

    content_cafe_conf = Configuration.integration('Content Cafe')
    if content_cafe_conf:
        content_cafe = EI(
            name=EI.CONTENT_CAFE,
            protocol=EI.CONTENT_CAFE,