def preprocess(my): my.is_preprocess_run = True if my.get_option('filename') == 'true': my.show_filename_flag = True if my.get_option('file_type') == 'true': my.show_file_type = True if my.get_option('original') == 'true': my.show_orig_icon = True if my.get_option('versionless') == 'true': my.show_versionless = True if my.get_option('latest_icon') == 'true': my.show_latest_icon = True context = my.get_option('icon_context') if not context and my.sobjects: sobject = my.sobjects[0] assert(sobject) if sobject: # protect agains it being None context = sobject.get_icon_context(my.context) if context: my.context = context if not my.image_link_order: order = my.get_option('image_link_order') if order: order = order.split('|') my.set_image_link_order(order) # preselect all of the snapshots (don't do this for redirect right now) redirect = my.get_option("redirect") redirect_expr = my.get_option("redirect_expr") if not redirect and not redirect_expr and my.sobjects: if not my.sobjects[0]: # retired return snapshots = [] # if it is snapshot, there is no need to search for it again # and we dont' try to to look for publish context icons for it to save time if isinstance(my.sobjects[0], Snapshot): snapshots = my.sobjects else: if my.show_latest_icon: icon_context = None else: icon_context = my.sobjects[0].get_icon_context(my.context) try: if my.version == None: my.data = Snapshot.get_by_sobjects(my.sobjects, icon_context, is_latest=True, return_dict=True) # verify if we get icon for all if len(my.data) < len(my.sobjects): publish_data = Snapshot.get_by_sobjects(my.sobjects, my.DEFAULT_CONTEXT, is_latest=True, return_dict=True) my._update_data(publish_data) # verify if we get icon for all if len(my.data) < len(my.sobjects): publish_data = Snapshot.get_by_sobjects(my.sobjects, process=my.DEFAULT_PROCESS, is_latest=True, return_dict=True) my._update_data(publish_data) # verify if we get icon for all if len(my.data) < len(my.sobjects): publish_data = Snapshot.get_by_sobjects(my.sobjects, is_latest=True, return_dict=True) my._update_data(publish_data) else: my.data = Snapshot.get_by_sobjects(my.sobjects, icon_context, version=my.version, return_dict=True) # verify if we get icon for all if len(my.data) < len(my.sobjects): publish_data = Snapshot.get_by_sobjects(my.sobjects, my.DEFAULT_CONTEXT, version=my.version, return_dict=True) my._update_data(publish_data) # verify if we get icon for all if len(my.data) < len(my.sobjects): publish_data = Snapshot.get_by_sobjects(my.sobjects, process=my.DEFAULT_PROCESS, version=my.version, return_dict=True) my._update_data(publish_data) # verify if we get icon for all if len(my.data) < len(my.sobjects): publish_data = Snapshot.get_by_sobjects(my.sobjects, version=my.version, return_dict=True) my._update_data(publish_data) except SqlException, e: my.SQL_ERROR = True DbContainer.abort_thread_sql() return snapshots = my.data.values() # get all of the file objects file_objects = File.get_by_snapshots(snapshots) for file_object in file_objects: file_code = file_object.get_code() my.file_objects[file_code] = file_object
def clear_search_data(search_type, view=None): DbContainer.abort_thread_sql(force=True) key = SearchWdg._get_key(search_type, view) WidgetSettings.set_value_by_key(key, '')
def clear_search_data(search_type, view=None): DbContainer.abort_thread_sql(force=True) key = SearchWdg._get_key(search_type, view) WidgetSettings.set_value_by_key(key, '')
def preprocess(my): my.is_preprocess_run = True if my.get_option('filename') == 'true': my.show_filename_flag = True if my.get_option('file_type') == 'true': my.show_file_type = True if my.get_option('original') == 'true': my.show_orig_icon = True if my.get_option('versionless') == 'true': my.show_versionless = True if my.get_option('latest_icon') == 'true': my.show_latest_icon = True context = my.get_option('icon_context') if not context and my.sobjects: sobject = my.sobjects[0] assert(sobject) if sobject: # protect agains it being None context = sobject.get_icon_context(my.context) if context: my.context = context if not my.image_link_order: order = my.get_option('image_link_order') if order: order = order.split('|') my.set_image_link_order(order) # preselect all of the snapshots (don't do this for redirect right now) redirect = my.get_option("redirect") redirect_expr = my.get_option("redirect_expr") if not redirect and not redirect_expr and my.sobjects: if not my.sobjects[0]: # retired return snapshots = [] # if it is snapshot, there is no need to search for it again # and we dont' try to to look for publish context icons for it to save time if isinstance(my.sobjects[0], Snapshot): snapshots = my.sobjects else: if my.show_latest_icon: icon_context = None else: icon_context = my.sobjects[0].get_icon_context(my.context) try: if my.version == None: my.data = Snapshot.get_by_sobjects(my.sobjects, icon_context, is_latest=True, return_dict=True) # verify if we get icon for all if len(my.data) < len(my.sobjects): publish_data = Snapshot.get_by_sobjects(my.sobjects, my.DEFAULT_CONTEXT, is_latest=True, return_dict=True) my._update_data(publish_data) # verify if we get icon for all if len(my.data) < len(my.sobjects): publish_data = Snapshot.get_by_sobjects(my.sobjects, process=my.DEFAULT_PROCESS, is_latest=True, return_dict=True) my._update_data(publish_data) # verify if we get icon for all if len(my.data) < len(my.sobjects): publish_data = Snapshot.get_by_sobjects(my.sobjects, is_latest=True, return_dict=True) my._update_data(publish_data) else: my.data = Snapshot.get_by_sobjects(my.sobjects, icon_context, version=my.version, return_dict=True) # verify if we get icon for all if len(my.data) < len(my.sobjects): publish_data = Snapshot.get_by_sobjects(my.sobjects, my.DEFAULT_CONTEXT, version=my.version, return_dict=True) my._update_data(publish_data) # verify if we get icon for all if len(my.data) < len(my.sobjects): publish_data = Snapshot.get_by_sobjects(my.sobjects, process=my.DEFAULT_PROCESS, version=my.version, return_dict=True) my._update_data(publish_data) # verify if we get icon for all if len(my.data) < len(my.sobjects): publish_data = Snapshot.get_by_sobjects(my.sobjects, version=my.version, return_dict=True) my._update_data(publish_data) except SqlException, e: my.SQL_ERROR = True DbContainer.abort_thread_sql() return snapshots = my.data.values() # get all of the file objects file_objects = File.get_by_snapshots(snapshots) for file_object in file_objects: file_code = file_object.get_code() my.file_objects[file_code] = file_object