This commit is contained in:
pallav_fdsi
2014-11-21 00:29:14 -05:00
9 changed files with 59 additions and 54 deletions

View File

@@ -693,6 +693,6 @@ def hooks():
ul_t = UL(_class='nav nav-list', _id="a_%s" % t['slug'], _style='display:none')
for op in t['method_hooks']:
ul_t.append(LI (op['name']))
ul_t.append(UL([LI(A(f['funcname'], _href=f['url']if 'url' in f else None)) for f in op['functions']]))
ul_t.append(UL([LI(A(f['funcname'], _class="editor_filelink", _href=f['url']if 'url' in f else None, **{'_data-lineno':f['lineno']-1})) for f in op['functions']]))
ul_main.append(ul_t)
return ul_main

View File

@@ -258,12 +258,16 @@ $(document).on('click', 'a.font_button', function (e) {
</div>
</div>
<section id="windows_divs" class="tab-content ">
<div id="window_todo" class="tab-pane container-fluid">
{{=LOAD('default', 'todolist.load', vars={'app':app}, ajax=True, timeout=60000, times="infinity")}}
</div>
<div id="window_shortcuts" class="tab-pane container-fluid">
{{include 'default/editor_shortcuts.html'}}
</div>
<div id="window_todo" class="tab-pane container-fluid">
{{=LOAD('default', 'todolist.load', vars={'app':app}, ajax=True, timeout=60000, times="infinity")}}
</div>
<div id="window_shortcuts" class="tab-pane container-fluid">
{{include 'default/editor_shortcuts.html'}}
</div>
<div id="window_dbhooks" class="tab-pane container-fluid">
<h4>Tables hooks</h4>
<div>{{=LOAD(url="/%s/appadmin/hooks" % app, ajax=True, timeout=60000, times="infinity")}}</div>
</div>
</section>
</div>
{{block footer}}
@@ -272,6 +276,7 @@ $(document).on('click', 'a.font_button', function (e) {
<ul id="windows_hooks" class="nav">
<li class=""><a href="#window_todo">TODO</a></li>
<li class=""><a href="#window_shortcuts">Shortcuts</a></li>
<li class=""><a href="#window_dbhooks">Hooks</a></li>
</ul>
</div>
</div>

View File

@@ -1,18 +1,17 @@
<div>
<h4>{{=T("Keyboard shortcuts")}}</h4>
<ul class="keybindings unstyled">
<li></li>
{{=shortcut('Ctrl+S', T('Save via Ajax'))}}
{{=shortcut('Ctrl+F11', T('Toggle Fullscreen'))}}
{{=shortcut('Shift+Esc', T('Exit Fullscreen'))}}
{{=shortcut('Ctrl-F / Cmd-F', T('Start searching'))}}
{{=shortcut('Ctrl-G / Cmd-G', T('Find Next'))}}
{{=shortcut('Shift-Ctrl-G / Shift-Cmd-G', T('Find Previous'))}}
{{=shortcut('Shift-Ctrl-F / Cmd-Option-F', T('Replace'))}}
{{=shortcut('Shift-Ctrl-R / Shift-Cmd-Option-F', T('Replace All'))}}
{{=shortcut('Ctrl-/ ', T('Toggle comment'))}}
{{=shortcut('Tab', T('Expand Abbreviation (html files only)'))}}
{{=shortcut('Ctrl-Space', T('Autocomplete Python Code'))}}
</ul>
</div>
<ul class="keybindings unstyled">
<li></li>
{{=shortcut('Ctrl+S', T('Save via Ajax'))}}
{{=shortcut('Ctrl+F11', T('Toggle Fullscreen'))}}
{{=shortcut('Shift+Esc', T('Exit Fullscreen'))}}
{{=shortcut('Ctrl-F / Cmd-F', T('Start searching'))}}
{{=shortcut('Ctrl-G / Cmd-G', T('Find Next'))}}
{{=shortcut('Shift-Ctrl-G / Shift-Cmd-G', T('Find Previous'))}}
{{=shortcut('Shift-Ctrl-F / Cmd-Option-F', T('Replace'))}}
{{=shortcut('Shift-Ctrl-R / Shift-Cmd-Option-F', T('Replace All'))}}
{{=shortcut('Ctrl-/ ', T('Toggle comment'))}}
{{=shortcut('Tab', T('Expand Abbreviation (html files only)'))}}
{{=shortcut('Ctrl-Space', T('Autocomplete Python Code'))}}
</ul>
</div>

View File

@@ -461,34 +461,24 @@ def ccache():
if value[0] < ram['oldest']:
ram['oldest'] = value[0]
ram['keys'].append((key, GetInHMS(time.time() - value[0])))
folder = os.path.join(request.folder,'cache')
if not os.path.exists(folder):
os.mkdir(folder)
locker = open(os.path.join(folder, 'cache.lock'), 'a')
portalocker.lock(locker, portalocker.LOCK_EX)
disk_storage = shelve.open(
os.path.join(folder, 'cache.shelve'))
try:
for key, value in disk_storage.items():
if isinstance(value, dict):
disk['hits'] = value['hit_total'] - value['misses']
disk['misses'] = value['misses']
try:
disk['ratio'] = disk['hits'] * 100 / value['hit_total']
except (KeyError, ZeroDivisionError):
disk['ratio'] = 0
else:
if hp:
disk['bytes'] += hp.iso(value[1]).size
disk['objects'] += hp.iso(value[1]).count
disk['entries'] += 1
if value[0] < disk['oldest']:
disk['oldest'] = value[0]
disk['keys'].append((key, GetInHMS(time.time() - value[0])))
finally:
portalocker.unlock(locker)
locker.close()
disk_storage.close()
for key in cache.disk.storage:
value = cache.disk.storage[key]
if isinstance(value, dict):
disk['hits'] = value['hit_total'] - value['misses']
disk['misses'] = value['misses']
try:
disk['ratio'] = disk['hits'] * 100 / value['hit_total']
except (KeyError, ZeroDivisionError):
disk['ratio'] = 0
else:
if hp:
disk['bytes'] += hp.iso(value[1]).size
disk['objects'] += hp.iso(value[1]).count
disk['entries'] += 1
if value[0] < disk['oldest']:
disk['oldest'] = value[0]
disk['keys'].append((key, GetInHMS(time.time() - value[0])))
total['entries'] = ram['entries'] + disk['entries']
total['bytes'] = ram['bytes'] + disk['bytes']
@@ -703,6 +693,6 @@ def hooks():
ul_t = UL(_class='nav nav-list', _id="a_%s" % t['slug'], _style='display:none')
for op in t['method_hooks']:
ul_t.append(LI (op['name']))
ul_t.append(UL([LI(A(f['funcname'], _href=f['url']if 'url' in f else None)) for f in op['functions']]))
ul_t.append(UL([LI(A(f['funcname'], _class="editor_filelink", _href=f['url']if 'url' in f else None, **{'_data-lineno':f['lineno']-1})) for f in op['functions']]))
ul_main.append(ul_t)
return ul_main

View File

@@ -693,6 +693,6 @@ def hooks():
ul_t = UL(_class='nav nav-list', _id="a_%s" % t['slug'], _style='display:none')
for op in t['method_hooks']:
ul_t.append(LI (op['name']))
ul_t.append(UL([LI(A(f['funcname'], _href=f['url']if 'url' in f else None)) for f in op['functions']]))
ul_t.append(UL([LI(A(f['funcname'], _class="editor_filelink", _href=f['url']if 'url' in f else None, **{'_data-lineno':f['lineno']-1})) for f in op['functions']]))
ul_main.append(ul_t)
return ul_main

View File

@@ -276,6 +276,8 @@ class Collection(object):
table = db[tablename]
if 'json' in request.env.content_type:
data = request.post_vars.data
else:
data = request.post_vars
if request.get_vars or len(request.args)>1: # update
# ADD validate fields and return error
try:

View File

@@ -136,7 +136,7 @@ class OracleAdapter(BaseAdapter):
return self.log_execute(command, args)
def create_sequence_and_triggers(self, query, table, **args):
tablename = table._tablename
tablename = table._rname or table._tablename
id_name = table._id.name
sequence_name = table._sequence_name
trigger_name = table._trigger_name

View File

@@ -1204,6 +1204,13 @@ class SQLFORM(FORM):
field, default, _disabled=True)
else:
inp = field.formatter(default)
if getattr(field, 'show_if', None):
if not isinstance(inp, DIV):
# Create a container for string represents
inp = DIV(inp, _id='%s_%s' % (field.tablename, field.name))
trigger, cond = show_if(field.show_if)
inp['_data-show-trigger'] = trigger
inp['_data-show-if'] = cond
elif field.type == 'upload':
if field.widget:
inp = field.widget(field, default, upload)

View File

@@ -1544,7 +1544,9 @@ class Auth(object):
_href=item['href'])))
self.bar.insert(-1, LI('', _class='divider'))
if self.user_id:
self.bar = LI(Anr(prefix, user_identifier, _href='#'),
self.bar = LI(Anr(prefix, user_identifier,
_href='#',_class="dropdown-toggle",
data={'toggle':'dropdown'}),
self.bar,_class='dropdown')
else:
self.bar = LI(Anr(T('Log In'),