def complete_remove_entity(self, coll_id, type_id, entity_id, default_continuation_url, request_params): """ Complete action to remove an entity. """ continuation_url = ( request_params.get('completion_url', None) or default_continuation_url ) continuation_url_params = continuation_params(request_params) viewinfo = DisplayInfo(self, "delete", request_params, continuation_url) viewinfo.get_site_info(self.get_request_host()) viewinfo.get_coll_info(coll_id) viewinfo.get_type_info(type_id) viewinfo.check_authorization("delete") if viewinfo.http_response: return viewinfo.http_response typeinfo = viewinfo.entitytypeinfo message_vals = {'id': entity_id, 'type_id': type_id, 'coll_id': coll_id} messages = ( { 'entity_removed': typeinfo.entitymessages['entity_removed']%message_vals }) err = typeinfo.entityclass.remove(typeinfo.entityparent, entity_id) if err: return self.redirect_error( continuation_url, continuation_url_params, error_message=str(err) ) return self.redirect_info( continuation_url, continuation_url_params, info_message=messages['entity_removed'] )
def complete_remove_entity(self, coll_id, type_id, entity_id, default_continuation_url, request_params): """ Complete action to remove an entity. """ continuation_url = (request_params.get('completion_url', None) or default_continuation_url) continuation_url_params = continuation_params(request_params) viewinfo = DisplayInfo(self, "delete", request_params, continuation_url) viewinfo.get_site_info(self.get_request_host()) viewinfo.get_coll_info(coll_id) viewinfo.get_type_info(type_id) viewinfo.check_authorization("delete") if viewinfo.http_response: return viewinfo.http_response typeinfo = viewinfo.entitytypeinfo message_vals = { 'id': entity_id, 'type_id': type_id, 'coll_id': coll_id } messages = ({ 'entity_removed': typeinfo.entitymessages['entity_removed'] % message_vals }) err = typeinfo.entityclass.remove(typeinfo.entityparent, entity_id) if err: return self.redirect_error(continuation_url, continuation_url_params, error_message=str(err)) return self.redirect_info(continuation_url, continuation_url_params, info_message=messages['entity_removed'])
def collection_view_setup(self, coll_id, action): """ Assemble display information for collection view request handler """ viewinfo = DisplayInfo(self, action) viewinfo.get_site_info(self.get_request_host()) viewinfo.get_coll_info(coll_id) viewinfo.check_authorization(action) return viewinfo
def list_setup(self, coll_id, type_id, list_id): """ Assemble display information for list view request handler """ listinfo = DisplayInfo(self, "list") listinfo.get_site_info(self.get_request_host()) listinfo.get_coll_info(coll_id) listinfo.get_type_info(type_id) listinfo.get_list_info(listinfo.get_list_id(listinfo.type_id, list_id)) listinfo.check_authorization("list") return listinfo
def collection_edit_setup(self, coll_id, action, request_dict): """ Assemble display information for collection view request handler """ viewinfo = DisplayInfo(self, action, request_dict, self.default_continuation) viewinfo.get_site_info(self.get_request_host()) viewinfo.get_coll_info(coll_id) viewinfo.get_request_type_info(entitytypeinfo.COLL_ID) viewinfo.check_authorization(action) self.default_continuation = self.view_uri("AnnalistCollectionView", coll_id=coll_id) return viewinfo
def view_setup(self, coll_id, request_dict): """ Assemble display information for view request handler """ action = "view" self.default_continuation_url = None viewinfo = DisplayInfo(self, action, request_dict, self.default_continuation_url) viewinfo.get_site_info(self.get_request_host()) viewinfo.get_coll_info(coll_id) viewinfo.get_type_info(entitytypeinfo.COLL_ID) viewinfo.check_authorization(action) return viewinfo
def list_setup(self, coll_id, type_id, list_id, request_dict): """ Assemble display information for list view request handlers """ # log.info("list_setup coll_id %s, type_id %s, list_id %s"%(coll_id, type_id, list_id)) self.collection_view_url = self.view_uri("AnnalistCollectionView", coll_id=coll_id) listinfo = DisplayInfo(self, "list", request_dict, self.collection_view_url) listinfo.get_site_info(self.get_request_host()) listinfo.get_coll_info(coll_id) listinfo.get_type_info(type_id) listinfo.get_list_info(listinfo.get_list_id(listinfo.type_id, list_id)) listinfo.check_authorization("list") return listinfo
def view_setup(self, action, coll_id, type_id, view_id, entity_id): """ Assemble display information for entity view request handler """ viewinfo = DisplayInfo(self, action) viewinfo.get_site_info(self.get_request_host()) viewinfo.get_coll_info(coll_id) viewinfo.get_type_info(type_id) viewinfo.get_view_info(viewinfo.get_view_id(type_id, view_id)) viewinfo.get_entity_info(action, entity_id) # viewinfo.get_entity_data() viewinfo.check_authorization(action) return viewinfo
def collection_view_setup(self, coll_id, action, request_dict): """ Assemble display information for collection view request handler """ viewinfo = DisplayInfo(self, action, request_dict, self.default_continuation) viewinfo.get_site_info(self.get_request_host()) viewinfo.get_coll_info(coll_id) viewinfo.check_authorization(action) self.default_continuation = self.view_uri("AnnalistCollectionView", coll_id=coll_id) if not viewinfo.http_response: errs = migrate_coll_config_dirs(viewinfo.collection) if errs: viewinfo.report_error("\n".join(errs)) return viewinfo
def list_setup(self, coll_id, type_id, list_id, request_dict): """ Assemble display information for list view request handlers """ # log.info("list_setup coll_id %s, type_id %s, list_id %s"%(coll_id, type_id, list_id)) self.collection_view_url = self.get_collection_view_url(coll_id) listinfo = DisplayInfo(self, "list", request_dict, self.collection_view_url) listinfo.get_site_info(self.get_request_host()) listinfo.get_coll_info(coll_id) listinfo.get_request_type_info(type_id) listinfo.get_list_info(listinfo.get_list_id(listinfo.type_id, list_id)) listinfo.check_authorization("list") return listinfo
def view_setup(self, coll_id, type_id, entity_id, request_dict): """ Assemble display information for entity view request handler """ action = "view" #@@ self.site_view_url = self.view_uri("AnnalistSiteView") #@@ self.collection_view_url = self.view_uri("AnnalistCollectionView", coll_id=coll_id) self.default_continuation_url = None viewinfo = DisplayInfo(self, action, request_dict, self.default_continuation_url) viewinfo.get_site_info(self.get_request_host()) viewinfo.get_coll_info(coll_id) viewinfo.get_type_info(type_id) viewinfo.get_entity_info(action, entity_id) # viewinfo.get_entity_data() viewinfo.check_authorization(action) return viewinfo
def get(self, request): """ Create a rendering of the current site home page, containing (among other things) a list of defined collections. """ viewinfo = DisplayInfo(self, "view", {}, None) # No continuation viewinfo.get_site_info(self.get_request_host()) viewinfo.get_coll_info(layout.SITEDATA_ID) viewinfo.get_request_type_info(entitytypeinfo.COLL_ID) viewinfo.check_authorization("view") if viewinfo.http_response: return viewinfo.http_response self.help_markdown = viewinfo.collection.get(RDFS.CURIE.comment, None) resultdata = viewinfo.sitedata resultdata.update(viewinfo.context_data()) # log.info("SiteView.get: site_data %r"%(self.site_data())) return (self.check_site_data() or self.render_html(resultdata, 'annalist_site.html') or self.error(self.error406values()))
def get(self, request): """ Create a rendering of the current site home page, containing (among other things) a list of defined collections. """ viewinfo = DisplayInfo(self, "view", {}, None) # No continuation viewinfo.get_site_info(self.get_request_host()) viewinfo.get_coll_info(layout.SITEDATA_ID) viewinfo.get_type_info(entitytypeinfo.COLL_ID) viewinfo.check_authorization("view") if viewinfo.http_response: return viewinfo.http_response self.help_markdown = viewinfo.collection.get(RDFS.CURIE.comment, None) resultdata = viewinfo.sitedata resultdata.update(viewinfo.context_data()) # log.info("SiteView.get: site_data %r"%(self.site_data())) return ( self.check_site_data() or self.render_html(resultdata, 'annalist_site.html') or self.error(self.error406values()) )