def load_conf_settings(bootinfo): from frappe import conf bootinfo.max_file_size = conf.get("max_file_size") or 10485760 for key in ("developer_mode", "socketio_port", "file_watcher_port"): if key in conf: bootinfo[key] = conf.get(key)
def load_conf_settings(bootinfo): from frappe import conf bootinfo.max_file_size = conf.get("max_file_size") or 5242880 for key in ["developer_mode"]: if key in conf: bootinfo[key] = conf.get(key)
def get_redis_server(): """returns redis_socketio connection.""" global redis_server if not redis_server: from redis import Redis redis_server = Redis.from_url(conf.get("redis_socketio") or conf.get("async_redis_server") or "redis://localhost:12311") return redis_server
def get_redis_server(): """returns redis_socketio connection.""" global redis_server if not redis_server: from redis import Redis redis_server = Redis.from_url( conf.get("redis_socketio") or conf.get("async_redis_server") or "redis://localhost:12311") return redis_server
def export_doc(self): from frappe.modules.export_file import export_to_files if self.doc.is_standard == 'Yes' and (conf.get('developer_mode') or 0) == 1: export_to_files(record_list=[['Report', self.doc.name]], record_module=frappe.db.get_value( "DocType", self.doc.ref_doctype, "module"))
def on_update(self): """Update database schema, make controller templates if `custom` is not set and clear cache.""" from frappe.model.db_schema import updatedb updatedb(self.name, self) self.change_modified_of_parent() make_module_and_roles(self) self.update_fields_to_fetch() from frappe import conf if not self.custom and not ( frappe.flags.in_import or frappe.flags.in_test) and conf.get('developer_mode'): self.export_doc() self.make_controller_template() # update index if not self.custom: self.run_module_method("on_doctype_update") if self.flags.in_insert: self.run_module_method("after_doctype_insert") delete_notification_count_for(doctype=self.name) frappe.clear_cache(doctype=self.name)
def boot_session(bootinfo): """boot session - send website info if guest""" import frappe import frappe.model.doc bootinfo['custom_css'] = frappe.db.get_value('Style Settings', None, 'custom_css') or '' bootinfo['website_settings'] = frappe.model.doc.getsingle('Website Settings') if frappe.session['user']!='Guest': bootinfo['letter_heads'] = get_letter_heads() load_country_and_currency(bootinfo) import frappe.model.doctype bootinfo['notification_settings'] = frappe.doc("Notification Control", "Notification Control").get_values() # if no company, show a dialog box to create a new company bootinfo["customer_count"] = frappe.db.sql("""select count(*) from tabCustomer""")[0][0] if not bootinfo["customer_count"]: bootinfo['setup_complete'] = frappe.db.sql("""select name from tabCompany limit 1""") and 'Yes' or 'No' # load subscription info from frappe import conf for key in ['max_users', 'expires_on', 'max_space', 'status', 'commercial_support']: if key in conf: bootinfo[key] = conf.get(key) bootinfo['docs'] += frappe.db.sql("""select name, default_currency, cost_center from `tabCompany`""", as_dict=1, update={"doctype":":Company"})
def validate_send(self): if self.get("__islocal"): throw(_("Please save the Newsletter before sending")) from frappe import conf if (conf.get("status") or None) == "Trial": throw(_("Newsletters is not allowed for Trial users"))
def on_update(self): """Update database schema, make controller templates if `custom` is not set and clear cache.""" from frappe.model.db_schema import updatedb updatedb(self.name, self) self.change_modified_of_parent() make_module_and_roles(self) self.update_fields_to_fetch() from frappe import conf if not self.custom and not (frappe.flags.in_import or frappe.flags.in_test) and conf.get('developer_mode'): self.export_doc() self.make_controller_template() if self.has_web_view: self.set_base_class_for_controller() # update index if not self.custom: self.run_module_method("on_doctype_update") if self.flags.in_insert: self.run_module_method("after_doctype_insert") delete_notification_count_for(doctype=self.name) frappe.clear_cache(doctype=self.name) if not frappe.flags.in_install and hasattr(self, 'before_update'): self.sync_global_search() # clear from local cache if self.name in frappe.local.meta_cache: del frappe.local.meta_cache[self.name]
def validate_send(self): if self.doc.fields.get("__islocal"): throw(_("Please save the Newsletter before sending.")) from frappe import conf if (conf.get("status") or None) == "Trial": throw(_("Sending newsletters is not allowed for Trial users, \ to prevent abuse of this feature."))
def check_max_file_size(content): max_file_size = conf.get('max_file_size') or 1000000 file_size = len(content) if file_size > max_file_size: frappe.msgprint(_("File size exceeded the maximum allowed size"), raise_exception=MaxFileSizeReachedError) return file_size
def check_max_file_size(content): max_file_size = conf.get('max_file_size') or 20971520 file_size = len(content) if file_size > max_file_size: return {'exe': "File size exceeded the maximum allowed size of {0} MB".format( max_file_size / 1048576)} return {"file_size":file_size}
def check_max_file_size(content): max_file_size = conf.get('max_file_size') or 5242880 file_size = len(content) if file_size > max_file_size: frappe.msgprint(_("File size exceeded the maximum allowed size of {0} MB").format( max_file_size / 1048576), raise_exception=MaxFileSizeReachedError) return file_size
def check_max_file_size(content): max_file_size = conf.get('max_file_size') or 3145728 file_size = len(content) if file_size > max_file_size: frappe.msgprint(_("File size exceeded the maximum allowed size of {0} MB").format( max_file_size / 1048576), raise_exception=MaxFileSizeReachedError) return file_size
def check_max_file_size(content): max_file_size = conf.get('max_file_size') or 20971520 file_size = len(content) if file_size > max_file_size: return { 'exe': "File size exceeded the maximum allowed size of {0} MB".format( max_file_size / 1048576) } return {"file_size": file_size}
def check_max_file_size(content): max_file_size = conf.get('max_file_size') or 20971520 file_size = len(content) if file_size > max_file_size: # frappe.msgprint(_("File size exceeded the maximum allowed size of {0} MB").format( # max_file_size / 1048576), # raise_exception=MaxFileSizeReachedError) return {'exe': "File size exceeded the maximum allowed size of {0} MB".format( max_file_size / 1048576)} return {"file_size":file_size}
def on_update(self): from frappe.model.db_schema import updatedb updatedb(self.name) self.change_modified_of_parent() make_module_and_roles(self) from frappe import conf if (not frappe.flags.in_import) and conf.get('developer_mode') or 0: self.export_doc() self.make_controller_template() # update index if not getattr(self, "custom", False): from frappe.modules import load_doctype_module module = load_doctype_module(self.name, self.module) if hasattr(module, "on_doctype_update"): module.on_doctype_update() frappe.clear_cache(doctype=self.name)
def on_update(self): """Update database schema, make controller templates if `custom` is not set and clear cache.""" self.delete_duplicate_custom_fields() try: frappe.db.updatedb(self.name, self) except Exception as e: print("\n\nThere was an issue while migrating the DocType: {}\n". format(self.name)) raise e self.change_modified_of_parent() make_module_and_roles(self) self.update_fields_to_fetch() from frappe import conf allow_doctype_export = frappe.flags.allow_doctype_export or ( not frappe.flags.in_test and conf.get('developer_mode')) if not self.custom and not frappe.flags.in_import and allow_doctype_export: self.export_doc() self.make_controller_template() if self.has_web_view: self.set_base_class_for_controller() # update index if not self.custom: self.run_module_method("on_doctype_update") if self.flags.in_insert: self.run_module_method("after_doctype_insert") delete_notification_count_for(doctype=self.name) frappe.clear_cache(doctype=self.name) if not frappe.flags.in_install and hasattr(self, 'before_update'): self.sync_global_search() # clear from local cache if self.name in frappe.local.meta_cache: del frappe.local.meta_cache[self.name] clear_linked_doctype_cache()
def on_update(self): """Update database schema, make controller templates if `custom` is not set and clear cache.""" from frappe.model.db_schema import updatedb updatedb(self.name) self.change_modified_of_parent() make_module_and_roles(self) from frappe import conf if not self.custom and not (frappe.flags.in_import or frappe.flags.in_test) and conf.get('developer_mode'): self.export_doc() self.make_controller_template() # update index if not self.custom: self.run_module_method("on_doctype_update") if self.flags.in_insert: self.run_module_method("after_doctype_insert") delete_notification_count_for(doctype=self.name) frappe.clear_cache(doctype=self.name)
def on_update(self): """Update database schema, make controller templates if `custom` is not set and clear cache.""" from frappe.model.db_schema import updatedb updatedb(self.name) self.change_modified_of_parent() make_module_and_roles(self) from frappe import conf if not (frappe.flags.in_import or frappe.flags.in_test) and conf.get('developer_mode') or 0: self.export_doc() self.make_controller_template() # update index if not getattr(self, "custom", False): from frappe.modules import load_doctype_module module = load_doctype_module(self.name, self.module) if hasattr(module, "on_doctype_update"): module.on_doctype_update() delete_notification_count_for(doctype=self.name) frappe.clear_cache(doctype=self.name)
def load_conf_settings(bootinfo): from frappe import conf bootinfo.max_file_size = conf.get('max_file_size') or 10485760 for key in ('developer_mode', 'socketio_port', 'file_watcher_port'): if key in conf: bootinfo[key] = conf.get(key)
def get_backup_path(): import os backup_path = frappe.utils.get_site_path( conf.get("backup_path", "public/backups")) return backup_path
def export_doc(self): from frappe.modules.export_file import export_to_files if self.is_standard == 'Yes' and (conf.get('developer_mode') or 0) == 1: export_to_files(record_list=[['Report', self.name]], record_module=self.module)
def load_conf_settings(bootinfo): from frappe import conf bootinfo.max_file_size = conf.get('max_file_size') or 10485760 for key in ['developer_mode']: if key in conf: bootinfo[key] = conf.get(key)
def get_max_file_size(): return cint(conf.get("max_file_size")) or 10485760
def load_conf_settings(bootinfo): from frappe import conf for key in ['developer_mode']: if key in conf: bootinfo[key] = conf.get(key)
def get_max_file_size(): return conf.get('max_file_size') or 10485760
def load_conf_settings(bootinfo): from frappe import conf for key in ["developer_mode"]: if key in conf: bootinfo[key] = conf.get(key)
def get_backup_path(): backup_path = frappe.utils.get_site_path(conf.get("backup_path", "private/backups")) return backup_path
def get_backup_path(): backup_path = frappe.utils.get_site_path( conf.get("backup_path", "private/backups")) return backup_path
def get_backup_path(): """ Provides backup path location """ backup_path = frappe.utils.get_site_path(conf.get("backup_path", "private/backups")) return backup_path