本文整理汇总了Python中pyasm.search.Search.add_parent_filter方法的典型用法代码示例。如果您正苦于以下问题:Python Search.add_parent_filter方法的具体用法?Python Search.add_parent_filter怎么用?Python Search.add_parent_filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.search.Search
的用法示例。
在下文中一共展示了Search.add_parent_filter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_output_tasks
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_parent_filter [as 别名]
def get_output_tasks(my):
process = my.get_value("process")
parent = my.get_parent()
# get the pipeline
pipeline_code = parent.get_value("pipeline_code", no_exception=True)
if not pipeline_code:
return []
pipeline = Pipeline.get_by_code(pipeline_code)
if not pipeline:
return []
processes = pipeline.get_output_processes(process)
if not processes:
return []
tasks = []
process_names = [x.get_name() for x in processes]
search = Search("sthpw/task")
search.add_filters("process", process_names)
search.add_parent_filter(parent)
tasks = search.get_sobjects()
return tasks
示例2: delete_sobject
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_parent_filter [as 别名]
def delete_sobject(my, sobject):
search_type = sobject.get_base_search_type()
# this is used by API method delete_sobject
auto_discover = my.kwargs.get("auto_discover")
values = my.kwargs.get("values")
if values:
related_types = values.get("related_types")
elif auto_discover:
related_types = SearchType.get_related_types(search_type, direction="children")
else:
related_types = None
# always delete notes and task and snapshot
#if not related_types:
# related_types = ['sthpw/note', 'sthpw/task', 'sthpw/snapshot']
#related_types = my.schema.get_related_search_types(search_type)
if related_types:
for related_type in related_types:
if not related_type or related_type == search_type:
continue
# snapshots take care of sthpw/file in the proper manner, so
# skip them here
if related_type == 'sthpw/file':
continue
related_sobjects = sobject.get_related_sobjects(related_type)
for related_sobject in related_sobjects:
if related_type == 'sthpw/snapshot':
my.delete_snapshot(related_sobject)
else:
related_sobject.delete()
# implicitly remove "directory" files associated with the sobject
search = Search("sthpw/file")
search.add_op("begin")
search.add_filter("file_name", "")
search.add_null_filter("file_name")
search.add_op("or")
search.add_parent_filter(sobject)
file_objects = search.get_sobjects()
for file_object in file_objects:
base_dir = Environment.get_asset_dir()
relative_dir = file_object.get("relative_dir")
lib_dir = "%s/%s" % (base_dir, relative_dir)
print "removing: ", lib_dir
FileUndo.rmdir(lib_dir)
file_object.delete()
# finally delete the sobject
print "deleting: ", sobject.get_search_key()
if search_type == 'sthpw/snapshot':
my.delete_snapshot(sobject)
else:
sobject.delete()
示例3: handle_snapshots
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_parent_filter [as 别名]
def handle_snapshots(my):
path = "__snapshot_files.spt"
path = "%s/%s" % (my.plugin_dir, path)
print "Writing: ", path
# write out an empty file
#f = open(path, 'w')
fmode = 'w'
if os.path.exists(path):
fmode = 'a'
f = codecs.open(path, fmode, 'utf-8')
f.close()
# get all of the latest snapshots for this plugin
search = Search("sthpw/snapshot")
search.add_parent_filter(my.plugin)
search.add_filter("is_latest", True)
snapshots = search.get_sobjects()
if not snapshots:
return
# dump out these snapshots
dumper = TableDataDumper()
dumper.set_delimiter("#-- Start Entry --#", "#-- End Entry --#")
dumper.set_include_id(False)
dumper.set_sobjects(snapshots)
dumper.dump_tactic_inserts(path, mode='sobject')
# get all of the files for all of the snapshots and copy the director
# structure
# get all of the latest snapshots for this plugin
search = Search("sthpw/file")
search.add_relationship_filters(snapshots)
files = search.get_sobjects()
# dump out these snapshots
dumper = TableDataDumper()
dumper.set_delimiter("#-- Start Entry --#", "#-- End Entry --#")
dumper.set_include_id(False)
dumper.set_sobjects(files)
dumper.dump_tactic_inserts(path, mode='sobject')
new_dir = "%s/files" % (my.plugin_dir)
if not os.path.exists(new_dir):
os.makedirs(new_dir)
for snapshot in snapshots:
paths = snapshot.get_all_lib_paths(mode="lib")
for path in paths:
file_name = os.path.basename(path)
new_path = "%s/%s" % (new_dir, file_name)
shutil.copy(path, new_path)
示例4: do_delete
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_parent_filter [as 别名]
def do_delete(self, sobject, related_types=None):
search_type = sobject.get_base_search_type()
# always delete notes and task and snapshot
if not related_types:
related_types = ['sthpw/note', 'sthpw/task', 'sthpw/snapshot']
#related_types = self.schema.get_related_search_types(search_type)
if related_types:
for related_type in related_types:
if not related_type or related_type == search_type:
continue
# snapshots take care of sthpw/file in the proper manner, so
# skip them here
if related_type == 'sthpw/file':
continue
related_sobjects = sobject.get_related_sobjects(related_type)
for related_sobject in related_sobjects:
if related_type == 'sthpw/snapshot':
self.delete_snapshot(related_sobject)
else:
related_sobject.delete()
#self.do_delete(related_sobject)
# implicitly remove "directory" files associated with the sobject
search = Search("sthpw/file")
search.add_op("begin")
search.add_filter("file_name", "")
search.add_null_filter("file_name")
search.add_op("or")
search.add_parent_filter(sobject)
file_objects = search.get_sobjects()
#if file_objects:
# print("Removing [%s] file objects" % len(file_objects))
for file_object in file_objects:
base_dir = Environment.get_asset_dir()
relative_dir = file_object.get("relative_dir")
lib_dir = "%s/%s" % (base_dir, relative_dir)
FileUndo.rmdir(lib_dir)
file_object.delete()
# finally delete the sobject
print("Deleting: ", sobject.get_search_key())
if search_type == 'sthpw/snapshot':
self.delete_snapshot(sobject)
else:
sobject.delete()
示例5: execute
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_parent_filter [as 别名]
def execute(my):
sudo = Sudo()
input = my.get_input()
search_key = input.get("search_key")
update_data = input.get("update_data")
mode = input.get("mode")
if mode in ['insert','delete','retire']:
return
task = Search.get_by_search_key(search_key)
process = task.get_value("process")
context = task.get_value("context")
parent = task.get_parent()
# find all of the tasks with the same parent and same context
search = Search("sthpw/task")
search.add_parent_filter(parent)
search.add_filter("process", process)
search.add_filter("context", context)
tasks = search.get_sobjects()
trigger_dict = Container.get('RelatedTaskUpdateTrigger')
if not trigger_dict:
trigger_dict = {}
for attr, value in update_data.items():
# skip assigned as this is the only difference between related tasks
if attr == 'assigned':
continue
# update_data could have the post-conversion value None
if value == None:
value = ''
for task in tasks:
task_search_key = task.get_search_key()
# skip the current one
if task_search_key == search_key or trigger_dict.get(task_search_key):
continue
task.set_value(attr, value)
trigger_dict[task_search_key] = True
Container.put('RelatedTaskUpdateTrigger', trigger_dict)
# this should run trigger where applicable
task.commit(triggers=True)
del sudo
示例6: get_packages
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_parent_filter [as 别名]
def get_packages(self):
"""
Get a list of Packages (sobjects) belonging to the Order that this component belongs to
:return: List of package sobjects
"""
# Search for packages, using the parent Order to filter
package_search = Search('twog/package')
package_search.add_parent_filter(self.order_sobject)
packages = package_search.get_sobjects()
# Filter out the package that the component already belongs to
packages = [package for package in packages if package.get_code() != self.package_sobject.get_code()]
# Return a list of packages
return packages
示例7: check_inputs
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_parent_filter [as 别名]
def check_inputs(my):
pipeline = my.input.get("pipeline")
process = my.input.get("process")
sobject = my.input.get("sobject")
print "check_input: ", process
# first check the inputs. If there is only one input, then
# skip this check
input_processes = pipeline.get_input_processes(process)
if len(input_processes) <= 1:
return True
# TODO: what about dependencies??
# check all of the input processes to see if they are all complete
complete = True
for input_process in input_processes:
key = "%s|%s|status" % (sobject.get_search_key(), input_process.get_name())
message_sobj = Search.get_by_code("sthpw/message", key)
if message_sobj:
message = message_sobj.get_json_value("message")
if message != "complete":
complete = False
break
else:
# look for some other means to determine if this is done
search = Search("sthpw/task")
search.add_parent_filter(sobject)
search.add_filter("process", input_process.get_name())
task = search.get_sobject()
if task:
task_status = task.get("status")
if status.lower() != "complete":
complete = False
break
print "complete: ", complete
if not complete:
return False
else:
return True
示例8: execute
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_parent_filter [as 别名]
def execute(self):
input = self.get_input()
search_key = input.get("search_key")
task = Search.get_by_search_key(search_key)
parent = task.get_parent()
if not parent:
raise TacticException("Task parent not found.")
# get the definition of the trigger
trigger_sobj = self.get_trigger_sobj()
data = trigger_sobj.get_value("data")
try:
data = jsonloads(data)
except:
raise TacticException("Incorrect formatting of trigger [%s]." % trigger_sobj.get_value("code"))
# check against source status if present
src_status = data.get("src_status")
if src_status:
task_status = task.get_value("status")
if task_status != src_status:
return
process_names = data.get("output")
if not process_names:
return
# only create new task if another of the same
# process does not already exist
search = Search("sthpw/task")
search.add_filters("process", process_names)
search.add_parent_filter(parent)
search.add_project_filter()
tasks = search.get_sobjects()
existing_processes = [x.get_value("process") for x in tasks]
for process in process_names:
if process in existing_processes:
continue
else:
Task.create(parent, process, start_date=None, end_date=None)
示例9: get_notes_and_stypes_counts
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_parent_filter [as 别名]
def get_notes_and_stypes_counts(process, search_key, stypes_list):
# getting notes by search_type process and count of stypes from stypes_list
from pyasm.search import Search
search_type, search_code = server.split_search_key(search_key)
cnt = {
'notes': {},
'stypes': {},
}
for p in process:
search = Search('sthpw/note')
search.add_op_filters([('process', p), ('search_type', search_type), ('search_code', search_code)])
cnt['notes'][p] = search.get_count()
for stype in stypes_list:
search = Search(stype)
search.add_parent_filter(search_key)
cnt['stypes'][stype] = search.get_count()
return cnt
示例10: get_display
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_parent_filter [as 别名]
def get_display(self):
top = self.top
self.set_as_panel(top)
top.set_unique_id()
top.add_style("min-width: 600px")
top.add_style("max-height: 600px")
top.add_style("overflow-y: auto")
top.add_color("background", "background")
top.add_color("color", "color")
sobject = self.kwargs.get("sobject")
if not sobject:
search_key = self.kwargs.get("search_key")
sobject = Search.get_by_search_key(search_key)
else:
search_key = sobject.get_search_key()
context = self.kwargs.get("context")
search = Search("sthpw/note")
#search.add_relationship_filters(self.filtered_parents, type='hierarchy')
search.add_parent_filter(sobject)
search.add_order_by("process")
search.add_order_by("context")
search.add_order_by("timestamp desc")
if context:
search.add_filter("context", context)
notes = search.get_sobjects()
top.add_smart_style("spt_note", "padding", "15px")
for i, note in enumerate(notes):
note_div = DivWdg()
top.add( note_div )
note_div.add( self.get_note_wdg(note) )
if i % 2 == 0:
note_div.add_color("background", "background", -3)
top.add("<br/><hr/><br/>")
from tactic.ui.panel import TableLayoutWdg
table = TableLayoutWdg(
search_type="sthpw/note",
show_shelf=False,
show_select=False,
element_names=['login','timestamp','note','delete'])
table.set_sobjects(notes)
top.add(table)
return top
示例11: main
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_parent_filter [as 别名]
def main(server=None, input_data=None):
if not input_data:
return
# The input for the script should be a sthpw/task sobject
task_sobject = input_data.get('sobject')
# This script only applies to tasks that are marked as Complete, and are attached to twog/component sobjects
if not (task_sobject.get('status') == 'Complete' and task_sobject.get(
'search_type') == u'twog/component?project=twog'):
return
# Tasks saved on twog/component have extra data associated with them, saved under twog/task_data
# Retrieve the entry of twog/task_data for this task sobject
task_data_search = Search('twog/task_data')
task_data_search.add_filter('task_code', task_sobject.get('code'))
task_data = task_data_search.get_sobject()
if not task_data:
return
# Get the next task in the pipeline
# Start by getting the component sobject the task is attached to
component_search = Search('twog/component')
component_search.add_code_filter(task_sobject.get('search_code'))
component_sobject = component_search.get_sobject()
if not component_sobject:
return
# Then get the output processes. Start by fetching the pipeline object
pipeline = Pipeline('twog/component')
pipeline.set_pipeline(get_pipeline_xml(component_sobject.get('pipeline_code')))
# Then get the names of the processes contained in that pipeline (which corresponds to all the names of the tasks
# within this component)
output_processes = pipeline.get_output_processes(task_sobject.get('process'))
# Now, get the actual task objects
tasks_search = Search('sthpw/task')
tasks_search.add_filter('process', output_processes)
tasks_search.add_parent_filter(component_sobject)
output_tasks = tasks_search.get_sobjects()
# Fetch the output files attached to the original task
out_files_search = Search('twog/task_data_out_file')
out_files_search.add_filter('task_data_code', task_data.get_code())
out_files = out_files_search.get_sobjects()
if not out_files:
return
# Go through each output task and attach the output files as input files
for output_task in output_tasks:
output_task_data_search = Search('twog/task_data')
output_task_data_search.add_filter('task_code', output_task.get_code())
output_task_data = output_task_data_search.get_sobject()
for out_file in out_files:
inserted_data = {
'task_data_code': output_task_data.get_code(),
'file_code': out_file.get('file_code')
}
server.insert('twog/task_data_in_file', inserted_data)
# The file should be added to the files in order list
server.insert('twog/file_in_order', {'order_code': component_sobject.get('order_code'),
'file_code': out_file.get('file_code')})
示例12: handle_search
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_parent_filter [as 别名]
def handle_search(self):
parent_key = self.kwargs.get("parent_key")
# this is an absolute expression
self.search_expr = self.kwargs.get("search_expr")
self.search_type = self.kwargs.get("search_type")
if not self.search_type:
self.search_type = 'sthpw/task'
if self.search_expr:
result = Search.eval(self.search_expr)
if isinstance(result, list):
search = Search(self.search_type)
codes = [x.get_code() for x in result]
search.add_filters("code", codes)
else:
search = result
else:
self.op_filters = self.kwargs.get("filters")
if self.op_filters:
if isinstance(self.op_filters, basestring):
self.op_filters = eval(self.op_filters)
search = Search(self.search_type)
if self.op_filters:
search.add_op_filters(self.op_filters)
self.start_column = self.kwargs.get('start_date_col')
if not self.start_column:
self.start_column = 'bid_start_date'
self.end_column = self.kwargs.get('end_date_col')
if not self.end_column:
self.end_column = 'bid_end_date'
if parent_key:
parent = Search.get_by_search_key(parent_key)
search.add_parent_filter(parent)
search.add_op('begin')
if self.handler:
self.handler.alter_search(search)
search.add_op('or')
self.start_date = datetime(self.year, self.month, 1)
next_month = self.month+1
next_year = self.year
if next_month > 12:
next_month = 1
next_year += 1
self.end_date = datetime(next_year, next_month, 1)
self.end_date = self.end_date - timedelta(days=1)
# outer begin
search.add_op('begin')
search.add_op('begin')
search.add_date_range_filter(self.start_column, self.start_date, self.end_date)
search.add_date_range_filter(self.end_column, self.start_date, self.end_date)
search.add_op('or')
search.add_op('begin')
search.add_filter(self.start_column, self.start_date, op='<=')
search.add_filter(self.end_column, self.end_date, op='>=')
search.add_op('and')
search.add_op('or')
extra_codes = self.kwargs.get("extra_codes")
if extra_codes:
search.add_op('and')
extra_codes = extra_codes.split("|")
search.add_filters("code", extra_codes)
search.add_op('or')
search.add_order_by(self.start_column)
self.sobjects = search.get_sobjects()
示例13: get_action_wdg
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_parent_filter [as 别名]
def get_action_wdg(self, name):
'''get the action widget for ui option of note entry'''
note_wdg = DivWdg()
note_wdg.add_style("padding-top: 3px")
# note options
option = DivWdg(css='spt_uber_note_option')
cb = CheckboxWdg('is_private')
#cb.set_default_checked()
checkbox_name = 'note_master_private_cb'
master_cb = CheckboxWdg(checkbox_name)
if master_cb.is_checked():
cb.set_default_checked()
option.add_style('margin-right','5px')
option.add_style('float','right')
option.add(cb)
option.add('private')
#commit = TextBtnWdg(label='save', size='small')
commit = ActionButtonWdg(title='save', tip="Save Changes")
commit.add_style('margin-top: -5px')
commit.add_style('margin-bottom: 5px')
commit.add_style('float: right')
commit.add_behavior({
'type': 'click_up',
'cbjs_action': '''
var td = bvr.src_el.getParent(".spt_table_td");
var text = td.getElement(".spt_note_text");
text.blur();
spt.dg_table.update_row(evt, bvr);
td.setStyle('background-color','');
''',
'cell_only': True
})
#commit.set_scale("0.75")
# do some gynastics to handle a refresh.
if self.parent_wdg:
info = self.parent_wdg.get_aux_info()
sobject_dict = info.get('sobjects')
sobject = sobject_dict.get(self.get_name())
parent = info.get('parent')
else:
sobject = None
parent = None
if not sobject:
if self.parent_key:
parent = SearchKey.get_by_search_key(self.parent_key)
# get the latest note
#search_key = self.kwargs.get("search_key")
#if search_key:
# sobject = SearchKey.get_by_search_key(search_key)
search = Search('sthpw/note')
search.add_parent_filter(parent)
search.add_filter('context', name)
# Make the assumption that the last one entered is by timestamp
search.add_order_by('timestamp desc')
sobject = search.get_sobject()
# Show a history of notes
if sobject:
history = ActionButtonWdg(title='history', tip="Show note history")
#history = TextBtnWdg(label='history', size='small')
#history.get_top_el().add_style("margin-left: 4px")
#history.get_top_el().add_style('float: left')
history.add_style("float: left")
history.add_style("margin-top: -5px")
history.add_style("margin-bottom: 5px")
note_wdg.add(history)
self.parent_key = SearchKey.get_by_sobject(parent)
context = name
filter = '[{"prefix":"main_body","main_body_enabled":"on","main_body_column":"context","main_body_relation":"is","main_body_value":"%s"}]' % context
history.add_behavior( {
'type': 'click_up',
'cbjs_action': "spt.popup.get_widget(evt, bvr)",
'options': {
'class_name': 'tactic.ui.panel.ViewPanelWdg',
'title': 'Notes History',
'popup_id': 'Notes_History_%s'%context
},
'args': {
'search_type': 'sthpw/note',
'view': 'summary',
'parent_key': self.parent_key,
'filter': filter,
#.........这里部分代码省略.........
示例14: get_display
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_parent_filter [as 别名]
def get_display(my):
top = DivWdg()
sobject = my.get_sobject()
if not sobject:
return top
process = my.kwargs.get("process")
#from tactic.ui.table import TaskElementWdg
#task_wdg = TaskElementWdg()
#task_wdg.set_sobject(my.sobject)
#top.add(task_wdg)
search = Search('sthpw/task')
search.add_parent_filter(sobject)
search.add_filter("process", process)
tasks = search.get_sobjects()
tasks_div = DivWdg()
top.add(tasks_div)
#tasks_div.add_style("padding: 0px 0px 20px 0px")
tasks_div.add_style("margin: 10px")
tasks_div.set_box_shadow()
title = DivWdg()
title.add_gradient("background", "background3", 0, -10)
title.add_color("color", "color3", -10)
title.add_border()
title.add_style("height: 20px")
title.add_style("padding: 4px")
title.add_style("font-weight: bold")
title.add("All Tasks for process '%s':" % process)
tasks_div.add(title)
task_wdg = TableLayoutWdg(search_type="sthpw/task",view='single_process', show_row_select="false", show_insert="false", show_gear="false", show_search_limit="false", show_search=False, show_refresh="false", show_shelf="false")
task_wdg.set_sobjects(tasks)
tasks_div.add(task_wdg)
#from tactic.ui.container import ResizableTableWdg
#table = ResizableTableWdg()
table = Table()
top.add(table)
table.add_style("width: 100%")
table.add_row()
td = table.add_cell()
td.add_style("vertical-align: top")
td.add_style("width: 50%")
notes_div = DivWdg()
td.add(notes_div)
notes_div.set_box_shadow()
notes_div.add_style("margin: 10px")
title = DivWdg()
notes_div.add(title)
title.add_gradient("background", "background3", 0, -10)
title.add_color("color", "color3", -10)
title.add_border()
title.add_style("height: 20px")
title.add_style("padding: 4px")
title.add_style("font-weight: bold")
title.add("Notes:")
from tactic.ui.widget.discussion_wdg import DiscussionWdg
discussion_wdg = DiscussionWdg(search_key=sobject.get_search_key(), process=process, context_hidden=True, show_note_expand=True)
notes_div.add(discussion_wdg)
search = Search('sthpw/snapshot')
search.add_parent_filter(sobject)
search.add_filter("process", process)
snapshots = search.get_sobjects()
td = table.add_cell()
td.add_style("vertical-align: top")
td.add_style("width: 50%")
td.add_style("padding: 0 0 0 0")
snapshots_div = DivWdg()
td.add(snapshots_div)
snapshots_div.set_box_shadow()
snapshots_div.add_style("margin: 10px")
title = DivWdg()
title.add_gradient("background", "background3", 0, -10)
title.add_color("color", "color3", -10)
title.add_border()
title.add_style("height: 20px")
title.add_style("padding: 4px")
title.add_style("font-weight: bold")
title.add("Snapshots:")
snapshots_div.add(title)
snapshot_wdg = TableLayoutWdg(search_type="sthpw/snapshot",view='table', mode='simple', show_row_select=False, width='100%', show_shelf="false")
#.........这里部分代码省略.........
示例15: get_sobject_files
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_parent_filter [as 别名]
def get_sobject_files(my, sobject):
paths = []
show_versionless = my.kwargs.get("show_versionless")
if show_versionless in [True, 'true']:
show_versionless = True
else:
show_versionless = False
if isinstance(sobject, Snapshot):
snapshots = [sobject]
else:
# get the snapshots
versions = my.get_value("versions")
search = Search("sthpw/snapshot")
search.add_parent_filter(sobject)
if not versions or versions == 'latest':
search.add_filter("is_latest", True)
elif versions == 'current':
search.add_filter("is_current", True)
if show_versionless:
search.add_filter("version", -1)
search.add_op('or')
processes = my.kwargs.get("processes")
process = my.get_value("process")
if process and process != 'all':
search.add_filter("process", process)
if processes:
search.add_filters("process", processes)
snapshots = search.get_sobjects()
#snapshots = Snapshot.get_by_sobject(sobject)
for snapshot in snapshots:
exclude = ['web','icon']
snapshot_paths = snapshot.get_all_lib_paths(exclude_file_types=exclude)
files = snapshot.get_all_file_objects(exclude_file_types=exclude)
for path, file in zip(snapshot_paths, files):
# if the path is a directory, get all of the files
if os.path.isdir(path):
for root, dirnames, filenames in os.walk(path):
for filename in filenames:
item_path = "%s/%s" % (root, filename)
paths.append(item_path)
my.files[item_path] = file
for dirname in dirnames:
item_path = "%s/%s/" % (root, dirname)
paths.append(item_path)
my.files[item_path] = file
else:
paths.append(path)
my.snapshots[path] = snapshot
my.files[path] = file
return paths