Fixes related to appification
This commit is contained in:
parent
51b14f8684
commit
da5f460fe4
4 changed files with 12 additions and 9 deletions
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from core.doctype.notification_count.notification_count import delete_notification_count_for
|
||||
from webnotes.core.doctype.notification_count.notification_count import delete_notification_count_for
|
||||
|
||||
|
||||
@webnotes.whitelist()
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ class Bean:
|
|||
if hasattr(self.controller, 'custom_' + method):
|
||||
getattr(self.controller, 'custom_' + method)(*args, **kwargs)
|
||||
|
||||
notify(self, method)
|
||||
notify(self, method, *args, **kwargs)
|
||||
|
||||
self.set_doclist(self.controller.doclist)
|
||||
|
||||
|
|
@ -487,11 +487,11 @@ def clone(source_wrapper):
|
|||
|
||||
return new_wrapper
|
||||
|
||||
def notify(bean, caller):
|
||||
def notify(bean, caller, *args, **kwargs):
|
||||
for hook in webnotes.get_hooks().bean_event or []:
|
||||
doctype, trigger, handler = hook.split(":")
|
||||
if ((doctype=="*") or (doctype==bean.doc.doctype)) and caller==trigger:
|
||||
webnotes.get_attr(handler)(bean, trigger)
|
||||
webnotes.get_attr(handler)(bean, trigger, *args, **kwargs)
|
||||
|
||||
# for bc
|
||||
def getlist(doclist, parentfield):
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ def get_system_managers(only_name=False):
|
|||
return [email.utils.formataddr((p.fullname, p.name)) for p in system_managers]
|
||||
|
||||
def add_role(profile, role):
|
||||
profile_wrapper = webnotes.bean("Profile", profile).get_controller().add_roles([role])
|
||||
profile_wrapper = webnotes.bean("Profile", profile).get_controller().add_roles(role)
|
||||
|
||||
def add_system_manager(email, first_name=None, last_name=None):
|
||||
# add profile
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import webnotes
|
|||
import json, os, time
|
||||
from webnotes import _
|
||||
import webnotes.utils
|
||||
from webnotes.model.controller import DocListController
|
||||
import mimetypes
|
||||
from webnotes.website.doctype.website_sitemap.website_sitemap import add_to_sitemap
|
||||
|
||||
|
|
@ -175,7 +176,6 @@ def get_website_settings():
|
|||
|
||||
return context
|
||||
|
||||
|
||||
def clear_cache(page_name=None):
|
||||
if page_name:
|
||||
delete_page_cache(page_name)
|
||||
|
|
@ -203,8 +203,11 @@ def is_signup_enabled():
|
|||
webnotes.local.is_signup_enabled = False
|
||||
|
||||
return webnotes.local.is_signup_enabled
|
||||
|
||||
class WebsiteGenerator(object):
|
||||
|
||||
def call_website_generator(bean, method):
|
||||
getattr(WebsiteGenerator(bean.doc, bean.doclist), method)()
|
||||
|
||||
class WebsiteGenerator(DocListController):
|
||||
def setup_generator(self):
|
||||
if webnotes.flags.in_install_app:
|
||||
return
|
||||
|
|
@ -251,7 +254,7 @@ class WebsiteGenerator(object):
|
|||
def on_trash(self):
|
||||
self.setup_generator()
|
||||
remove_page(self.doc.fields[self._website_config.page_name_field])
|
||||
|
||||
|
||||
def remove_page(page_name):
|
||||
if page_name:
|
||||
delete_page_cache(page_name)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue