Changeset 4448


Ignore:
Timestamp:
19/11/08 14:14:31 (11 years ago)
Author:
cbyrom
Message:

Additional code to properly handle granulite uploads.

Location:
TI05-delivery/ows_framework/trunk/ows_server/ows_server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/editatom.py

    r4445 r4448  
    9797            else: 
    9898                self.__setup() 
     99                c.atom = Atom() 
    99100        except SystemError, e: 
    100101            return self.__handleError(e) 
     
    105106                self.__processGranuliteFile(file.value) 
    106107            else: 
    107                 self.__processCSMLFile(file.value) 
     108                self.__processCSMLFile(file) 
    108109        except Exception, e: 
    109110            return self.__handleError(e, template='atom_granulator') 
     
    119120 
    120121 
    121  
    122     def __processCSMLFile(self, fileContents): 
     122    def __processCSMLFile(self, file): 
    123123        ''' 
    124124        Accept the contents of a CSML file and extract and add appropriate data 
     
    127127        ''' 
    128128        logging.info("Extracting CSML data") 
    129         c.atom.addCSMLData(fileContents) 
     129        c.atom.addCSMLData(file) 
    130130        logging.info("Finished extracting CSML data") 
    131131     
     
    137137        @param fileContents: contents of the file uploaded 
    138138        ''' 
    139         logging.info("Extracting granulite data") 
    140  
    141              
     139        logging.info("Processing granulite data") 
    142140        # check for uploaded CSML/CDML file data 
    143141        cdmlFile = request.POST.get('upload_cdml') 
    144142        csmlFile = request.POST.get('upload_csml') 
    145         if cdmlFile is not None and csmlFile is not None: 
     143        if cdmlFile and csmlFile: 
    146144            raise ValueError("Cannot specify both CDML and CSML file - please choose a single one to ingest.") 
    147145         
    148146        # NB, we'll be creating the atom in the default local eXist 
    149147        eXistClient = self.__getExistClient('local') 
    150         gran = granulite(fileContents, eXistClient = eXistClient) 
    151          
    152         logging.info("Finished extracting granulite data") 
     148        gran = granulite(fileContents, eXistClient = eXistClient, \ 
     149                         cdmlFile = cdmlFile, csmlFile = csmlFile) 
     150         
     151        logging.info("Finished processing granulite data") 
    153152 
    154153     
     
    571570                atom = self.saveAtomToExist(Atom(**dict(inputs))) 
    572571                 
    573                 h.redirect_to (controller = 'editatom', action='edit', 
     572                h.redirect_to(controller = 'editatom', action='edit', 
    574573                               uri = atom.ndgURI) 
    575574            except Invalid, e: 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/atom_home.html

    r4432 r4448  
    2222                            <a href="${h.url_for(controller='listatom',action='list', searchData=None)}">Edit/List atoms</a> 
    2323                            </h2> 
    24                             <h2> 
    25                 <div py:replace="UploadFile('Create granule with granulite file', 'granulite', True)"/> 
    26                             </h2> 
    2724                </div> 
    2825        </div> 
Note: See TracChangeset for help on using the changeset viewer.