def main(): service_entry = _utils.file2str('tmpl/services_entry.tmpl') page = _utils.file2str('tmpl/services_page.tmpl') services_list = _services.get_services_list() if len(services_list) < 1: page = page % {'service-list':conf.no_services_msg} else: services_html = '' for entry in services_list: services_html += service_entry % entry page = page % {'service-list':services_html} return page
def main(): service_entry = _utils.file2str(conf.services_directory_entry_template) page = _utils.file2str(conf.services_directory_page_template) services_list = _services.get_services_list() vals = conf.services_directory_template_dict.copy() if services_list and len(services_list) < 0: services_html = '' for entry in services_list: services_html += service_entry % entry vals['service-list'] = services_html page = page % vals return page
def main(): service_entry = _utils.file2str('tmpl/services_entry.tmpl') page = _utils.file2str('tmpl/services_page.tmpl') services_list = _services.get_services_list() if not services_list: page = page % {'service-list': conf.no_services_msg} else: services_html = '' for entry in services_list: services_html += service_entry % entry page = page % {'service-list': services_html} return page
def update_services_cache(service,action = 'add'): logging.debug(service) logging.debug('updating cache') if os.path.exists(conf.services_cache): services = json.loads(_utils.file2str(conf.services_cache)) else: services = {} if action.lower() == 'add': services.update(service) logging.debug('Service added') elif action.lower() == 'del' and service in services: del services[service] logging.debug('Service removed') _utils.str2file(json.dumps(services),conf.services_cache)
def update_services_cache(service, action='add'): logging.debug(service) logging.debug('updating cache') if os.path.exists(conf.services_cache): services = json.loads(_utils.file2str(conf.services_cache)) else: services = {} if action.lower() == 'add': services.update(service) logging.debug('Service added') elif action.lower() == 'del' and service in services: del services[service] logging.debug('Service removed') _utils.str2file(json.dumps(services), conf.services_cache)