Changeset 8350 for mauRepo/MolesManager


Ignore:
Timestamp:
14/06/12 17:25:12 (7 years ago)
Author:
mnagni
Message:

Regression bug. Did not append Observation to ObservationCollection?.member

Location:
mauRepo/MolesManager/trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/MolesManager/trunk/src/MolesManager/moles3epb.py

    r8339 r8350  
    8888    def updateCedaObject(self, ceda_object, cols_to_update): 
    8989        """ 
    90             Update and eventually commit a CEDA Object in MOLES3 db. 
    91             NOTE: only the returned instance will reflect the update!  
    92             @param ceda_object: the CEDA object to persist 
    93             @param dict: a dictionary containing the columns to update for the given ceda_object 
    94             @param session: the external session to use. If None a new session will be open to add and commit the object and then closed at the exit. The object is committed 
     90            Update and eventually commit a CEDA Object in MOLES3 db.  
     91            @param ceda_object: the CEDA object to update 
     92            @param cols_to_update: a dictionary containing the columns to update for the given ceda_object and the desired value. 
     93            If the attribute is a list of objects the new instances are appended only if do not exist in the actual list  
    9594            @return: the given instance with the updated attributes. 
    9695        """ 
     
    110109                    coll_k = getattr(coll, k)                         
    111110                    if type(coll_k) == list or type(coll_k) == InstrumentedList: 
    112                         if  type(val) == list or type(val) == InstrumentedList: 
    113                             coll_k.extend(val) 
     111                        tmp_coll = [] 
     112                        if type(val) == list or type(val) == InstrumentedList: 
     113                            tmp_coll.extend(val) 
    114114                        else: 
    115                             if val in coll_k: 
    116                                 break 
    117                             coll_k.append(val) 
     115                            tmp_coll.append(val) 
     116                        for item in tmp_coll: 
     117                            if item not in coll_k: 
     118                                coll_k.append(item) 
    118119                    else: 
    119120                        setattr(coll, k, val) 
    120         EPB.persistInstance(coll, self._session)                                  
     121        self._session.commit() 
     122        return coll                                       
    121123 
    122124    def retrieveGUIDFromInstance(self, instance): 
  • mauRepo/MolesManager/trunk/src/MolesManager/static/templates/cedaSearch.html

    r8280 r8350  
    2323            <script type="dojo/method" data-dojo-event="onSubmit"> 
    2424                if(this.validate()){ 
    25                     return confirm('Form is valid, press OK to submit'); 
     25                    //return confirm('Form is valid, press OK to submit'); 
    2626                }else{ 
    2727                    alert('Form contains invalid data.  Please correct first'); 
  • mauRepo/MolesManager/trunk/src/libs/migration/processor/dataEntity.py

    r8325 r8350  
    193193            try: 
    194194                ceda_observation = self._processDeploymentMigration(deploymentMigration, howManydm == 1) 
    195                  
    196                 #Check if a doi has been already assigned      
    197                 cedaObservationCollection = EPBRepo.moles3EPB.loadAttributes(cedaObservationCollection, 'member')                            
    198                 member = cedaObservationCollection.member 
    199                 if member and not (ceda_observation in member): 
    200                     EPBRepo.moles3EPB.updateCedaObject(cedaObservationCollection, {'member': ceda_observation}) 
     195                EPBRepo.moles3EPB.updateCedaObject(cedaObservationCollection, {'member': ceda_observation}) 
    201196                                       
    202197            except Exception as ex: 
Note: See TracChangeset for help on using the changeset viewer.