Merge ssh://github.com/web2py/web2py
This commit is contained in:
7
Makefile
7
Makefile
@@ -64,9 +64,10 @@ app:
|
||||
python2.7 -c 'import compileall; compileall.compile_dir("gluon/")'
|
||||
#python web2py.py -S welcome -R __exit__.py
|
||||
#cd ../web2py_osx/site-packages/; unzip ../site-packages.zip
|
||||
find gluon -path '*.pyc' -exec cp {} ../web2py_osx/site-packages/{} \;
|
||||
cd ../web2py_osx/site-packages/; zip -r ../site-packages.zip *
|
||||
mv ../web2py_osx/site-packages.zip ../web2py_osx/web2py/web2py.app/Contents/Resources/lib/python2.7
|
||||
#find gluon -path '*.pyc' -exec cp {} ../web2py_osx/site-packages/{} \;
|
||||
#cd ../web2py_osx/site-packages/; zip -r ../site-packages.zip *
|
||||
#mv ../web2py_osx/site-packages.zip ../web2py_osx/web2py/web2py.app/Contents/Resources/lib/python2.7
|
||||
find gluon -path '*.py' -exec cp {} ../web2py_osx/web2py/web2py.app/Contents/Resources/gluon/{} \;
|
||||
cp README.markdown ../web2py_osx/web2py/web2py.app/Contents/Resources
|
||||
cp NEWINSTALL ../web2py_osx/web2py/web2py.app/Contents/Resources
|
||||
cp LICENSE ../web2py_osx/web2py/web2py.app/Contents/Resources
|
||||
|
||||
2
VERSION
2
VERSION
@@ -1 +1 @@
|
||||
Version 2.4.7-stable+timestamp.2013.05.27.11.49.44
|
||||
Version 2.4.7-stable+timestamp.2013.05.31.08.28.32
|
||||
|
||||
@@ -1677,26 +1677,6 @@ def update_languages():
|
||||
redirect(URL('design', args=app, anchor='languages'))
|
||||
|
||||
|
||||
def twitter():
|
||||
session.forget()
|
||||
session._unlock(response)
|
||||
import gluon.tools
|
||||
import gluon.contrib.simplejson as sj
|
||||
try:
|
||||
if TWITTER_HASH:
|
||||
page = urllib.urlopen("http://search.twitter.com/search.json?q=%%40%s" % TWITTER_HASH).read()
|
||||
data = sj.loads(page, encoding="utf-8")['results']
|
||||
d = dict()
|
||||
for e in data:
|
||||
d[e["id"]] = e
|
||||
r = reversed(sorted(d))
|
||||
return dict(tweets=[d[k] for k in r])
|
||||
else:
|
||||
return 'disabled'
|
||||
except Exception, e:
|
||||
return DIV(T('Unable to download because:'), BR(), str(e))
|
||||
|
||||
|
||||
def user():
|
||||
if MULTI_USER_MODE:
|
||||
if not db(db.auth_user).count():
|
||||
|
||||
@@ -145,14 +145,8 @@
|
||||
<p>{{=button(URL('wizard','index'), T('Start wizard'))}}<br/>
|
||||
{{=T("(requires internet access, experimental)")}}</p>
|
||||
</div> <!-- /APP WIZARD -->
|
||||
{{if TWITTER_HASH:}}
|
||||
<!-- TWITTER -->
|
||||
<div class="box">
|
||||
<h4>{{=T("%s Recent Tweets"%TWITTER_HASH)}}</h4>
|
||||
<div id="tweets">{{=T('loading...')}}</div>
|
||||
<script>jQuery(document).ready(function(){jQuery('#tweets').load('{{=URL('twitter.load')}}');});</script>
|
||||
</div> <!-- /TWITTER -->
|
||||
{{pass}}
|
||||
<a class="twitter-timeline" href="https://twitter.com/web2py" data-widget-id="340456915207327745">Tweets by @web2py</a>
|
||||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
|
||||
</div>
|
||||
</div> <!-- /sidebar -->
|
||||
</div> <!-- /row-fluid
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -52,12 +52,8 @@ class DropboxAccount(object):
|
||||
self.sess = session.DropboxSession(
|
||||
self.key, self.secret, self.access_type)
|
||||
|
||||
def get_user(self):
|
||||
request = self.request
|
||||
if not current.session.dropbox_request_token:
|
||||
return None
|
||||
elif not current.session.dropbox_access_token:
|
||||
|
||||
def get_token(self):
|
||||
if not current.session.dropbox_access_token:
|
||||
request_token = current.session.dropbox_request_token
|
||||
self.sess.set_request_token(request_token[0], request_token[1])
|
||||
access_token = self.sess.obtain_access_token(self.sess.token)
|
||||
@@ -67,6 +63,10 @@ class DropboxAccount(object):
|
||||
access_token = current.session.dropbox_access_token
|
||||
self.sess.set_token(access_token[0], access_token[1])
|
||||
|
||||
def get_user(self):
|
||||
if not current.session.dropbox_request_token:
|
||||
return None
|
||||
self.get_token()
|
||||
user = Storage()
|
||||
self.client = client.DropboxClient(self.sess)
|
||||
data = self.client.account_info()
|
||||
@@ -99,8 +99,7 @@ class DropboxAccount(object):
|
||||
return next
|
||||
|
||||
def get_client(self):
|
||||
access_token = current.session.dropbox_access_token
|
||||
self.sess.set_token(access_token[0], access_token[1])
|
||||
self.get_token()
|
||||
self.client = client.DropboxClient(self.sess)
|
||||
|
||||
def put(self, filename, file):
|
||||
|
||||
@@ -2522,8 +2522,6 @@ class MySQLAdapter(BaseAdapter):
|
||||
self.execute('select last_insert_id();')
|
||||
return int(self.cursor.fetchone()[0])
|
||||
|
||||
def integrity_error_class(self):
|
||||
return self.cursor.IntegrityError
|
||||
|
||||
class PostgreSQLAdapter(BaseAdapter):
|
||||
drivers = ('psycopg2','pg8000')
|
||||
|
||||
114
setup_app.py
114
setup_app.py
@@ -8,11 +8,28 @@ Usage:
|
||||
python setup.py py2app
|
||||
"""
|
||||
|
||||
copy_apps = False
|
||||
copy_scripts = True
|
||||
copy_site_packages = True
|
||||
remove_build_files = True
|
||||
make_zip = True
|
||||
zip_filename = "web2py_osx"
|
||||
|
||||
from setuptools import setup
|
||||
from gluon.import_all import base_modules, contributed_modules
|
||||
from gluon.fileutils import readlines_file
|
||||
import os
|
||||
import fnmatch
|
||||
import shutil
|
||||
import sys
|
||||
import re
|
||||
import zipfile
|
||||
|
||||
#read web2py version from VERSION file
|
||||
web2py_version_line = readlines_file('VERSION')[0]
|
||||
#use regular expression to get just the version number
|
||||
v_re = re.compile('[0-9]+\.[0-9]+\.[0-9]+')
|
||||
web2py_version = v_re.search(web2py_version_line).group(0)
|
||||
|
||||
class reglob:
|
||||
def __init__(self, directory, pattern="*"):
|
||||
@@ -39,18 +56,105 @@ class reglob:
|
||||
return fullname
|
||||
|
||||
setup(app=['web2py.py'],
|
||||
version=web2py_version,
|
||||
description="web2py web framework",
|
||||
author="Massimo DiPierro",
|
||||
license="LGPL v3",
|
||||
data_files=[
|
||||
'NEWINSTALL',
|
||||
'ABOUT',
|
||||
'LICENSE',
|
||||
'VERSION',
|
||||
] +
|
||||
[x for x in reglob('applications/examples')] +
|
||||
[x for x in reglob('applications/welcome')] +
|
||||
[x for x in reglob('applications/admin')],
|
||||
'splashlogo.gif',
|
||||
'logging.example.conf',
|
||||
'options_std.py',
|
||||
],
|
||||
options={'py2app': {
|
||||
'argv_emulation': True,
|
||||
'includes': base_modules,
|
||||
'packages': contributed_modules,
|
||||
}},
|
||||
setup_requires=['py2app'])
|
||||
|
||||
|
||||
def copy_folders(source, destination):
|
||||
"""Copy files & folders from source to destination (within dist/)"""
|
||||
print 'copying %s -> %s' % (source, destination)
|
||||
base = 'dist/web2py.app/Contents/Resources/'
|
||||
if os.path.exists(os.path.join(base, destination)):
|
||||
shutil.rmtree(os.path.join(base, destination))
|
||||
shutil.copytree(os.path.join(source), os.path.join(base, destination))
|
||||
|
||||
#Should we include applications?
|
||||
copy_folders('gluon','gluon')
|
||||
|
||||
if copy_apps:
|
||||
copy_folders('applications', 'applications')
|
||||
print "Your application(s) have been added"
|
||||
else:
|
||||
#only copy web2py's default applications
|
||||
copy_folders('applications/admin', 'applications/admin')
|
||||
copy_folders('applications/welcome', 'applications/welcome')
|
||||
copy_folders('applications/examples', 'applications/examples')
|
||||
print "Only web2py's admin, examples & welcome applications have been added"
|
||||
|
||||
|
||||
#should we copy project's site-packages into dist/site-packages
|
||||
if copy_site_packages:
|
||||
#copy site-packages
|
||||
copy_folders('site-packages', 'site-packages')
|
||||
else:
|
||||
#no worries, web2py will create the (empty) folder first run
|
||||
print "Skipping site-packages"
|
||||
pass
|
||||
|
||||
#should we copy project's scripts into dist/scripts
|
||||
if copy_scripts:
|
||||
#copy scripts
|
||||
copy_folders('scripts', 'scripts')
|
||||
else:
|
||||
#no worries, web2py will create the (empty) folder first run
|
||||
print "Skipping scripts"
|
||||
pass
|
||||
|
||||
|
||||
#borrowed from http://bytes.com/topic/python/answers/851018-how-zip-directory-python-using-zipfile
|
||||
def recursive_zip(zipf, directory, folder=""):
|
||||
for item in os.listdir(directory):
|
||||
if os.path.isfile(os.path.join(directory, item)):
|
||||
zipf.write(os.path.join(directory, item), folder + os.sep + item)
|
||||
elif os.path.isdir(os.path.join(directory, item)):
|
||||
recursive_zip(
|
||||
zipf, os.path.join(directory, item), folder + os.sep + item)
|
||||
|
||||
#should we create a zip file of the build?
|
||||
|
||||
if make_zip:
|
||||
#to keep consistent with how official web2py windows zip file is setup,
|
||||
#create a web2py folder & copy dist's files into it
|
||||
shutil.copytree('dist', 'zip_temp/web2py')
|
||||
#create zip file
|
||||
#use filename specified via command line
|
||||
zipf = zipfile.ZipFile(
|
||||
zip_filename + ".zip", "w", compression=zipfile.ZIP_DEFLATED)
|
||||
path = 'zip_temp' # just temp so the web2py directory is included in our zip file
|
||||
recursive_zip(
|
||||
zipf, path) # leave the first folder as None, as path is root.
|
||||
zipf.close()
|
||||
shutil.rmtree('zip_temp')
|
||||
print "Your Windows binary version of web2py can be found in " + \
|
||||
zip_filename + ".zip"
|
||||
print "You may extract the archive anywhere and then run web2py/web2py.exe"
|
||||
|
||||
#should py2exe build files be removed?
|
||||
if remove_build_files:
|
||||
shutil.rmtree('build')
|
||||
shutil.rmtree('deposit')
|
||||
shutil.rmtree('dist')
|
||||
print "py2exe build files removed"
|
||||
|
||||
#final info
|
||||
if not make_zip and not remove_build_files:
|
||||
print "Your Windows binary & associated files can also be found in /dist"
|
||||
|
||||
print "Finished!"
|
||||
print "Enjoy web2py " + web2py_version_line
|
||||
|
||||
Reference in New Issue
Block a user