Exemplo n.º 1
0
def index(request):
    config = cspace_django_site.getConfig()
    appList = [app for app in settings.INSTALLED_APPS if not "django" in app and not app in hiddenApps]
    
    if not request.user.is_authenticated():
        appList = [app for app in appList if not app in loginRequiredApps]
    
    appList.sort()
    return render(request, 'listApps.html', {'appList': appList, 'labels': 'name file'.split(' '), 'apptitle': TITLE, 'hostname': hostname, 'base': settings.WSGI_BASE})
Exemplo n.º 2
0
def index(request):
    config = cspace_django_site.getConfig()
    appList = [app for app in settings.INSTALLED_APPS if not "django" in app and not app in hiddenApps]
    
    if not request.user.is_authenticated():
        appList = [app for app in appList if not app in loginRequiredApps]
    
    appList.sort()
    return render(request, 'listApps.html', {'appList': appList, 'labels': 'name file'.split(' '), 'title': TITLE, 'hostname': hostname, 'base': settings.WSGI_BASE})
Exemplo n.º 3
0
def handle_request(request, targetUrl):
    """
        This method opens a connection to the configured CollectionSpace services instance and performs
        an authenticated GET request on the targetUrl.  It returns the result from the services to the original
        requester.
    :param request: The incoming request
    :param targetUrl: The URL of the resource to fetch
    :return: :raise:
    """
    config = cspace_django_site.getConfig()
    connection = cspace.connection.create_connection(config, request.user)
    (targetUrl, data, statusCode) = connection.make_get_request(targetUrl)

    if statusCode == 200:
        result = HttpResponse(data, mimetype='application/xml')
    elif statusCode == 404:
        raise Http404
    elif statusCode == 401:
        logout(request)
        result = redirect(cspace.LOGIN_URL_REDIRECT % request.path)
    else:
        result = HttpResponse("HTTP request error: %d." % statusCode)

    return result
Exemplo n.º 4
0
__author__ = 'jblowe'

from django.shortcuts import render, HttpResponse
import json
from django.conf import settings
from os import path
import time

from cspace_django_site.main import cspace_django_site
from common import cspace
from common import appconfig
from common.utils import devicetype

config = cspace_django_site.getConfig()
hostname = cspace.getConfigOptionWithSection(config,
                                             cspace.CONFIGSECTION_AUTHN_CONNECT,
                                             cspace.CSPACE_HOSTNAME_PROPERTY)

TITLE = 'Applications Available'

landingConfig = cspace.getConfig(path.join(settings.BASE_PARENT_DIR, 'config'), 'landing')
hiddenApps = landingConfig.get('landing', 'hiddenApps').split(',')
publicApps = landingConfig.get('landing', 'publicApps').split(',')


def getapplist(request):
    appList = [app for app in settings.INSTALLED_APPS if not "django" in app and not app in hiddenApps]

    appList.sort()
    appList = [(app,path.join(settings.WSGI_BASE, app)) for app in appList]
    return appList
Exemplo n.º 5
0
            import cElementTree as etree

            print("running with cElementTree")
        except ImportError:
            try:
                # normal ElementTree install
                import elementtree.ElementTree as etree

                print("running with ElementTree")
            except ImportError:
                print("Failed to import ElementTree from any known place")

from common import cspace
from cspace_django_site.main import cspace_django_site

config = cspace_django_site.getConfig()

@login_required()
def taxoneditor(request):

    resolutionservice = ''
    formfield = 'determination'
    timestamp = 'timestamp'
    version = 'version'
    results = None
    sources = []
    kw = ''

    if request.method == 'POST':
        messages = create_taxon(request)
        kw = request.GET[formfield]
Exemplo n.º 6
0
def get_item(request, service, item_csid):
    config = cspace_django_site.getConfig()
    connection = cspace.connection.create_connection(config, request.user)
    (url, data, statusCode) = connection.make_get_request('cspace-services/%s/%s' % (service,item_csid))
    return HttpResponse(data, mimetype='application/xml')
Exemplo n.º 7
0
import json
import codecs
import time
import datetime
import csv

from dirq.QueueSimple import QueueSimple

from toolbox.cswaHelpers import *
from common import cspace
from common.utils import deURN

from cspace_django_site.main import cspace_django_site

MAINCONFIG = cspace_django_site.getConfig()

DIRQ = QueueSimple('/tmp/cswa')

MAXLOCATIONS = 1000

import xml.etree.ElementTree as etree


def getWhen2Post(config):

    try:
        when2post = config.get('info', 'when2post')
    except:
        # default is update immediately
        when2post = 'update'
Exemplo n.º 8
0
def post_item(request, service, item_csid):
    config = cspace_django_site.getConfig()
    connection = cspace.connection.create_connection(config, request.user)
    (url, data, statusCode) = connection.make_get_request(
        'cspace-services/%s/%s' % (service, item_csid))
    return HttpResponse(data, content_type='application/xml')
Exemplo n.º 9
0
def get_list(request, service):
    config = cspace_django_site.getConfig()
    connection = cspace.connection.create_connection(config, request.user)
    (url, data,
     statusCode) = connection.make_get_request('cspace-services/%s' % service)
    return HttpResponse(data, mimetype='application/xml')
Exemplo n.º 10
0
def index(request):
    config = cspace_django_site.getConfig()
    appList = [app for app in settings.INSTALLED_APPS if not "django" in app and not app in hiddenApps]
    appList.sort()
    return render(request, 'listApps.html', {'appList': appList, 'labels': 'name file'.split(' '), 'title': TITLE, 'hostname': hostname})
Exemplo n.º 11
0
def get_list(request, service):
    config = cspace_django_site.getConfig()
    connection = cspace.connection.create_connection(config, request.user)
    (url, data, statusCode) = connection.make_get_request('cspace-services/%s' % service)
    return HttpResponse(data, content_type='application/xml')