def __init__(self, id, **kw): XMLObject.__init__(self, id) if 'meta_type' in kw: kw.setdefault('content_meta_type', kw.pop('meta_type')) if 'icon' in kw: kw.setdefault('content_icon', kw.pop('icon')) self.__dict__.update(kw)
def reindexObject(self): """ Overload reindexing in order to forward any modifications of capacity to simulation tool """ self.getParentValue().updateCapacity() XMLObject.reindexObject(self)
def __init__(self, *args, **kw): """ override to call __init__ of python scripts in order to set correctly bindings """ XMLObject.__init__(self, *args, **kw) ZopePythonScript.__init__(self, *args, **kw)
def __init__(self, id, **kw): XMLObject.__init__(self, id) if "meta_type" in kw: kw.setdefault("content_meta_type", kw.pop("meta_type")) if "icon" in kw: kw.setdefault("content_icon", kw.pop("icon")) self.__dict__.update(kw)
def _edit(self, **kw): """ 'manange_edit' function for ZSQLMethod needs to be called everytime after editing SQLMethod object. This would insure the update of _arg and template attribute for SQLMethod which are used while creating query. https://github.com/zopefoundation/Products.ZSQLMethods/blob/master/src/Shared/DC/ZRDB/DA.py#L353 """ XMLObject._edit(self, **kw) src = self.getSrc() title = self.title if title is None: title = '' connection_id = self.getConnectionId() self.manage_edit(title, connection_id, self.arguments_src, src)
def generateNewId(self, id_group='item_id_group', default=None, method=None): """ We want a different id for all Item """ return XMLObject.generateNewId(self, id_group=id_group, default=default, method=method)
def _edit(self, edit_order=(), **kw): """Overloaded _edit to support setting debit and credit at the same time, which is required for the GUI. Also sets the variation category list and property dict at the end, because _setVariationCategoryList and _setVariationPropertyDict needs the resource to be set. """ quantity = 0 if 'source_debit' in kw and 'source_credit' in kw: source_credit = kw.pop('source_credit') or 0 source_debit = kw.pop('source_debit') or 0 quantity += (source_credit - source_debit) kw['quantity'] = quantity kw['cancellation_amount'] = (source_credit < 0 or source_debit < 0) if 'destination_debit' in kw and 'destination_credit' in kw: destination_credit = kw.pop('destination_credit') or 0 destination_debit = kw.pop('destination_debit') or 0 quantity += (destination_debit - destination_credit) kw['quantity'] = quantity kw['cancellation_amount'] = (destination_credit < 0 or destination_debit < 0) # If both asset debit and asset credit are passed, we have to take care not # to erase the asset price if one of them is unset. if kw.get('source_asset_debit') or kw.get('source_asset_credit'): if kw.get('source_asset_debit') in (None, ''): kw.pop('source_asset_debit', None) if kw.get('source_asset_credit') in (None, ''): kw.pop('source_asset_credit', None) if kw.get('destination_asset_debit') or kw.get( 'destination_asset_credit'): if kw.get('destination_asset_debit') in (None, ''): kw.pop('destination_asset_debit', None) if kw.get('destination_asset_credit') in (None, ''): kw.pop('destination_asset_credit', None) if not edit_order: edit_order = ( 'variation_category_list', 'variation_property_dict', ) return XMLObject._edit(self, edit_order=edit_order, **kw)
def _edit(self, edit_order=(), **kw): """Overloaded _edit to support setting debit and credit at the same time, which is required for the GUI. Also sets the variation category list and property dict at the end, because _setVariationCategoryList and _setVariationPropertyDict needs the resource to be set. """ quantity = 0 if 'source_debit' in kw and 'source_credit' in kw: source_credit = kw.pop('source_credit') or 0 source_debit = kw.pop('source_debit') or 0 quantity += (source_credit - source_debit) kw['quantity'] = quantity kw['cancellation_amount'] = (source_credit < 0 or source_debit < 0) if 'destination_debit' in kw and 'destination_credit' in kw: destination_credit = kw.pop('destination_credit') or 0 destination_debit = kw.pop('destination_debit') or 0 quantity += (destination_debit - destination_credit) kw['quantity'] = quantity kw['cancellation_amount'] = (destination_credit < 0 or destination_debit < 0) # If both asset debit and asset credit are passed, we have to take care not # to erase the asset price if one of them is unset. if kw.get('source_asset_debit') or kw.get('source_asset_credit'): if kw.get('source_asset_debit') in (None, ''): kw.pop('source_asset_debit', None) if kw.get('source_asset_credit') in (None, ''): kw.pop('source_asset_credit', None) if kw.get('destination_asset_debit') or kw.get('destination_asset_credit'): if kw.get('destination_asset_debit') in (None, ''): kw.pop('destination_asset_debit', None) if kw.get('destination_asset_credit') in (None, ''): kw.pop('destination_asset_credit', None) if not edit_order: edit_order = ('variation_category_list', 'variation_property_dict',) return XMLObject._edit(self, edit_order=edit_order, **kw)
def _edit(self, edit_order=(), **kw): """Overloaded _edit to support setting debit and credit at the same time, which is required for the GUI. Also sets the variation category list and property dict at the end, because _setVariationCategoryList and _setVariationPropertyDict needs the resource to be set. """ quantity = 0 if "source_debit" in kw and "source_credit" in kw: source_credit = kw.pop("source_credit") or 0 source_debit = kw.pop("source_debit") or 0 quantity += source_credit - source_debit kw["quantity"] = quantity kw["cancellation_amount"] = source_credit < 0 or source_debit < 0 if "destination_debit" in kw and "destination_credit" in kw: destination_credit = kw.pop("destination_credit") or 0 destination_debit = kw.pop("destination_debit") or 0 quantity += destination_debit - destination_credit kw["quantity"] = quantity kw["cancellation_amount"] = destination_credit < 0 or destination_debit < 0 # If both asset debit and asset credit are passed, we have to take care not # to erase the asset price if one of them is unset. if kw.get("source_asset_debit") or kw.get("source_asset_credit"): if kw.get("source_asset_debit") in (None, ""): kw.pop("source_asset_debit", None) if kw.get("source_asset_credit") in (None, ""): kw.pop("source_asset_credit", None) if kw.get("destination_asset_debit") or kw.get("destination_asset_credit"): if kw.get("destination_asset_debit") in (None, ""): kw.pop("destination_asset_debit", None) if kw.get("destination_asset_credit") in (None, ""): kw.pop("destination_asset_credit", None) if not edit_order: edit_order = ("variation_category_list", "variation_property_dict") return XMLObject._edit(self, edit_order=edit_order, **kw)
def edit(self, **kw): XMLObject.edit(self, **kw)
def manage_beforeDelete(self, *args, **kw): try: del(memcached_dict_pool.memcached_dict) except AttributeError: pass XMLObject.manage_beforeDelete(self, *args, **kw)
def manage_beforeDelete(self, item, container): """Called before deleting this object. """ self._v_deletion = Deletion(self._getRepositoryPath()) XMLObject.manage_beforeDelete(self, item, container)
def manage_afterAdd(self, *args, **kw): try: del(memcached_dict_pool.memcached_dict) except AttributeError: pass XMLObject.manage_afterAdd(self, *args, **kw)
def manage_afterAdd(self, item, container): XMLObject.manage_afterAdd(self, item, container) Image.manage_afterAdd(self, item, container)
def __init__(self, id, **kw): Image.__init__(self, id, **kw) XMLObject.__init__(self, id, **kw)
def getTypeInfo(self, *args): if args: return self.getParentValue().getTypeInfo(*args) return XMLObject.getTypeInfo(self)
def manage_afterClone(self, item): XMLObject.manage_afterClone(self, item) Image.manage_afterClone(self, item)