cache and dialog form issue
This commit is contained in:
parent
b50e675c31
commit
b22cdd0ce5
4 changed files with 19 additions and 19 deletions
|
|
@ -1108,7 +1108,7 @@ _f.set_value = function(dt, dn, fn, v) {
|
|||
var frm = wn.views.formview[d.parenttype].frm;
|
||||
} else {
|
||||
locals[d.doctype][d.name].__unsaved = 1;
|
||||
var frm = wn.views.formview[d.doctype].frm;
|
||||
var frm = wn.views.formview[d.doctype] && wn.views.formview[d.doctype].frm;
|
||||
}
|
||||
|
||||
if(frm && frm==cur_frm && frm.frm_head) {
|
||||
|
|
|
|||
|
|
@ -31,20 +31,25 @@ import webnotes
|
|||
@webnotes.whitelist()
|
||||
def clear(user=None):
|
||||
"""clear all cache"""
|
||||
import webnotes
|
||||
clear_cache(user)
|
||||
webnotes.response['message'] = "Cache Cleared"
|
||||
|
||||
def clear_cache(user=''):
|
||||
"""clear cache"""
|
||||
import webnotes
|
||||
if user:
|
||||
webnotes.conn.sql("delete from __SessionCache where user=%s", user)
|
||||
webnotes.conn.sql("update tabSessions set sessiondata=NULL where user=%s", user)
|
||||
else:
|
||||
webnotes.conn.sql("delete from __SessionCache")
|
||||
webnotes.conn.sql("update tabSessions set sessiondata=NULL")
|
||||
|
||||
# doctype cache
|
||||
import webnotes.utils.cache
|
||||
webnotes.utils.cache.clear()
|
||||
|
||||
# rebuild a cache for guest
|
||||
|
||||
if webnotes.session:
|
||||
webnotes.session['data'] = {}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,10 @@ setup() sets up cache
|
|||
|
||||
import webnotes
|
||||
|
||||
def clear():
|
||||
"""clear doctype cache"""
|
||||
webnotes.conn.sql("""delete from __CacheItem""")
|
||||
|
||||
class CacheItem:
|
||||
def __init__(self, key):
|
||||
"""create a new cache"""
|
||||
|
|
@ -57,8 +61,5 @@ class CacheItem:
|
|||
|
||||
def clear(self):
|
||||
"""clear the item"""
|
||||
try:
|
||||
webnotes.conn.sql("delete from __CacheItem where `key`=%s", self.key)
|
||||
except Exception, e:
|
||||
if e.args[0]!=1146: # ignore table not existing
|
||||
raise e
|
||||
webnotes.conn.sql("delete from __CacheItem where `key`=%s", self.key)
|
||||
|
||||
|
|
|
|||
18
wnf.py
18
wnf.py
|
|
@ -130,9 +130,6 @@ def setup_options():
|
|||
parser.add_option("--replace", nargs=3, default=False,
|
||||
metavar = "search replace_by extension",
|
||||
help="file search-replace")
|
||||
|
||||
parser.add_option("--cci", nargs=1, metavar="CacheItem Key or all",
|
||||
help="Clear Cache Item")
|
||||
|
||||
parser.add_option("--sync_all", help="Synchronize all DocTypes using txt files",
|
||||
nargs=0)
|
||||
|
|
@ -169,7 +166,11 @@ def run():
|
|||
elif options.clear:
|
||||
from build.project import update_version
|
||||
print "Version:" + str(update_version())
|
||||
|
||||
import webnotes.utils.cache
|
||||
webnotes.conn.begin()
|
||||
webnotes.utils.cache.clear()
|
||||
webnotes.conn.commit()
|
||||
|
||||
# code replace
|
||||
elif options.replace:
|
||||
replace_code('.', options.replace[0], options.replace[1], options.replace[2])
|
||||
|
|
@ -245,14 +246,7 @@ def run():
|
|||
elif options.run_scheduler_event is not None:
|
||||
import webnotes.utils.scheduler
|
||||
print webnotes.utils.scheduler.trigger('execute_' + options.run_scheduler_event)
|
||||
|
||||
elif options.cci is not None:
|
||||
if options.cci=='all':
|
||||
webnotes.conn.sql("DELETE FROM __CacheItem")
|
||||
else:
|
||||
from webnotes.utils.cache import CacheItem
|
||||
CacheItem(options.cci).clear()
|
||||
|
||||
|
||||
elif options.sync_all is not None:
|
||||
import webnotes.model.sync
|
||||
webnotes.model.sync.sync_all(options.force or 0)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue