Changeset 8536 for mauRepo


Ignore:
Timestamp:
17/08/12 13:25:49 (7 years ago)
Author:
mnagni
Message:

Incomplete - # 22528: Migration of FAtCat Open Search link for HPFeld
 http://team.ceda.ac.uk/trac/ceda/ticket/22528

Fixes the JSONEncoding problem and the version display

Location:
mauRepo/MolesManager/trunk/cedaMoles/MolesManager
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/MolesManager/trunk/cedaMoles/MolesManager/__init__.py

    r7970 r8536  
     1import os 
     2def get_application_root_url(request): 
     3    """ 
     4        Returns a string reflecting the full URL relative to the actual deployment. 
     5        Looks inside the os.environ dict a key named 'CEDA_MOLES_ROOT_URL'. 
     6        If not found assumes the root path is '/' 
     7         
     8        **PARAMETERS"" 
     9         * `HTTPRequest` **request**: 
     10             a django.HttpRequest  
     11    """ 
     12    root_url = '' 
     13    if os.environ.has_key('CEDA_MOLES_ROOT_URL') \ 
     14            and len(os.environ['CEDA_MOLES_ROOT_URL'].strip()) > 0: 
     15        root_url = os.environ['CEDA_MOLES_ROOT_URL'] 
     16        return 'http://%s/%s/' %  (request.get_host(), root_url) 
     17     
     18    return 'http://%s/' %  (request.get_host()) 
  • mauRepo/MolesManager/trunk/cedaMoles/MolesManager/djencoder.py

    r8482 r8536  
    2020         
    2121 
    22     def default(self, obj): 
    23         if obj is not None and id(obj) in self.__markers: 
    24             return 
    25          
     22    def default(self, obj):        
    2623        # Convert objects to a dictionary of their representation 
    2724        d = { '__module__':obj.__module__, 
     
    5350                #return {} 
    5451            else: 
     52                self.__markers[id(value)] = value 
    5553                if isinstance(value, str) or isinstance(value, unicode):                     
    5654                    self.__markers[id(value)] = escapeForJSON(value) 
  • mauRepo/MolesManager/trunk/cedaMoles/MolesManager/molesSessionMiddleware.py

    r8517 r8536  
    6363    _migrationEPBFactory = None 
    6464     
    65     version = None 
    66      
    6765    def _doInitialization(self): 
    6866 
     
    8482             
    8583        _migration() 
    86          
    87         MolesSessionMiddleware.version = assemble_version() 
    8884    
    8985    def process_request(self, request):   
     
    133129        raise Exception("Cannot render an empty context") 
    134130     
    135     context['version'] = MolesSessionMiddleware.version 
     131    context['version'] = assemble_version() 
    136132    context.update(csrf(request)) 
    137133    return render_to_response(page_to_render, context)             
  • mauRepo/MolesManager/trunk/cedaMoles/MolesManager/views/cedaObservationView.py

    r8517 r8536  
    6363        print context['coObs']  
    6464         
    65     return mm_render_to_response(request, 'cedaObservation.html', context) 
     65    return mm_render_to_response(request, context, 'cedaObservation.html') 
    6666 
    6767def _getCedaObservation(request, obs_id):     
  • mauRepo/MolesManager/trunk/cedaMoles/MolesManager/views/cedaSearch.py

    r8507 r8536  
    44@author: mnagni 
    55''' 
    6 from django.core.context_processors import csrf 
    7 from django.shortcuts import render_to_response#, redirect 
     6import os 
    87from cedaMoles.MolesManager.ceda_guid import CedaGUID 
    98import cedaObservationView 
    109import cedaObservationCollectionView 
    1110from cedaMoles.MolesManager.molesSessionMiddleware import mm_render_to_response 
     11from django.core.context_processors import csrf 
     12from django.shortcuts import render_to_response 
     13from cedaMoles.MolesManager import get_application_root_url 
    1214 
    1315def getResponseByGuid(request, guid): 
     
    2729     
    2830    list_list = [] 
    29     baseCov = "http://" + request.get_host() + "/" 
     31     
     32    baseCov = get_application_root_url(request)  
    3033    for guid, o in observations.iteritems(): 
    3134         
Note: See TracChangeset for help on using the changeset viewer.