modules Package

modules Package

Utilities for using modules

webnotes.modules.get_file_timestamp(fn)[source]

Returns timestamp of the given file

webnotes.modules.get_item_file(module, dt, dn)[source]

Returns the path of the item file

webnotes.modules.get_item_timestamp(module, dt, dn)[source]

Return ths timestamp of the given item (if exists)

webnotes.modules.get_module_path(module)[source]

Returns path of the given module (imports it and reads it from __file__)

webnotes.modules.scrub(txt)[source]
webnotes.modules.scrub_dt_and_dn(dt, dn)[source]

Returns in lowercase and code friendly names of doctype and name for certain types

webnotes.modules.switch_module(dt, dn, to, frm=None, export=None)[source]

Change the module of the given doctype, if export is true, then also export txt and copy code files from src

compress Module

Load compressed .js page scripts

Will also replace $import(page) or $import(module.page) with the relevant js files

class webnotes.modules.compress.JavascriptMinify[source]

Bases: object

minify(instream, outstream)[source]
exception webnotes.modules.compress.UnterminatedComment[source]

Bases: exceptions.Exception

exception webnotes.modules.compress.UnterminatedRegularExpression[source]

Bases: exceptions.Exception

exception webnotes.modules.compress.UnterminatedStringLiteral[source]

Bases: exceptions.Exception

webnotes.modules.compress.compress(src, comp)[source]
webnotes.modules.compress.get_doctype_js(dt)[source]

Returns the client-side (js) code of the DocType. Adds custom script and replaces $import(dt) with the code of that DocType

webnotes.modules.compress.get_js_code(fn, extn='js')[source]

Get js code from a file (uncompressed)

webnotes.modules.compress.get_page_js(page, module=None)[source]

Returns the js code of a page. Will replace $import (page) or $import(module.page) with the code from the file

webnotes.modules.compress.isAlphanum(c)[source]

return true if the character is a letter, digit, underscore, dollar sign, or non-ASCII character.

webnotes.modules.compress.jsmin(js)[source]
webnotes.modules.compress.sub_get_doctype_js(match)[source]
webnotes.modules.compress.sub_get_page_js(match)[source]

export_module Module

webnotes.modules.export_module.clear_code_fields(doclist, folder, code_type)[source]
webnotes.modules.export_module.create_folder(module, dt, dn)[source]
webnotes.modules.export_module.create_init_py(modules_path, module, dt, dn)[source]
webnotes.modules.export_module.export_to_files(record_list=[], record_module=None, verbose=0)[source]
webnotes.modules.export_module.get_module_name(doclist, record_module=None)[source]
webnotes.modules.export_module.write_document_file(doclist, record_module=None)[source]

import_module Module

Imports Documents from modules (.txt) files in the filesystem

webnotes.modules.import_module.accept_module(super_doclist)[source]
webnotes.modules.import_module.get_all_doclist(folder_list)[source]
webnotes.modules.import_module.get_doclist(path, doctype, docname)[source]

returns a doclist (list of dictionaries) of multiple records for the given parameters

webnotes.modules.import_module.get_folder_paths(modules, record_list)[source]
webnotes.modules.import_module.import_attachments(m)[source]
webnotes.modules.import_module.import_file(module, doctype, docname, path=None)[source]

imports a given file into the database

webnotes.modules.import_module.import_from_files(modules=[], record_list=[], sync_cp=0, target_db=None, target_ac=None)[source]
webnotes.modules.import_module.import_module(module, verbose=0)[source]

imports the all the records and files from the given module

webnotes.modules.import_module.listfolders(path, only_name=0)[source]

returns the list of folders (with paths) in the given path, if only_name is set, it returns only the folder names

webnotes.modules.import_module.update_module_timestamp(mod)[source]
webnotes.modules.import_module.update_module_timestamp_query(mod, timestamp)[source]

module_manager Module

webnotes.modules.module_manager.get_doc_list(dt)[source]

returns the list of records and their last update times from the table if the column _last_update does not exist, it will add it to the table

webnotes.modules.module_manager.get_last_update_for(mod)[source]
webnotes.modules.module_manager.get_modified(dt, dn)[source]
webnotes.modules.module_manager.get_module_details(m)[source]
webnotes.modules.module_manager.get_module_items_from_files(m)[source]
webnotes.modules.module_manager.get_modules_from_filesystem()[source]
webnotes.modules.module_manager.init_db_login(ac_name, db_name)[source]
webnotes.modules.module_manager.reload_doc(module, dt, dn)[source]

alias for webnotes.modules.import_module.import_file

webnotes.modules.module_manager.sync_meta()[source]
webnotes.modules.module_manager.sync_one_doc(d, dt, ts)[source]

patch Module

webnotes.modules.patch.run(log_exception=1)[source]
webnotes.modules.patch.write_log()[source]

Table Of Contents

This Page