예제 #1
0
파일: boot.py 프로젝트: erpnext-tm/frappe
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)
예제 #2
0
파일: boot.py 프로젝트: henriblancke/frappe
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)
예제 #3
0
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
예제 #4
0
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
예제 #5
0
파일: report.py 프로젝트: fogueri/frappe
 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"))
예제 #6
0
    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)
예제 #7
0
파일: boot.py 프로젝트: ddimmich/erpnext
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"})
예제 #8
0
파일: newsletter.py 프로젝트: tardi/erpnext
    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"))
예제 #9
0
	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]
예제 #10
0
	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]
예제 #11
0
	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"))
예제 #12
0
	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."))
예제 #13
0
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
예제 #14
0
파일: uploader.py 프로젝트: skhendake/phr
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}
예제 #15
0
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
예제 #16
0
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
예제 #17
0
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
예제 #18
0
파일: uploader.py 프로젝트: skhendake/phr
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}
예제 #19
0
파일: uploader.py 프로젝트: pawaranand/phr
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}
예제 #20
0
	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)
예제 #21
0
    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()
예제 #22
0
파일: doctype.py 프로젝트: shivnamha/frappe
	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)
예제 #23
0
    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)
예제 #24
0
파일: boot.py 프로젝트: britlog/frappe
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)
예제 #25
0
파일: backups.py 프로젝트: fogueri/frappe
def get_backup_path():
    import os
    backup_path = frappe.utils.get_site_path(
        conf.get("backup_path", "public/backups"))
    return backup_path
예제 #26
0
 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)
예제 #27
0
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)
예제 #28
0
파일: file.py 프로젝트: erpnext-tm/frappe
def get_max_file_size():
    return cint(conf.get("max_file_size")) or 10485760
예제 #29
0
파일: report.py 프로젝트: BitMistDev/frappe
	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)
예제 #30
0
def load_conf_settings(bootinfo):
    from frappe import conf
    for key in ['developer_mode']:
        if key in conf: bootinfo[key] = conf.get(key)
예제 #31
0
def get_max_file_size():
	return conf.get('max_file_size') or 10485760
예제 #32
0
파일: boot.py 프로젝트: karkoonzaid/frappe
def load_conf_settings(bootinfo):
    from frappe import conf

    for key in ["developer_mode"]:
        if key in conf:
            bootinfo[key] = conf.get(key)
예제 #33
0
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)
예제 #34
0
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)
예제 #35
0
파일: file.py 프로젝트: puspita-sari/frappe
def get_max_file_size():
    return conf.get('max_file_size') or 10485760
예제 #36
0
def get_backup_path():
	backup_path = frappe.utils.get_site_path(conf.get("backup_path", "private/backups"))
	return backup_path
예제 #37
0
파일: backups.py 프로젝트: marchon/frappe4
def get_backup_path():
    backup_path = frappe.utils.get_site_path(
        conf.get("backup_path", "private/backups"))
    return backup_path
예제 #38
0
def get_backup_path():
	"""
		Provides backup path location
	"""
	backup_path = frappe.utils.get_site_path(conf.get("backup_path", "private/backups"))
	return backup_path