diff --git a/applications/admin/controllers/pythonanywhere.py b/applications/admin/controllers/pythonanywhere.py index e61b06ab..d9989cee 100644 --- a/applications/admin/controllers/pythonanywhere.py +++ b/applications/admin/controllers/pythonanywhere.py @@ -5,7 +5,7 @@ import re import gzip import tarfile from gluon.contrib.simplejsonrpc import ServerProxy -from gluon._compat import StringIO, ProtocolError +from gluon._compat import StringIO, ProtocolError, urlencode, urllib2 def deploy(): response.title = T('Deploy to pythonanywhere') @@ -26,9 +26,8 @@ def create_account(): except ProtocolError as error: pass - import urllib, urllib2 url = 'https://www.pythonanywhere.com/api/web2py/create_account' - data = urllib.urlencode(request.vars) + data = urlencode(request.vars) req = urllib2.Request(url, data) try: diff --git a/applications/admin/static/js/web2py.js b/applications/admin/static/js/web2py.js index 7131727d..22b9f253 100644 --- a/applications/admin/static/js/web2py.js +++ b/applications/admin/static/js/web2py.js @@ -617,7 +617,7 @@ flash: function (message, status) { var flash = $('.w2p_flash'); web2py.hide_flash(); - flash.html(message).addClass(status); + flash.text(message).addClass(status); if (flash.html()) flash.append(' × ')[animateIn](); }, hide_flash: function () { diff --git a/applications/examples/static/js/web2py.js b/applications/examples/static/js/web2py.js index 7131727d..22b9f253 100644 --- a/applications/examples/static/js/web2py.js +++ b/applications/examples/static/js/web2py.js @@ -617,7 +617,7 @@ flash: function (message, status) { var flash = $('.w2p_flash'); web2py.hide_flash(); - flash.html(message).addClass(status); + flash.text(message).addClass(status); if (flash.html()) flash.append(' × ')[animateIn](); }, hide_flash: function () { diff --git a/applications/welcome/controllers/appadmin.py b/applications/welcome/controllers/appadmin.py index 74240e59..0188ade9 100644 --- a/applications/welcome/controllers/appadmin.py +++ b/applications/welcome/controllers/appadmin.py @@ -392,12 +392,11 @@ def ccache(): cache.disk.clear() session.flash += T("Disk Cleared") redirect(URL(r=request)) - + try: - from guppy import hpy - hp = hpy() + from pympler.asizeof import asizeof except ImportError: - hp = False + asizeof = False import shelve import os @@ -451,9 +450,9 @@ def ccache(): ram['ratio'] = 0 for key, value in iteritems(cache.ram.storage): - if hp: - ram['bytes'] += hp.iso(value[1]).size - ram['objects'] += hp.iso(value[1]).count + if asizeof: + ram['bytes'] += asizeof(value[1]) + ram['objects'] += 1 ram['entries'] += 1 if value[0] < ram['oldest']: ram['oldest'] = value[0] @@ -469,9 +468,9 @@ def ccache(): except (KeyError, ZeroDivisionError): disk['ratio'] = 0 else: - if hp: - disk['bytes'] += hp.iso(value[1]).size - disk['objects'] += hp.iso(value[1]).count + if asizeof: + disk['bytes'] += asizeof(value[1]) + disk['objects'] += 1 disk['entries'] += 1 if value[0] < disk['oldest']: disk['oldest'] = value[0] @@ -511,7 +510,7 @@ def ccache(): total['keys'] = key_table(total['keys']) return dict(form=form, total=total, - ram=ram, disk=disk, object_stats=hp != False) + ram=ram, disk=disk, object_stats=asizeof != False) def table_template(table): diff --git a/applications/welcome/static/js/web2py.js b/applications/welcome/static/js/web2py.js index 7131727d..22b9f253 100644 --- a/applications/welcome/static/js/web2py.js +++ b/applications/welcome/static/js/web2py.js @@ -617,7 +617,7 @@ flash: function (message, status) { var flash = $('.w2p_flash'); web2py.hide_flash(); - flash.html(message).addClass(status); + flash.text(message).addClass(status); if (flash.html()) flash.append(' × ')[animateIn](); }, hide_flash: function () { diff --git a/applications/welcome/views/appadmin.html b/applications/welcome/views/appadmin.html index 59b85563..8a9d3400 100644 --- a/applications/welcome/views/appadmin.html +++ b/applications/welcome/views/appadmin.html @@ -148,7 +148,7 @@ {{=T.M("(**%.0d MB**)", total['bytes'] / 1048576)}} {{pass}} {{else:}} - {{=T.M("**not available** (requires the Python [[guppy http://pypi.python.org/pypi/guppy/ popup]] library)")}} + {{=T.M("**not available** (requires the Python [[Pympler https://pypi.python.org/pypi/Pympler popup]] library)")}} {{pass}}

@@ -176,7 +176,7 @@ {{=T.M("(**%.0d MB**)", ram['bytes'] / 10485576)}} {{pass}} {{else:}} - {{=T.M("``**not available**``:red (requires the Python [[guppy http://pypi.python.org/pypi/guppy/ popup]] library)")}} + {{=T.M("``**not available**``:red (requires the Python [[Pympler https://pypi.python.org/pypi/Pympler popup]] library)")}} {{pass}}

@@ -205,7 +205,7 @@ {{=T.M("(**%.0d MB**)", disk['bytes'] / 1048576)}} {{pass}} {{else:}} - {{=T.M("``**not available**``:red (requires the Python [[guppy http://pypi.python.org/pypi/guppy/ popup]] library)")}} + {{=T.M("``**not available**``:red (requires the Python [[Pympler https://pypi.python.org/pypi/Pympler popup]] library)")}} {{pass}}

diff --git a/applications/welcome/views/layout.html b/applications/welcome/views/layout.html index ab477415..54dcf8d2 100644 --- a/applications/welcome/views/layout.html +++ b/applications/welcome/views/layout.html @@ -39,7 +39,7 @@ web2py -