[web2py] Using cxfreeze for creating web2py exe with custom libraries

2011-09-20 Thread Praneeth Bodduluri
Hello all,

I have been looking at using cxfreeze to create a web2py standalone
exe with custom libraries added in. Attached is the script used - Can
be used if you want to repackage web2py's windows exe adding in custom
libraries.

One of the major advantages of using cxfreeze for creating the
standalone exe is the avoidance of the need for copying MSVCR90.dll
to create the exe [ needed by py2exe -
http://www.py2exe.org/index.cgi/Tutorial#Step52 ]. This allows for
easy building of the standalone exe with python 2.7.


Massimo:

The quit function in gluon/widget.py needs the sys.exit replaced by
sys.exit(0) for the proper exit when using cxfreeze to create a
standalone exe. i.e line 325 of gluon/widget.py needs to be replaced
with sys.exit(0) . I would be grateful if you could make the change.

Best Regards,
Praneeth
#!/usr/bin/env python
# -*- coding: utf-8 -*-


Usage:
Install cx_Freeze: http://cx-freeze.sourceforge.net/
Copy script to the web2py directory
c:\Python27\python standalone_exe_cxfreeze.py build_exe

from cx_Freeze import setup, Executable
from gluon.import_all import base_modules, contributed_modules
from gluon.fileutils import readlines_file
from glob import glob
import fnmatch
import os
import shutil
import sys
import re

#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)

base = None

if sys.platform == 'win32':
base = Win32GUI

base_modules.remove('macpath')
buildOptions = dict(
compressed = True,
excludes = [macpath,PyQt4],
	includes = base_modules,
  	include_files=[
'applications',
'ABOUT',
'LICENSE',
'VERSION',
'logging.example.conf',
'options_std.py',
'app.example.yaml',
'queue.example.yaml',
],
# append any extra module by extending the list below -
# contributed_modules+[lxml]
packages = contributed_modules,
)

setup(
name = Web2py,
version=web2py_version,
author=Massimo DiPierro,
description=web2py web framework,
license = LGPL v3,
options = dict(build_exe = buildOptions),
executables = [Executable(web2py.py,
base=base,
compress = True,
icon = web2py.ico,
targetName=web2py.exe,
copyDependentFiles = True)],
)


Re: [web2py] Building web2py binary for windows with extra libs

2011-08-05 Thread Praneeth Bodduluri
Hello Syed,

It is possible for you to rebuild the web2py exe adding in your
required libraries.

The following links might be of help:

1) 
http://eden.sahanafoundation.org/browser/static/scripts/tools/standalone_exe.py
2) https://groups.google.com/d/topic/web2py/Lirvj_J8q1U/discussion


Regards,
Praneeth
IRC: lifeeth



On Fri, Aug 5, 2011 at 5:13 AM, Syed Mushtaq syed1.mush...@gmail.com wrote:
 Hi ,

 I have an app that I want to ship as a windows binary . I was looking at
 http://web2py.com/book/default/chapter/12#How-to-Distribute-your-Applications-as-Binaries
 . I use PIL in my
 app for doing some image manipulation . It is possible to generate the
 windows binary of web2py which includes PIL or any other library ?

 Thanks
 -Syed



Re: [web2py] web2py 1.96.2 is OUT security warning

2011-06-03 Thread Praneeth Bodduluri
Updated on pypi

--
Praneeth
IRC: lifeeth



On Fri, Jun 3, 2011 at 8:53 PM, Massimo Di Pierro
massimo.dipie...@gmail.com wrote:
 We fixed a few more bugs (strangely most of them preexisting 1.96.1).
 We also addressed two security issues as I will explain later in this
 email:

 here is am reporting the 1.96.1 changelog with some additions

 Changelog:
 - from gluon import * imports in every python module a web2py
 environment (A, DIV,..SQLFORM, DAL, Field,...) including
 current.request, current.response, current.session, current.T,
 current.cache, thanks Jonathan.
 - conditional models in
  models/controller/a.py and models/controller/function/a.py
 - from mymodule import *, looks for mymodule in applications/thisapp/
 modules first and then in sys.path. No more need for local_import.
 Thanks Pierre.
 - usage of generic.* views is - by default - restricted to localhost
 for security. This can be changed in a granular way with:
 response.generic_patterns=['*']. This is a slight change of behavior
 for new app but a major security fix.
 - all applications have cas 2.0 provider at http://.../user/cas/login
 - all applications can delegate to login to external provider
 Auth(...,cas_provider='http://.../other_app/default/user/cas')
 - A(...,callback=URL(...),larget='id') does Ajax
 - URL(...,user_signature=True), LOAD(...,user_signature=True) can
 sign
 urls and @auth.requires_signature() will check the signature for any
 decorated action.
 - DAL(...,migrate_enabled=False) to disable all migrations
 - DAL(...,fake_migrate_all=True) to rebuild all corrupted metadata
 - new DAL metadata format (databases/*.table)
 - DAL(...,adapter_arg={}) allows support for alternate drivers
 - DAL now allows circular table defintions
 - DAL(..,auto_import=True) automatically imports tables from metadata
 without need to db.define_table(...)s.
 - new alterante syntax for inner joins: db(...).select(join=...)
 - experimental cubrid database support
 - DAL 'request_tenant' fields are special, the altomatically filer
 all
 records based on their default value.
 - db._common_fields.append(Field('owner')) allows to add fields to
 ALL
 tables
 - DAL ignores repeated fields with same names
 - web2py_ajax.html is more modular, thanks Anthony
 - request.is_local
 - request.is_http
 - new sessions2trash.py thanks Jim Karsten
 - corrupted cache files are automatically deleted
 - new simpler API gluon.contrib.AuthorizeNet.procss(...)
 - fixed recaptcha (as they released new API)
 - messages in validators have default internationalization
 - No more Auth(globals(),db), just Auth(db). Same for Crud and
 Service.
 - scripts/access.wsgi allows apache+mod_wsgi to delegate
 authentication of any URL to any web2py app
 - json now supports T(...)
 - scripts/setup-web2py-nginx-uwsgi-ubuntu.sh
 - web2py HTTP responses now set: X-Powered-By: web2py, thanks Bruno
 - mostly fixed generic.pdf. You can view any page in PDF if you have
 pdflatex installed or if your html follows the pyfpdf convention.
 - auth.settings.extra_fields['auth_user'].append(Field('country'))
 allows to extend auth_* tables without need of definiting a custom
 auth_* table. Must be placed before auth.define_tables()
 - {{=response.toolbar()}} to help you debug applications
 - web based shell now supports object modifications (but no
 redefinitions of non-serializable types)
 - jQuery 1.6.1
 - more secure uuid function to protect sessions form cryptographic
 attacks
 - auto logout of appadmin
 - Lots of bug fixes

 ## Security wanring

 This release fixes two security issues:

 1) web2py used random to generate uuid. This is mostly fine but it was
 technically possible for an attacker to retrieve a lot of session
 uuids, extrapolate information about the pseudo-random-generator and
 use the information to guess somebody else's session. Our new
 contributor and security expert David Wager, spotted this problem and
 suggested rewriting the web2py uuid function used for generating
 session names. The new function uses /dev/urandom as entropy source
 and falls back to the old method when the entropy source is not
 available, issuing a warning.

 2) appadmin uses admin authentication but failed to detect expires
 sessions (60minutes). This has now been corrected.



Re: [web2py] web2py 1.96.1 is OUT

2011-06-02 Thread Praneeth Bodduluri
Also available on pypi, get it while it's hot.
On Jun 2, 2011 1:41 PM, Miguel Lopes mig.e.lo...@gmail.com wrote:
 On Wed, Jun 1, 2011 at 7:40 PM, Jason Brower encomp...@gmail.com wrote:

 Me does a dance. Thanks!
 And yes it makes rain :-)



Re: [web2py] Add gluon to global python path

2011-04-29 Thread Praneeth Bodduluri
You can do a pip install web2py that should put gluon in the global
path. Try it in a virtualenv.

--
Praneeth
IRC: lifeeth



On Fri, Apr 29, 2011 at 11:06 AM, luckysmack luckysm...@gmail.com wrote:
 Pretty much like the title says. This is also for things like when i
 open up a i/b/python shell, it would be cool to just be able to run
 'import gluon' or 'from gluon import foo'. Im sure this would also
 have other benefits as well, but im not sure. I tried doing 'import
 sys' and 'sys.path.append(/srv/sites/web2py/gluon)' but that didnt
 seem to work. i also tried it without the/gluon part. Is it worth it
 to do this? otherwise i can get the effect by opening a terminal and
 going to the web2py directory, opening the python shell and importing
 like that. This culd also be handy when running python scripts that
 are in different places on the system and wanting to be able to import
 something from gluon.


Re: [web2py] web2py 1.95.1 and open issues

2011-04-25 Thread Praneeth Bodduluri
Also available at the cheese shop

To install:

pip install web2py


To upgrade:

pip install web2py --upgrade


--
Praneeth
IRC: lifeeth



On Mon, Apr 25, 2011 at 7:49 PM, Stifan Kristi
steve.van.chris...@gmail.com wrote:
 great job, massimo n the others, i've download n test it. thank you so much.

 On Mon, Apr 25, 2011 at 9:06 PM, Massimo Di Pierro mdipie...@cs.depaul.edu
 wrote:

 Hello everybody,

 web2py 1.95.1 is out with lots of improvements and bug fixes:
 ## 1.95.1
 - Google MySQL support (experimental)
 - pip support, thanks lifeeth
 - better setup_exe.py, thanks meredyk
 - importved pyfpdf
 - domain check in email_auth.py, thanks Gyuris
 - added change_password_onvalidation and change_password_onaccept
 - DAL(...,migrate_enabled=True)
 - login_methods/loginza.py, thanks Vladimir
 - bpython shell support, thanks Arun
 - request.uuid and response.uuid (for a future toolbar)
 - db._timings contains database query timing info
 - efficient db(...).isempty()
 - setup-web2py-nginx-uwsgi-ubuntu.sh
 - Many bug fixes, thanks Jonathan

 Please check it out.

 I have many pending patches still to be applied and tested:
 - those documented in googlecode issues
 - the new custom_import

 Is there any outstanding issue that has not been submitted as an issue to
 googlecode?

 Massimo






Re: [web2py] MySQL, migration, and lower()

2011-04-20 Thread Praneeth Bodduluri
1) If you have no other schema changes a simpler solution would be to
just change all your table names manually to lower.
2) Hook the new version to a blank db and let it generate a dummy sql
table. swap the table with the one you changed the table names in step
1 - after turning off web2py i.e.

--
Praneeth
IRC: lifeeth



On Thu, Apr 21, 2011 at 12:32 AM, robe...@captivation.com
gummywubb...@gmail.com wrote:
 Hi Everybody,

 Yesterday evening I ran into some issues updating an app from 1.89.6
 to 1.94.5 -- specifically with case sensitivity in migrating tables.
 This occurs on an ubuntu ec2 instance, running mysql as installed by
 'aptitude install mysql-server' and accepting defaults.

 An example.

 The field is defined in models with

                    Field('splatToken'),

 The .table file before the migration contains

 p9
 sS'splatToken'

 The .table file after the first execution contains

 p9
 sS'splattoken'

 The next execution yields an exception in DAL.py migrate_table
 triggered off this test:
                  and not isinstance(table[key].type, SQLCustomType) \

 I was able to bypass the issue and continue by removing the .lower()
 calls in the sql_fields* assignments up above.


 So, my app is running as it needs to be, but this really feels like a
 band-aid and incorrect solution. In searching this groups archives,
 I've seen some similar issues, but they all seem to have been resolved
 a few months ago.

 Advice? Thoughts? Questions?

 Cheers,
 :R






Re: [web2py] Re: Python Message Queue

2011-04-07 Thread Praneeth Bodduluri
I was planning to, making web2py pip installable was a step towards
this but got side tracked with academic work. Hoping to hack in DAL
support for celery next month.

--
Praneeth
IRC: lifeeth



On Wed, Apr 6, 2011 at 8:45 AM, pbreit pbreitenb...@gmail.com wrote:
 Was anyone able to make any progress with Celery? I am very interested as I
 am not having much luck with cron and background processes.


Re: [web2py] web2py 1.94.6

2011-03-27 Thread Praneeth Bodduluri
Massimo,
Now that we have a setup.py in the tree could you also upload the
package to PyPI?

http://pypi.python.org/pypi/web2py/

python setup.py sdist upload

Should do it.

Thanks,
Praneeth
IRC: lifeeth



On Sun, Mar 27, 2011 at 10:52 PM, Massimo Di Pierro
massimo.dipie...@gmail.com wrote:
 Fixes some minor issues, including adding the missing *.yaml.

 Please report any issue ASAP.

 Massimo


Re: [web2py] web2py 1.94.6

2011-03-27 Thread Praneeth Bodduluri
Hello Massimo,

I can help maintain the PyPI uploading for every new revision.

--
Praneeth
IRC: lifeeth



On Sun, Mar 27, 2011 at 11:17 PM, Massimo Di Pierro
massimo.dipie...@gmail.com wrote:
 I can do it. Do you want to be in charge of it?

 Massimo

 On Mar 27, 2011, at 12:43 PM, Praneeth Bodduluri wrote:

 python setup.py sdist upload




Re: [web2py] Re: setup.py to install web2py globally into the python env/virtualenv

2011-03-21 Thread Praneeth Bodduluri
Massimo,

Submitted at:
https://code.google.com/p/web2py/issues/detail?id=220

--
Praneeth
IRC: lifeeth



On Mon, Mar 21, 2011 at 9:59 AM, Massimo Di Pierro
massimo.dipie...@gmail.com wrote:
 This is great! Monday and Tuesday are busy days for me but I will
 check this asap. Please open a web2py issue on google code to make
 sure this is tracked.

 Massimo

 On Mar 20, 4:34 pm, Praneeth Bodduluri life...@gmail.com wrote:
 Hello all,

 In an attempt to make web2py pip installable, so that I can use gluon
 as a module in other python programs, I created a setup.py that can be
 used to create a source dist for PyPI. Attached are the files that
 need to be placed in the web2py root directory.

 To create the source distribution:

 python setup.py sdist

 To install from the source distribution (After running the above
 command and using the sdist that it creates):

 python setup.py install

 After installing in your python env or virtualenv:

 To create a new web2py application directory:

 mkweb2pyenv path_to_project_dir

 To run web2py from a directory:

 runweb2py path_to_project_dir

 I hope this makes its way to web2py Trunk. A clone with the files
 included can be found at :https://code.google.com/r/lifeeth-pip

 I made a video of running an instance for those who like to watch:

 https://www.youtube.com/watch?v=f6cFkK2ZDPY

 --
 Praneeth
 IRC: lifeeth

  new_files.tar.bz2
 2KViewDownload


[web2py] setup.py to install web2py globally into the python env/virtualenv

2011-03-20 Thread Praneeth Bodduluri
Hello all,

In an attempt to make web2py pip installable, so that I can use gluon
as a module in other python programs, I created a setup.py that can be
used to create a source dist for PyPI. Attached are the files that
need to be placed in the web2py root directory.

To create the source distribution:

python setup.py sdist

To install from the source distribution (After running the above
command and using the sdist that it creates):

python setup.py install

After installing in your python env or virtualenv:

To create a new web2py application directory:

mkweb2pyenv path_to_project_dir

To run web2py from a directory:

runweb2py path_to_project_dir


I hope this makes its way to web2py Trunk. A clone with the files
included can be found at : https://code.google.com/r/lifeeth-pip

I made a video of running an instance for those who like to watch:

https://www.youtube.com/watch?v=f6cFkK2ZDPY

--
Praneeth
IRC: lifeeth


new_files.tar.bz2
Description: BZip2 compressed data


Re: [web2py] Re: How to build windows binary yourself?

2011-03-20 Thread Praneeth Bodduluri
We have used

http://bazaar.launchpad.net/~flavour/sahana-eden/trunk/view/head:/static/scripts/tools/standalone_exe.py

To build custom exes of web2py with certain modules added in. The
above works with py2exe. Recently I have been using cxfreeze with my
other projects - It appears to be way more simpler than py2exe.


--
Praneeth
IRC: lifeeth



On Mon, Mar 21, 2011 at 4:06 AM, Brian M bmere...@gmail.com wrote:
 OK, I've got a version that appears to build successfully - had to re-write
 the code to gather the list of data_files - reglob() didn't return files in
 expected format.  It's working but currently is including a bunch of windows
 API files in the dist directory, so it would NOT be appropriate for public
 distribution as-is without removing those files first (Danger, Danger Will
 Robinson licensing issues!). I'll see if I can figure out how to exclude
 them in the first place or at least automatically remove them with a
 secondary batch script.