def set_pi_registry_number(info, context): """A parliamentary_item's registry_number should be set on the item being submitted to parliament. """ instance = removeSecurityProxy(context) if instance.registry_number == None: dbutils.set_pi_registry_number(instance)
def set_pi_registry_number(context): """A parliamentary_item's registry_number should be set on the item being submitted to parliament. """ mask = get_mask(context) if mask == "manual" or mask is None: return items = re.findall(r"\{(\w+)\}", mask) for name in items: if name == "registry_number": mask = mask.replace("{%s}" % name, str(dbutils.get_next_reg())) continue if name == "progressive_number": mask = mask.replace("{%s}" % name, str(dbutils.get_next_prog(context))) continue value = getattr(context, name) mask = mask.replace("{%s}" % name, value) if context.registry_number == None: dbutils.set_pi_registry_number(context, mask)
def set_pi_registry_number(context): """A parliamentary_item's registry_number should be set on the item being submitted to parliament. """ if context.registry_number == None: dbutils.set_pi_registry_number(context)