当前位置: 首页>>代码示例>>Python>>正文


Python config.CFG_SITE_URL类代码示例

本文整理汇总了Python中invenio.config.CFG_SITE_URL的典型用法代码示例。如果您正苦于以下问题:Python CFG_SITE_URL类的具体用法?Python CFG_SITE_URL怎么用?Python CFG_SITE_URL使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CFG_SITE_URL类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: guess_collection_of_a_record

def guess_collection_of_a_record(recID, referer=None, recreate_cache_if_needed=True):
    """Return collection name a record recid belongs to, by first testing
       the referer URL if provided and otherwise returning the
       primary collection."""
    if referer:
        dummy, hostname, path, dummy, query, dummy = urlparse.urlparse(referer)
        # requests can come from different invenio installations, with
        # different collections
        if CFG_SITE_URL.find(hostname) < 0:
            return guess_primary_collection_of_a_record(recID)
        g = _re_collection_url.match(path)
        if g:
            name = urllib.unquote_plus(g.group(1))
            # check if this collection actually exist (also normalize the name
            # if case-insensitive)
            name = Collection.query.filter_by(name=name).value('name')
            if name and recID in get_collection_reclist(name):
                return name
        elif path.startswith('/search'):
            if recreate_cache_if_needed:
                collection_reclist_cache.recreate_cache_if_needed()
            query = cgi.parse_qs(query)
            for name in query.get('cc', []) + query.get('c', []):
                name = Collection.query.filter_by(name=name).value('name')
                if name and recID in get_collection_reclist(name, recreate_cache_if_needed=False):
                    return name
    return guess_primary_collection_of_a_record(recID)
开发者ID:SamiHiltunen,项目名称:invenio,代码行数:27,代码来源:__init__.py

示例2: check_wsgiref_testing_feasability

def check_wsgiref_testing_feasability():
    """
    In order to use wsgiref for running Invenio, CFG_SITE_URL and
    CFG_SITE_SECURE_URL must not use HTTPS because SSL is not supported.
    """
    if CFG_SITE_URL.lower().startswith('https'):
        print >> sys.stderr, """
ERROR: SSL is not supported by the wsgiref simple server implementation.
Please set CFG_SITE_URL not to start with "https".
Currently CFG_SITE_URL is set to: "%s".""" % CFG_SITE_URL
        sys.exit(1)
    if CFG_SITE_SECURE_URL.lower().startswith('https'):
        print >> sys.stderr, """
ERROR: SSL is not supported by the wsgiref simple server implementation.
Please set CFG_SITE_SECURE_URL not to start with "https".
Currently CFG_SITE_SECURE_URL is set to: "%s".""" % CFG_SITE_SECURE_URL
        sys.exit(1)
开发者ID:aw-bib,项目名称:tind-invenio,代码行数:17,代码来源:webinterface_handler_wsgi.py

示例3: tmpl_pageheader


#.........这里部分代码省略.........
            # substring found --> offer trackback link in header
            if recordIndexInURI != -1:
                recid = uri[recordIndexInURI:len(uri)].split('/')[2].split("?")[0] #recid might end with ? for journal records
                headerLinkbackTrackbackLink = get_trackback_auto_discovery_tag(recid)

        if CFG_WEBSTYLE_INSPECT_TEMPLATES:
            inspect_templates_message = '''
<table width="100%%" cellspacing="0" cellpadding="2" border="0">
<tr bgcolor="#aa0000">
<td width="100%%">
<font color="#ffffff">
<strong>
<small>
CFG_WEBSTYLE_INSPECT_TEMPLATES debugging mode is enabled.  Please
hover your mouse pointer over any region on the page to see which
template function generated it.
</small>
</strong>
</font>
</td>
</tr>
</table>
'''
        else:
            inspect_templates_message = ""

        sitename = CFG_SITE_NAME_INTL.get(ln, CFG_SITE_NAME)
        if headertitle == sitename:
            pageheadertitle = headertitle
        else:
            pageheadertitle = headertitle + ' - ' + sitename

        metabase = ""
        stripped_url = CFG_SITE_URL.replace("://", "")
        if not CFG_BASE_URL and '/' in stripped_url:
            metabase = "<base href='%s'>" % (CFG_SITE_URL,)

        out = """\
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="%(ln_iso_639_a)s" xml:lang="%(ln_iso_639_a)s" xmlns:og="http://opengraphprotocol.org/schema/" >
<head>
 <title>%(pageheadertitle)s</title>
 %(metabase)s
 <link rev="made" href="mailto:%(sitesupportemail)s" />
 <link rel="stylesheet" href="%(cssurl)s/img/invenio%(cssskin)s.css" type="text/css" />
 <!--[if lt IE 8]>
    <link rel="stylesheet" type="text/css" href="%(cssurl)s/img/invenio%(cssskin)s-ie7.css" />
 <![endif]-->
 <!--[if gt IE 8]>
    <style type="text/css">div.restrictedflag {filter:none;}</style>
 <![endif]-->
 %(canonical_and_alternate_urls)s
 <!-- <link rel="alternate" type="application/rss+xml" title="%(sitename)s RSS" href="%(rssurl)s" /> -->
 <link rel="search" type="application/opensearchdescription+xml" href="%(siteurl)s/opensearchdescription" title="%(sitename)s" />
 <link rel="unapi-server" type="application/xml" title="unAPI" href="%(unAPIurl)s" />
 <link rel="icon" href="/img/favicon.ico" type="image/x-icon">
 <link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon">
 %(linkbackTrackbackLink)s
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <meta http-equiv="Content-Language" content="%(ln)s" />
 <meta name="description" content="%(description)s" />
 <meta name="keywords" content="%(keywords)s" />
 <meta name="google-site-verification" content="mLqufkdPNxUHXFW4obCfN5NJXr4sD_SlnvsOla7RZAE" />
 <meta name="msvalidate.01" content="EA9805F0F62E4FF22B98853713964B28" />
 <script type="text/javascript" src="%(cssurl)s/js/jquery.min.js"></script>
开发者ID:mvesper,项目名称:scoap3,代码行数:67,代码来源:webstyle_templates_scoap3.py

示例4:

from invenio.config import CFG_SITE_URL, CFG_SITE_SECURE_URL, CFG_TMPDIR, \
    CFG_SITE_RECORD, CFG_ACCESS_CONTROL_LEVEL_SITE
from invenio.messages import wash_language
from invenio.urlutils import redirect_to_url
from invenio.errorlib import register_exception
from invenio.webuser import get_preferred_user_language, isGuestUser, \
    getUid, isUserSuperAdmin, collect_user_info
from invenio.webinterface_handler_wsgi_utils import StringField
from invenio.session import get_session

## The following variable is True if the installation make any difference
## between HTTP Vs. HTTPS connections.
CFG_HAS_HTTPS_SUPPORT = CFG_SITE_SECURE_URL.startswith("https://")

## The following variable is True if HTTPS is used for *any* URL.
CFG_FULL_HTTPS = CFG_SITE_URL.lower().startswith("https://")


## Set this to True in order to log some more information.
DEBUG = False

# List of URIs for which the 'ln' argument must not be added
# automatically
CFG_NO_LANG_RECOGNITION_URIS = ['/rss',
                                '/oai2d',
                                '/journal']


RE_SLASHES = re.compile('/+')
RE_SPECIAL_URI = re.compile('^/%s/\d+|^/collection/.+' % CFG_SITE_RECORD)
开发者ID:Kennethhole,项目名称:Invenio-1,代码行数:30,代码来源:webinterface_handler.py


注:本文中的invenio.config.CFG_SITE_URL类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。