def __init__(self, data={}): defaults = conf.defaults if data.get('order_item_id'): # use order data defaults.update(OrderData(data['order_item_id']).__dict__) defaults.update(data) odict.__init__(self, defaults) if not self.order_item_id: self.order_item_id = 0 self.print_reason = str(self.print_reason).replace('new', '') if self.code in 'KL': if self.print_reason: self.cover = '' else: from controllers import products self.cover = products.getEnvBundleMsg(self.qty) self.envelope_qty = products.getEnvQty(self.qty) # make sure cover pages are in the front of the page list if 'page_list' in self: new = [] for p in self.page_list or []: if str(p).lower() in ('cover', 'jacket'): new = [p] + new else: new.append(p) self.page_list = new # auto-detect page count if self.pages is None: pdf = os.path.join(self.archive_dir, self.pdfname) self.pages = genpdf.countPages(pdf) self.pages = int(self.pages or 0) if 'mail_merge' in self: self.batched = True
def __init__(self, name = "", dict = None): self.name = name odict.__init__(self, dict)
def __init__(self, data=()): odict.__init__(self, data=data)