Пример #1
0
    def get(self):
        template = JINJA_ENVIRONMENT.get_template('templates/caredit/list.html')

        unknown = CarModel.all().filter('name =', 'Annet').fetch(5)
        assert len(unknown)==1
        unknown_cars = Car.all().filter('model =', unknown[0]).fetch(50)

        other = CarModel.all().filter('name =', 'Annen Alfa Romeo').fetch(5)
        assert len(other)==1
        other_cars = Car.all().filter('model =', other[0]).fetch(50)

        data = { 'cars': other_cars + unknown_cars, 'linker': LookupReg() }
        self.response.write(template.render(data))
Пример #2
0
    def get(self):
        template = JINJA_ENVIRONMENT.get_template(
            'templates/caredit/list.html')

        unknown = CarModel.all().filter('name =', 'Annet').fetch(5)
        assert len(unknown) == 1
        unknown_cars = Car.all().filter('model =', unknown[0]).fetch(50)

        other = CarModel.all().filter('name =', 'Annen Alfa Romeo').fetch(5)
        assert len(other) == 1
        other_cars = Car.all().filter('model =', other[0]).fetch(50)

        data = {'cars': other_cars + unknown_cars, 'linker': LookupReg()}
        self.response.write(template.render(data))
Пример #3
0
    def import_member_cars(self, csv):
        import traceback
        from utils.carconversion import MemberCar
        self.models = CarModel.all().fetch(2000)

        cars = []
        lines = csv.split('\n')
        for line in lines:
            if len(line.strip()) == 0:
                continue

            fields = line.split(';')
            fields.reverse()
            car = MemberCar(memberno=fields.pop())
            car.description = fields.pop().strip()
            car.registration = fields.pop().strip()
            year = fields.pop().strip()
            if year != '':
                car.year = int(year)
            else:
                car.year = 0
            cars.append(car)

        print len(cars), 'cars imported'
        print len(self.models), 'models to use'
        try:
            print utils.carconversion.CarRank.do_matching(
                self.models, cars, self.create_member_car)
        except Exception as ex:
            print 'Exception matching car: ', ex
            print '*' * 80
            traceback.print_exc()
            print '*' * 80
Пример #4
0
    def import_member_cars(self, csv):
        import traceback
        from utils.carconversion import MemberCar
        self.models = CarModel.all().fetch(2000)

        cars = []
        lines = csv.split('\n')
        for line in lines:
            if len(line.strip()) == 0:
                continue

            fields = line.split(';')
            fields.reverse()
            car = MemberCar(memberno=fields.pop())
            car.description = fields.pop().strip()
            car.registration = fields.pop().strip()
            year = fields.pop().strip()
            if year != '':
                car.year = int(year)
            else:
                car.year = 0
            cars.append(car)

        print len(cars), 'cars imported'
        print len(self.models), 'models to use'
        try:
            print utils.carconversion.CarRank.do_matching(self.models, cars, self.create_member_car)
        except Exception as ex:
            print 'Exception matching car: ',ex
            print '*'*80
            traceback.print_exc()
            print '*'*80
Пример #5
0
def get_default_model():
    """Return the default model name"""
    return CarModel.all().filter('name', DEFAULT_MODEL_NAME).fetch(1)[0]
Пример #6
0
def get_default_model():
    """Return the default model name"""
    return CarModel.all().filter('name', DEFAULT_MODEL_NAME).fetch(1)[0]