Example #1
0
    def ready(self):
        logging.debug('impl.startup: START')

        try:
            import config
            config.load()

            import ezidapp.models.shoulder
            ezidapp.models.shoulder.loadConfig()
            config.registerReloadListener(ezidapp.models.shoulder.loadConfig)

            import util2
            util2.loadConfig()
            config.registerReloadListener(util2.loadConfig)

            import ui_common
            ui_common.loadConfig()
            config.registerReloadListener(ui_common.loadConfig)
        except Exception:
            # App not ready to be configured yet. This allows running
            # `django-admin migrate` to create the initial databases.
            logging.debug('impl.startup: Early exit: App not ready yet')
            return

        import log
        log.loadConfig()
        config.registerReloadListener(log.loadConfig)

        import backproc
        config.registerReloadListener(backproc.loadConfig)
        backproc.loadConfig()

        import binder_async
        binder_async.loadConfig()
        config.registerReloadListener(binder_async.loadConfig)

        import crossref
        crossref.loadConfig()
        config.registerReloadListener(crossref.loadConfig)

        import datacite
        datacite.loadConfig()
        config.registerReloadListener(datacite.loadConfig)

        import datacite_async
        datacite_async.loadConfig()
        config.registerReloadListener(datacite_async.loadConfig)

        import download
        download.loadConfig()
        config.registerReloadListener(download.loadConfig)

        import ezid
        ezid.loadConfig()
        config.registerReloadListener(ezid.loadConfig)

        import linkcheck_update
        linkcheck_update.loadConfig()
        config.registerReloadListener(linkcheck_update.loadConfig)

        import metadata
        metadata.loadConfig()
        config.registerReloadListener(metadata.loadConfig)

        import newsfeed
        newsfeed.loadConfig()
        config.registerReloadListener(newsfeed.loadConfig)

        import noid_egg
        noid_egg.loadConfig()
        config.registerReloadListener(noid_egg.loadConfig)

        import noid_nog
        noid_nog.loadConfig()
        config.registerReloadListener(noid_nog.loadConfig)

        import oai
        oai.loadConfig()
        config.registerReloadListener(oai.loadConfig)

        import search_util
        search_util.loadConfig()
        config.registerReloadListener(search_util.loadConfig)

        import stats
        stats.loadConfig()
        config.registerReloadListener(stats.loadConfig)

        import status
        status.loadConfig()
        config.registerReloadListener(status.loadConfig)

        logging.debug('impl.startup: END')
Example #2
0
def _loadConfig ():
  global _ezidUrl, _arkTestPrefix, _doiTestPrefix, _defaultArkProfile
  global _defaultDoiProfile, _defaultUuidProfile, _doiResolver, _arkResolver
  global _crossrefTestPrefix
  _ezidUrl = config.get("DEFAULT.ezid_base_url")
  _arkTestPrefix = config.get("shoulders.ark_test")
  _doiTestPrefix = config.get("shoulders.doi_test")
  _crossrefTestPrefix = config.get("shoulders.crossref_test")
  _defaultArkProfile = config.get("DEFAULT.default_ark_profile")
  _defaultDoiProfile = config.get("DEFAULT.default_doi_profile")
  _defaultUuidProfile = config.get("DEFAULT.default_uuid_profile")
  _doiResolver = config.get("resolver.doi")
  _arkResolver = config.get("resolver.ark")

_loadConfig()
config.registerReloadListener(_loadConfig)

def urlForm (identifier):
  """
  Returns the URL form of a qualified identifier, or "[None]" if there
  is no resolver defined for the identifier type.
  """
  if identifier.startswith("doi:"):
    return "%s/%s" % (_doiResolver, urllib.quote(identifier[4:], ":/"))
  elif identifier.startswith("ark:/"):
    return "%s/%s" % (_arkResolver, urllib.quote(identifier, ":/"))
  else:
    return "[None]"

def defaultTargetUrl (identifier):
  """
Example #3
0
def _ensureConfigLoaded():
    if _url is None:
        import config
        _loadConfig(acquireLock=False)
        config.registerReloadListener(_loadConfig)