Merge pull request #237 from alfonsodg/master

Added gitignore restrictions and changes for admin.py
This commit is contained in:
mdipierro
2013-10-06 08:13:58 -07:00
4 changed files with 9 additions and 11 deletions
+1
View File
@@ -55,3 +55,4 @@ applications/admin/cron/cron.master
HOWTO-web2py-devel HOWTO-web2py-devel
*.sublime-project *.sublime-project
*.sublime-workspace *.sublime-workspace
.idea/*
+5 -6
View File
@@ -353,7 +353,7 @@ def plugin_install(app, fobj, request, filename):
return False return False
def check_new_version(myversion, version_URL): def check_new_version(myversion, version_url):
""" """
Compares current web2py's version with the latest stable web2py version. Compares current web2py's version with the latest stable web2py version.
@@ -374,7 +374,7 @@ def check_new_version(myversion, version_URL):
""" """
try: try:
from urllib import urlopen from urllib import urlopen
version = urlopen(version_URL).read() version = urlopen(version_url).read()
pversion = parse_version(version) pversion = parse_version(version)
pmyversion = parse_version(myversion) pmyversion = parse_version(myversion)
except IOError: except IOError:
@@ -398,7 +398,7 @@ def unzip(filename, dir, subfolder=''):
raise RuntimeError('Not a valid zipfile') raise RuntimeError('Not a valid zipfile')
zf = zipfile.ZipFile(filename) zf = zipfile.ZipFile(filename)
if not subfolder.endswith('/'): if not subfolder.endswith('/'):
subfolder = subfolder + '/' subfolder += '/'
n = len(subfolder) n = len(subfolder)
for name in sorted(zf.namelist()): for name in sorted(zf.namelist()):
if not name.startswith(subfolder): if not name.startswith(subfolder):
@@ -432,11 +432,11 @@ def upgrade(request, url='http://web2py.com'):
web2py_version = request.env.web2py_version web2py_version = request.env.web2py_version
gluon_parent = request.env.gluon_parent gluon_parent = request.env.gluon_parent
if not gluon_parent.endswith('/'): if not gluon_parent.endswith('/'):
gluon_parent = gluon_parent + '/' gluon_parent += '/'
(check, version) = check_new_version(web2py_version, (check, version) = check_new_version(web2py_version,
url + '/examples/default/version') url + '/examples/default/version')
if not check: if not check:
return (False, 'Already latest version') return False, 'Already latest version'
if os.path.exists(os.path.join(gluon_parent, 'web2py.exe')): if os.path.exists(os.path.join(gluon_parent, 'web2py.exe')):
version_type = 'win' version_type = 'win'
destination = gluon_parent destination = gluon_parent
@@ -452,7 +452,6 @@ def upgrade(request, url='http://web2py.com'):
full_url = url + '/examples/static/web2py_%s.zip' % version_type full_url = url + '/examples/static/web2py_%s.zip' % version_type
filename = abspath('web2py_%s_downloaded.zip' % version_type) filename = abspath('web2py_%s_downloaded.zip' % version_type)
file = None
try: try:
write_file(filename, urllib.urlopen(full_url).read(), 'wb') write_file(filename, urllib.urlopen(full_url).read(), 'wb')
except Exception, e: except Exception, e:
+1 -3
View File
@@ -19,7 +19,6 @@ When web2py is running on Google App Engine,
caching will be provided by the GAE memcache caching will be provided by the GAE memcache
(see gluon.contrib.gae_memcache) (see gluon.contrib.gae_memcache)
""" """
import traceback
import time import time
import portalocker import portalocker
import shelve import shelve
@@ -278,7 +277,7 @@ class CacheOnDisk(CacheAbstract):
storage = shelve.open(self.shelve_name) storage = shelve.open(self.shelve_name)
except: except:
logger.error('corrupted cache file %s, will try rebuild it' logger.error('corrupted cache file %s, will try rebuild it'
% (self.shelve_name)) % self.shelve_name)
storage = None storage = None
if not storage and os.path.exists(self.shelve_name): if not storage and os.path.exists(self.shelve_name):
os.unlink(self.shelve_name) os.unlink(self.shelve_name)
@@ -479,7 +478,6 @@ class Cache(object):
if not session_ and public_: if not session_ and public_:
cache_control += ', public' cache_control += ', public'
expires = (current.request.utcnow + datetime.timedelta(seconds=time_expire)).strftime('%a, %d %b %Y %H:%M:%S GMT') expires = (current.request.utcnow + datetime.timedelta(seconds=time_expire)).strftime('%a, %d %b %Y %H:%M:%S GMT')
vary = None
else: else:
cache_control += ', private' cache_control += ', private'
expires = 'Fri, 01 Jan 1990 00:00:00 GMT' expires = 'Fri, 01 Jan 1990 00:00:00 GMT'
+2 -2
View File
@@ -1005,7 +1005,7 @@ def console():
if not os.path.exists('applications/__init__.py'): if not os.path.exists('applications/__init__.py'):
write_file('applications/__init__.py', '') write_file('applications/__init__.py', '')
return (options, args) return options, args
def check_existent_app(options, appname): def check_existent_app(options, appname):
@@ -1022,7 +1022,7 @@ def get_code_for_scheduler(app, options):
code = code % ("','".join(app[1:])) code = code % ("','".join(app[1:]))
app_ = app[0] app_ = app[0]
if not check_existent_app(options, app_): if not check_existent_app(options, app_):
print "Application '%s' doesn't exist, skipping" % (app_) print "Application '%s' doesn't exist, skipping" % app_
return None, None return None, None
return app_, code return app_, code