Next / Previous / Contents / NM Tech homepage

6.18. CBCData.getRegion()

pycbc.py
# - - -   C B C D a t a . g e t R e g i o n

    def getRegion(self, regionCode):
        '''Look up a region code.
        '''
        try:
            result = self.s.query(self.Region).filter_by(
                         reg_code=regionCode).one()
            return result
        except exc.SQLAlchemyError, detail:
            raise KeyError("No such region code, '%s': %s" %
                           (regionCode, detail))