Changeset 8344 for mauRepo/MolesManager


Ignore:
Timestamp:
13/06/12 23:09:13 (7 years ago)
Author:
mnagni
Message:

Share project "HPFos" into " http://proj.badc.rl.ac.uk/svn/ndg/mauRepo"

Location:
mauRepo/MolesManager/trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/MolesManager/trunk/src/libs/commons_db.py

    r8323 r8344  
    3333          (see http://docs.sqlalchemy.org/en/latest/orm/events.html?highlight=session%20events#sqlalchemy.orm.events.SessionEvents)      
    3434        """ 
    35         self._connection = connection 
     35        self._connection = connection         
    3636        self._script = script 
    37         self.engine = create_engine(self._connection, echo=sql_echo) 
     37        self.engine = None 
     38        try: 
     39            self.engine = create_engine(self._connection, echo=sql_echo) 
     40        except Exception as e: 
     41            print e 
    3842        self.metadata = MetaData(bind=self.engine)         
    3943        self._session = None 
  • mauRepo/MolesManager/trunk/src/libs/epb.py

    r8323 r8344  
    2222            Searches a required instance by id 
    2323            @param clazz: the class type to search for 
    24             @param inst_key: the instance id for which the search is done 
     24            @param inst_key: the instance id for which the search is done. If None return a query object 
    2525            @param session: a session to use for the query 
    2626            @return the required instance 
    27         """  
    28         res = session.query(clazz).get(inst_key) 
     27        """ 
     28        if inst_key: 
     29            res = session.query(clazz).get(inst_key) 
     30        else: 
     31            res = session.query(clazz) 
     32             
    2933        if res is None: 
    3034            return None 
    31         return res 
     35        return res             
     36         
     37 
    3238 
    3339    @classmethod 
Note: See TracChangeset for help on using the changeset viewer.