示例#1
0
 def test_production_save(self):
     """
     Tests save.
     """
     production = FieldProduction(
         name="G15161",
         country="US",
         date=date(year=2013, month=1, day=1),
         production_oil=179,
         production_gas=4407,
         depth=171,
     )
     production.save()
示例#2
0
    def get_production(self, row, field_name):
        tds = row.findAll('td')

        if len(tds) != 14:
            logger.error("Row did not have 14 columns.")
            print "Row did not have 14 columns."
            return None

        productions = []
        for idx, td in enumerate(tds[1:13]):
            p = FieldProduction()
            p.country = "UK"
            p.name = field_name
            year = self.to_int_or_zero(tds[0].text)
            p.date = date(year=year, month=idx+1, day=1)
            p.production_oil = self.to_int_or_zero(td.text) * 6.2898
            productions.append(p)

        return productions
示例#3
0
    def getProduction(self, row):
        tds = row.findAll('td')
        if len(tds) != 10:
            logger.warning("Row did not have 10 columns.")
            logger.warning(row.__str__())
            return None

        p = FieldProduction()
        p.name = tds[0].text
        p.country = "US"
        month = self.toIntOrZero(tds[1].text)
        year = self.toIntOrZero(tds[2].text)
        p.date = date(year=year, month=month, day=1)
        p.production_oil = self.toIntOrZero(tds[3].text) + self.toIntOrZero(tds[5].text)
        p.production_gas = self.toIntOrZero(tds[4].text) + self.toIntOrZero(tds[6].text)
        p.depth = self.toIntOrZero(tds[9].text)
        return p