def set_global_context(self):
        # Get the valid prices
        self.products = Product.get_all_products()
        self.pricelist = self.campaign.get_product_prices()


        # Translate to json.
        self.catalog_json = dumps({
            'products': {code: p.as_jsonable() for code, p in self.products.iteritems()},
            'prices': {code: pp.as_jsonable() for code, pp in self.pricelist.iteritems()}
        })
        #self.products_json = dumps({code: p.as_jsonable() for code, p in self.products.iteritems()})
        self.pricelist_json = dumps({code: pp.as_jsonable() for code, pp in self.pricelist.iteritems()})
    def __init__(self, agreement, blob):
        self.agreement = agreement
        self.errors = []
        self.messages = []
        self.restrictions = []
        self.blob = blob

        self.products = Product.get_all_products()
        self.prices = agreement.campaign.get_product_prices(agreement.pricedate)

        self.product_contents = agreement.campaign.get_product_contents(agreement.pricedate)
        #self.product_contents = defaultdict(list)
        #for pc in pcs:
        #    self.product_contents[pc.included_in_id].append(pc)

        self.apply_restrictions()
        self.available_install_methods = agreement.available_install_methods()
        self.final_children = []
    def __init__(self, agreement, blob):
        self.agreement = agreement
        self.errors = []
        self.messages = []
        self.restrictions = []
        self.blob = blob

        self.products = Product.get_all_products()
        self.prices = agreement.campaign.get_product_prices(
            agreement.pricedate)

        self.product_contents = agreement.campaign.get_product_contents(
            agreement.pricedate)
        #self.product_contents = defaultdict(list)
        #for pc in pcs:
        #    self.product_contents[pc.included_in_id].append(pc)

        self.apply_restrictions()
        self.available_install_methods = agreement.available_install_methods()
        self.final_children = []
Example #4
0
    def set_global_context(self):
        # Get the valid prices
        self.products = Product.get_all_products()
        self.pricelist = self.campaign.get_product_prices()

        # Translate to json.
        self.catalog_json = dumps({
            'products':
            {code: p.as_jsonable()
             for code, p in self.products.iteritems()},
            'prices': {
                code: pp.as_jsonable()
                for code, pp in self.pricelist.iteritems()
            }
        })
        #self.products_json = dumps({code: p.as_jsonable() for code, p in self.products.iteritems()})
        self.pricelist_json = dumps({
            code: pp.as_jsonable()
            for code, pp in self.pricelist.iteritems()
        })