Changeset 3782


Ignore:
Timestamp:
14/04/08 12:32:44 (12 years ago)
Author:
spascoe
Message:

Added trivial authentication to the plot method

Location:
DPPP/kml/python/csml2kmlpylon
Files:
2 added
10 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • DPPP/kml/python/csml2kmlpylon/csml2kmlpylon.egg-info/SOURCES.txt

    r3718 r3782  
    11MANIFEST.in 
    22README.txt 
     3deploy.ini 
    34development.ini 
    45setup.cfg 
     
    67test.ini 
    78csml2kmlpylon/__init__.py 
     9csml2kmlpylon/__init__.pyc 
    810csml2kmlpylon/websetup.py 
    911csml2kmlpylon.egg-info/PKG-INFO 
     
    1618csml2kmlpylon.egg-info/top_level.txt 
    1719csml2kmlpylon/config/__init__.py 
     20csml2kmlpylon/config/__init__.pyc 
     21csml2kmlpylon/config/csml2kmlpylon.conf.xml 
    1822csml2kmlpylon/config/environment.py 
     23csml2kmlpylon/config/environment.pyc 
    1924csml2kmlpylon/config/middleware.py 
     25csml2kmlpylon/config/middleware.pyc 
    2026csml2kmlpylon/config/routing.py 
     27csml2kmlpylon/config/routing.pyc 
    2128csml2kmlpylon/controllers/__init__.py 
     29csml2kmlpylon/controllers/__init__.pyc 
    2230csml2kmlpylon/controllers/csmlGrapher.py 
     31csml2kmlpylon/controllers/csmlGrapher.pyc 
    2332csml2kmlpylon/controllers/error.py 
    2433csml2kmlpylon/controllers/template.py 
    2534csml2kmlpylon/lib/__init__.py 
     35csml2kmlpylon/lib/__init__.pyc 
    2636csml2kmlpylon/lib/app_globals.py 
     37csml2kmlpylon/lib/app_globals.pyc 
    2738csml2kmlpylon/lib/base.py 
    2839csml2kmlpylon/lib/helpers.py 
     40csml2kmlpylon/lib/helpers.pyc 
    2941csml2kmlpylon/model/__init__.py 
    30 csml2kmlpylon/public/ceh_ecn.kml 
    3142csml2kmlpylon/public/index.html 
    32 csml2kmlpylon/public/midas_stations.kmz 
    3343csml2kmlpylon/tests/__init__.py 
    3444csml2kmlpylon/tests/test_models.py 
    3545csml2kmlpylon/tests/functional/__init__.py 
     46docs/index.txt 
  • DPPP/kml/python/csml2kmlpylon/csml2kmlpylon/config/csml2kmlpylon.conf.xml

    r3713 r3782  
    22  <DisplayIntervalStart>2006-6-1</DisplayIntervalStart> 
    33  <DisplayIntervalEnd>2006-7-1</DisplayIntervalEnd> 
    4   <ServedFromURL>http://superglue.badc.rl.ac.uk:8084/csmlGrapher</ServedFromURL> 
     4  <ServedFromURL>http://spellbound:8084/csmlGrapher</ServedFromURL> 
    55  <Dataset id="midas" name="MIDAS"> 
    66    <GeoServerURL>http://bond.badc.rl.ac.uk:8084/geoserver/wfs</GeoServerURL> 
  • DPPP/kml/python/csml2kmlpylon/csml2kmlpylon/config/middleware.py

    r3633 r3782  
    1212 
    1313from csml2kmlpylon.config.environment import load_environment 
     14 
     15import authkit.authenticate 
    1416 
    1517def make_app(global_conf, full_stack=True, **app_conf): 
     
    4042 
    4143    if asbool(full_stack): 
     44        # Do authentication 
     45        app = authkit.authenticate.middleware(app, app_conf) 
     46 
    4247        # Handle Python exceptions 
    4348        app = ErrorHandler(app, global_conf, error_template=error_template, 
     
    5055        # app = ErrorDocuments(app, global_conf, mapper=error_mapper, **app_conf) 
    5156 
     57 
    5258    # Establish the Registry for this application 
    5359    app = RegistryManager(app) 
  • DPPP/kml/python/csml2kmlpylon/csml2kmlpylon/controllers/csmlGrapher.py

    r3727 r3782  
    2020from string import lower 
    2121 
     22# Security 
     23from authkit.pylons_adaptors import authorize 
     24from authkit.permissions import RemoteUser, ValidAuthKitUser 
     25 
    2226log = logging.getLogger(__name__) 
    2327 
     
    2529 
    2630    class Dataset: 
    27         ''' 
     31        """ 
    2832        An auxiliary storage class describing a dataset of csml2kml.Station's; 
    2933        this describes what URL the data is I{retrievable} from, as opposed to this class actually storing any data. 
    3034        E.g. MIDAS and ECN are different datasets (each has a WFS URL from which it is being accessible). 
    31         ''' 
     35        """ 
    3236        def __init__(self, id, name, geoServerUrl, datetimeQueryFormat, isCsmlLinkVisible): 
    3337            self.id = id 
     
    3842 
    3943    def __call__(self, environ, start_response): 
    40         ''' 
     44        """ 
    4145        Initialise the web service by overriding a method that always gets called upon controller construction. 
    4246        More specifically, read in the config file. 
    43         ''' 
     47        """ 
    4448 
    4549        # The name of the config file is set in the server's "development.ini" file. 
     
    7579 
    7680    def _datetimeTo1Jan1970(self, datetime): 
    77         ''' 
     81        """ 
    7882        Convert datetime to format a'la C{1-JAN-1970}. 
    7983        @param datetime: The datetime to be converted. 
     
    8185        @return: A string like "1-JAN-1970" or "31-MAR-2008". 
    8286        @rtype: C{str} 
    83         ''' 
     87        """ 
    8488        # Use format e.g. "1-JAN-1970" or "31-MAR-2008". 
    8589        monthCodes = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'] 
     
    163167        return csmlPointSeriesFeature 
    164168 
     169    @authorize(ValidAuthKitUser()) 
    165170    def plot(self): 
    166171        ''' 
     
    270275 
    271276        def _set_response(tempFile): 
    272             ''' 
     277            """ 
    273278            Set the service's response to an image, containing image read from a temporary location. 
    274279            @param tempFile: An object representing a temporary file 
    275280            @type tempFile: C{tempfile.NamedTemporaryFile} 
    276             ''' 
     281            """ 
    277282            img = Image.open(tempFile.name) 
    278283            buf = StringIO() 
     
    306311            tempFile = _plot_feature(csmlPointSeriesFeature, dataset)    # plot the feature into a temporary file 
    307312            _set_response(tempFile)                                      # set the response as an image containing the plot 
     313            print '*** %s' % response.content_type 
    308314        finally: 
    309315            try: 
  • DPPP/kml/python/csml2kmlpylon/deploy.ini

    r3757 r3782  
    2222beaker.session.key = csml2kmlpylon 
    2323beaker.session.secret = somesecret 
     24authkit.setup.method = form, cookie 
     25authkit.form.authenticate.user.data = visitor:open_sesame 
     26authkit.cookie.secret = multiproceduralwikimashing 
    2427 
    2528# The following is the location of the config file that is used to setup the csmlGrapher service 
  • DPPP/kml/python/csml2kmlpylon/development.ini

    r3718 r3782  
    2222beaker.session.key = csml2kmlpylon 
    2323beaker.session.secret = somesecret 
     24authkit.setup.method = form, cookie 
     25authkit.form.authenticate.user.data = visitor:open_sesame 
     26authkit.cookie.secret = multiproceduralwikimashing 
    2427 
    2528# The following is the location of the config file that is used to setup the csmlGrapher service 
Note: See TracChangeset for help on using the changeset viewer.