Changeset 8155 for mauRepo


Ignore:
Timestamp:
13/03/12 10:54:44 (8 years ago)
Author:
mnagni
Message:

Fixes an initialization problem

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

Legend:

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

    r8147 r8155  
    150150        intSession = Moles3EPB._getSession(session) 
    151151        if not identifier in observation.identifier: 
    152             moles3Append(observation, 'identifier', identifier) 
     152            observation.identifier.append(identifier) 
     153            #moles3Append(observation, 'identifier', identifier) 
    153154        if commit: 
    154155            intSession.commit() 
  • mauRepo/MolesManager/trunk/src/MolesManager/molesSessionMiddleware.py

    r8088 r8155  
    66from MolesManager.moles3epb import Moles3EPB 
    77from libs.migration.client import MigrationThread 
    8 from MolesManager.settings import RUN_MIGRATION, MIGRATION_INTERVAL 
    9 from MolesManager.forms.date import methodsWithDecorator 
     8from MolesManager.settings import RUN_MIGRATION, MIGRATION_INTERVAL,\ 
     9    MIGRATION_DB_CONNECTION, MIGRATION_DB_SCRIPT, MOLES3_DB_CONNECTION,\ 
     10    MOLES3_DB_SCRIPT 
     11from libs.commons_db import DbManager 
     12from libs.migration.MigrationEPB import MigrationEPB 
    1013 
    1114 
     
    1518    #unfortunately I cannot find any start/stop signals from Django 
    1619    _migrationThread = MigrationThread(interval = MIGRATION_INTERVAL) 
     20    _epbInitialized = False 
     21     
     22 
     23     
     24    def _getMolesSession(self): 
     25        if not MolesSessionMiddleware._epbInitialized: 
     26            migrationDB = DbManager(MIGRATION_DB_CONNECTION, MIGRATION_DB_SCRIPT) 
     27            MigrationEPB.overrrideDBManager(migrationDB)        
     28 
     29            molesDB = DbManager(MOLES3_DB_CONNECTION, MOLES3_DB_SCRIPT) 
     30            Moles3EPB.overrrideDBManager(molesDB) 
     31            MolesSessionMiddleware._epbInitialized = True 
     32            return Moles3EPB.getNewMolesSession() 
     33        else: 
     34            return Moles3EPB.getNewMolesSession() 
    1735     
    1836    def _migration(self, runMigration = RUN_MIGRATION): 
     
    3048        self._migration() #see the note on  MolesSessionMiddleware._migration 
    3149         
    32         request.moles_session = Moles3EPB.getNewMolesSession() 
     50        request.moles_session = self._getMolesSession() 
    3351 
    3452 
Note: See TracChangeset for help on using the changeset viewer.