本文整理汇总了Python中lp.services.database.interfaces.IStore.remove方法的典型用法代码示例。如果您正苦于以下问题:Python IStore.remove方法的具体用法?Python IStore.remove怎么用?Python IStore.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lp.services.database.interfaces.IStore
的用法示例。
在下文中一共展示了IStore.remove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: destroySelf
# 需要导入模块: from lp.services.database.interfaces import IStore [as 别名]
# 或者: from lp.services.database.interfaces.IStore import remove [as 别名]
def destroySelf(self):
store = IStore(Packageset)
sources = store.find(
PackagesetSources,
PackagesetSources.packageset == self)
sources.remove()
store.remove(self)
if self.relatedSets().is_empty():
store.remove(self.packagesetgroup)
示例2: removeDeviceClass
# 需要导入模块: from lp.services.database.interfaces import IStore [as 别名]
# 或者: from lp.services.database.interfaces.IStore import remove [as 别名]
def removeDeviceClass(self, main_class, sub_class=None):
"""See `IHWDevice.`"""
store = IStore(HWDeviceClass)
result_set = store.find(
HWDeviceClass,
HWDeviceClass.device == self.id,
HWDeviceClass.main_class == main_class,
HWDeviceClass.sub_class == sub_class,
)
existing_record = result_set.one()
if existing_record is not None:
store.remove(existing_record)
示例3: _set_tags
# 需要导入模块: from lp.services.database.interfaces import IStore [as 别名]
# 或者: from lp.services.database.interfaces.IStore import remove [as 别名]
def _set_tags(self, tags):
"""Update the tags to filter on.
The tags can be qualified with a leading hyphen, and can be bundled in
any iterable.
If they are passed within a `searchbuilder.any` or `searchbuilder.all`
object, the `find_all_tags` attribute will be updated to match.
Wildcard tags - `*` and `-*` - can be given too, and will update
`include_any_tags` and `exclude_any_tags`.
"""
# Deal with searchbuilder terms.
if isinstance(tags, searchbuilder.all):
self.find_all_tags = True
tags = frozenset(tags.query_values)
elif isinstance(tags, searchbuilder.any):
self.find_all_tags = False
tags = frozenset(tags.query_values)
else:
# Leave find_all_tags unchanged.
tags = frozenset(tags)
wildcards = frozenset((u"*", u"-*")).intersection(tags)
# Set wildcards.
self.include_any_tags = "*" in wildcards
self.exclude_any_tags = "-*" in wildcards
# Deal with other tags.
tags = tags - wildcards
store = IStore(BugSubscriptionFilterTag)
current_tag_filters = dict(
(tag_filter.qualified_tag, tag_filter)
for tag_filter in store.find(
BugSubscriptionFilterTag,
BugSubscriptionFilterTag.filter == self))
# Remove unused tags.
for tag in set(current_tag_filters).difference(tags):
tag_filter = current_tag_filters.pop(tag)
store.remove(tag_filter)
# Add additional tags.
for tag in tags.difference(current_tag_filters):
tag_filter = BugSubscriptionFilterTag()
tag_filter.filter = self
tag_filter.include = not tag.startswith("-")
tag_filter.tag = tag.lstrip("-")
store.add(tag_filter)