[web2py] relational database example app

2011-05-25 Thread Markandeya
Dear Friends of Web2Py,
I am just getting started and need an example application using a
relational database. A possible example:
1) with customers, items, purchases tables So the purchases table
would use customerId and itemId numbers from their related tables. So
a customer can select an item in a form page from a list of items and
make a purchase or find more detailed info on the item.

 2) books, users, lending tables.  the lending table uses  userId and
bookId  from their related tables.  So a user can select a book to
borrow from a list of books and get more info on the book by clicking
a button or link.
  You get the idea. I can write this as a regular desktop application
but need to know how to do this in a Web2Py web application. Following
an existing program, possibly with some help files or tutorial would
jump start me into web apps with Web2Py. Many thanks for your
suggestions, Markandeya


[web2py] Re: relational database example app

2011-05-25 Thread Markandeya
Ok i found some appliances on the Appliances web page and that is very
helpful. Which ones are considered good coding standards/practices to
follow?? Which would you advise to get started with??
Any recommendations or suggestions would be appreciated. Thanks again,
Markandeya


Re: [web2py] relational database example app

2011-05-25 Thread Stifan Kristi
had already checked web2py appliances? http://web2py.com/appliances

On Wed, May 25, 2011 at 1:19 PM, Markandeya mrc55...@gmail.com wrote:

 Dear Friends of Web2Py,
 I am just getting started and need an example application using a
 relational database. A possible example:
 1) with customers, items, purchases tables So the purchases table
 would use customerId and itemId numbers from their related tables. So
 a customer can select an item in a form page from a list of items and
 make a purchase or find more detailed info on the item.

  2) books, users, lending tables.  the lending table uses  userId and
 bookId  from their related tables.  So a user can select a book to
 borrow from a list of books and get more info on the book by clicking
 a button or link.
  You get the idea. I can write this as a regular desktop application
 but need to know how to do this in a Web2Py web application. Following
 an existing program, possibly with some help files or tutorial would
 jump start me into web apps with Web2Py. Many thanks for your
 suggestions, Markandeya



[web2py] Re: relational database example app

2011-05-25 Thread pbreit
The estore is quite outdated but probably still the best available 
ecommerce example:
http://code.google.com/p/web2py-estore/


[web2py] Memory problems on Webfaction after upgrade of Web2py

2011-05-25 Thread Johann Spies
After upgrading web2py on Webfaction I am experiencing memory problems at
least once a week. I have upgraded the memory configuration form 80Mb to
160Mb in January this year and never had this problem until I upgraded to
the present version of Web2py (Version 1.95.1).

I have disabled cron after the upgrade.  Can it be a memory leak that causes
this?

Regards
Johann
-- 
 May grace and peace be yours in abundance through the full knowledge of God
and of Jesus our Lord!  His divine power has given us everything we need for
life and godliness through the full knowledge of the one who called us by
his own glory and excellence.
2 Pet. 1:2b,3a


Re: [web2py] Memory problems on Webfaction after upgrade of Web2py

2011-05-25 Thread Bruno Rocha
This might be a problem with sessions list being loaded in to memory. By
default web2py Cron calls a method which cleans unused sessions.

But, the best way to track it is trying enabling Cron again.
Em 25/05/2011 04:05, Johann Spies johann.sp...@gmail.com escreveu:
 After upgrading web2py on Webfaction I am experiencing memory problems at
 least once a week. I have upgraded the memory configuration form 80Mb to
 160Mb in January this year and never had this problem until I upgraded to
 the present version of Web2py (Version 1.95.1).

 I have disabled cron after the upgrade. Can it be a memory leak that
causes
 this?

 Regards
 Johann
 --
 May grace and peace be yours in abundance through the full knowledge of
God
 and of Jesus our Lord! His divine power has given us everything we need
for
 life and godliness through the full knowledge of the one who called us by
 his own glory and excellence.
 2 Pet. 1:2b,3a


[web2py] Re: can't use admin, can't see tickets with localhost google appengine SDK

2011-05-25 Thread Luis Goncalves
Thank you, Arbie!

For a while I was using a Windows (windose) machine with the Google
App Engine Launcher, and so had no console to see.

Then I switched to linux, and didn't even notice that the console
echoed the error output!

Curiously, with an old debian machine with python 2.5.2, admin and
tickets work fine (through the browser) if I run the web2py server
directly instead of through the GAE.  I found this the best way to
debug.  Occasionally I switch to running through the (localhost) GAE
to make sure everything works there too.

One frustrating thing (so far) is that it seems that it is much harder
to debug errors in views (.html files) than in controllers, because
the line numbering is all mixed up (due to the {{extend *.html}}
statements).

On my Ubuntu 10.04.2 machine, admin and tickets don't work. Not sure
why, but might try to investigate the difference between it and my old
debian machine, since it's useful functionality!

Thanks for your help!!!

L.

On May 20, 12:40 am, Arbie Samong phek...@gmail.com wrote:
 Admin is disabled there. If you want to check for errors go see your
 console. On production, check the server logs at the left menu on your
 dashboard.

 Regards,
 Arbie

 On May 20, 11:08 am, Pierluigi Martini lgoncal...@gmail.com wrote:

  I am trying to deploy an application on GAE using web2py.

  I am running GAE SDK 1.5 on my localhost (ubuntu 8.10 , python2.5 with
  ssl module but not python-tk)

  Usingpython dev_appengine.py ../web2py

  works fine execpt that:

  If (in the browser) I try to run the admin app, or, more importantly,
  if I try to see a ticket due to a bug in my code, I get the error:

  admin is disabled because insecure channel

  How can I run admin and see tickets  when using web2py with GAE SDK on
  localhost???

  Note that
    python web2py.py
  works fine, with admin and tickets
  (although I have to type my admin password on the console because I
  don't have python-tk -- don't know if that makes a difference).

  I've looked online for quite a while and haven't found an answer yet.

  I hope it is possible to get debug info (tickets) running web2py with
  GAE!

  Thank you!
  L.




Re: [web2py] Memory problems on Webfaction after upgrade of Web2py

2011-05-25 Thread Johann Spies
On 25 May 2011 09:46, Bruno Rocha rochacbr...@gmail.com wrote:

 This might be a problem with sessions list being loaded in to memory. By
 default web2py Cron calls a method which cleans unused sessions.

 But, the best way to track it is trying enabling Cron again.

 I will try.  The reason why I disabled cron was as a result of advice on
this list.  I think it was Massimo himself that mentioned that as a method
to reduce memory consumption.  Is just enabling cron enough to clear up
unused sessions?

Regards
Johann

-- 
 May grace and peace be yours in abundance through the full knowledge of God
and of Jesus our Lord!  His divine power has given us everything we need for
life and godliness through the full knowledge of the one who called us by
his own glory and excellence.
2 Pet. 1:2b,3a


[web2py] domain and download function problem

2011-05-25 Thread Joseph.Piron
Hi guys,

i got a strange problem, I have made a simple application picking up
data from a database, including an upload field for small photos.
This works perfectly if hosted in the classic way, for example if my
server name is stock and the application is stock (...), if I access
http://stock/stock it works !

Then, as this is not pretty, i added a route:

routers = dict(
BASE = dict(
domains = {
'stock': 'stock'
}
)
)

and now, I can access this application at http://stock , but...
Now the link to download the images aren't correct anymore:

the link accessed from http://stock/stock : img src=/stock/download/
stockItems.photo.bc4b40cb067d4cb8.696d677265732e6a706567.jpeg
class=photo

the link accessed from http://stock : img src=/download/
stockItems.photo.bc4b40cb067d4cb8.696d677265732e6a706567.jpeg
class=photo

and the view code :
td class='center noedit'
{{if item.photo:}}img
src={{=URL(a='stock',f='download',args=item.photo)}} class=photo/
{{pass}}
/td
(as you can see, I tried adding the application in the URL
generator..)

Could someone point me where to look at to make it work ? :)

Thanks in advance !!


Re: [web2py] Re: Problem storing Storage objects in sessions

2011-05-25 Thread Martín Mulone

 Do we know that the new importer does not conflict with the custom
 mod_wsgi import mechanism described in the article? Has anybody tried
 trunk with mod_wsgi?


Me and seems to work fine at least in my app.

2011/5/24 Massimo Di Pierro massimo.dipie...@gmail.com

 This does apply to web2py. In fact I believe the book says something
 like this quote from the article

 In order to ensure that no strange problems at all are likely to
 occur, it is suggested that only basic builtin Python types, ie.,
 scalars, tuples, lists and dictionaries, be stored using the pickle
 module from a WSGI application script file. That is, avoid any type of
 object which has user defined code associated with it.

 Do we know that the new importer does not conflict with the custom
 mod_wsgi import mechanism described in the article? Has anybody tried
 trunk with mod_wsgi?

 Massimo

 On May 24, 4:42 pm, Jonathan Lundell jlund...@pobox.com wrote:
  Reading this makes my head hurt, but I wonder if it might not also apply
 to web2py:http://code.google.com/p/modwsgi/wiki/IssuesWithPickleModule
 
  If so, I can think of some ugly workarounds.
 
  On May 24, 2011, at 12:13 PM, Ross Peoples ross.peop...@gmail.com
 wrote:
 
 
 
 
 
 
 
   For whatever reason, after running for 24 hours, web2py throws an
 exception when trying to log in. I have to stop web2py, and restart it, then
 the error goes away and my application starts working again. Any ideas?
 
   Traceback (most recent call last):
 File /media/psf/Python/web2py/gluon/main.py, line 511, in wsgibase
   session._try_store_on_disk(request, response)
 File /media/psf/Python/web2py/gluon/globals.py, line 469, in
 _try_store_on_disk
   cPickle.dump(dict(self), response.session_file)
   PicklingError: Can't pickle class 'gluon.storage.Storage': it's not
 the same object as gluon.storage.Storage




-- 
 http://martin.tecnodoc.com.ar


[web2py] celery integration?

2011-05-25 Thread Pankaj More(BlankVerse)
Is there any python module similar to django-celery for web2py? Is it 
possible to use celery in web2py without a rabbitMQ backend similar to 
django-kambu using perhaps DAL instead of SQLAlchemy?

[web2py] Re: reponse.js Update 2 Targets.

2011-05-25 Thread Massimo Di Pierro
No your syntax is correct. Can you email me a minimalist app so I can
try it quickly?

On May 24, 11:05 pm, David J. da...@styleflare.com wrote:
 I am using Trunk;

 Is my syntax correct?

 should it be a ',' instead of a ';'

 response.js =
 'web2py_component(url,target),web2py_component(other_url,other_target);'

 On 5/24/11 11:40 PM, Massimo Di Pierro wrote:







  There is no reason why it should not work. Are you using trunk? There
  was in bug in stable about response.js.

  On May 24, 8:25 pm, David J.da...@styleflare.com  wrote:
  I was wondering how I can update 2 targets with reponse.js?

  I tried this

  response.js =
  'web2py_component(url,target);web2py_component(other_url,other_target);'

  Seems only the first updated.

  Any ideas?


[web2py] Re: celery integration?

2011-05-25 Thread Massimo Di Pierro
Hello Pankaj,

There is nothing Django specific in Celery. You can use it with
web2py. The only thing missing are examples on how to do so.
Integration with DAL my require a little more work but not too much
since DAL is easy to use without web2py.

I will add this to my todo list.

Massimo

On May 25, 6:26 am, Pankaj  More(BlankVerse) pankajm...@gmail.com
wrote:
 Is there any python module similar to django-celery for web2py? Is it
 possible to use celery in web2py without a rabbitMQ backend similar to
 django-kambu using perhaps DAL instead of SQLAlchemy?


[web2py] Re: Problem storing Storage objects in sessions

2011-05-25 Thread Ross Peoples
I do have a script that runs every day, but I don't think that is the 
problem because it doesn't touch sessions. In the application itself, one of 
the things I store in is a list of URL objects in the session. Every time a 
user logs in, the menu is generated based on that user's permissions an 
stored in the session. This isn't usually a problem until about the time the 
session expires. You get the error the next time it asks you to log in. And 
for some reason, restarting web2py fixes the problem.

I am still trying to determine if it's something application specific, but I 
haven't found anything yet.


[web2py] Re: Trouble updating with SQLFORM.factory and two tables

2011-05-25 Thread Ross Peoples
You were right, that was a stupid mistake on my part. However, it still 
isn't working. This is the new select() command, but I still get the 
previous error:

row = db((db.auth_user_extended.auth_user==db.auth_user.id)  
(db.auth_user.id==id)).select().first()

The model for the field that is giving me the error is created like this:

Field('barcode_id', length=12, notnull=True, requires=IS_NOT_IN_DB(db, 
'auth_user_extended.barcode_id'))

And form.accepts() fails with value already in database or empty.


[web2py] local import function name syntax

2011-05-25 Thread Richard Vézina
Hello,

I start to put in modules the functions I need to use in more then one
controller... I would like to know if I still need to use the double
underscore at the begining of the function name to prevent it to be used as
a controller function? Could it be a good idea to use the underscores to
make it clear that those function are not controller function (or page
function)?

Thanks

Richard


[web2py] Add a decorator @security.xssprevention ?

2011-05-25 Thread Alexandre Strzelewicz
It could be a good idea to add a decorator to escape all requested
variables to avoid xss no ?

Actually I do :

In controller :

xss = local_import('xss')

def new_widget():
can_modify()
# Xss
prevention
for req in request.vars:
request.vars[req] = xss.xssescape(request.vars[req])
[...]

In modules/xss.py :

http://pastie.org/1971510


Re: [web2py] trunk - missing 'reset_password' in Auth.__call__ in tools.py

2011-05-25 Thread Carlos
I see the change is already in trunk, I've tested it and it now works ok ... 
thanks!

[web2py] Re: script to clone a database

2011-05-25 Thread mart
Massimo,

this is awesome, thanks!:)

I wrapped the contents of your main() in a function (used in script,
not web) where i can pass in these args:

model=None  -  if not None, points to a model. This will
re-write the model used in script in the
webApp/applications/models dir (db.py) -
this lets me share the db between script
and webApp seamlessly :)

otherDB=None- name the DB, or default to
'storage.sqlite'


dbfolder=None   - specify db folder. if None, use current
  dir

clean=False - if True, will delete all tables, db, log
   (i do this so each build has a fresh new
 SQLite DB)

truncate=False   - if True, just truncate, don't delete (i
 use this as well in some places, but now
 makes more sense to use along side your
  script.

Thanks again,
Mart :)


On May 24, 1:39 am, ron_m ron.mco...@gmail.com wrote:
 Great, I was doing this manually, this really helps codify the procedure.

 The export_to_csv_file and import_from_csv_file routines are the magic with
 how they fix up all the foreign keys to match the new primary key values.


[web2py] Re: Add a decorator @security.xssprevention ?

2011-05-25 Thread Anthony
By default, web2py already escapes all variables rendered in views to 
prevent XSS -- what additional protection does this provide?
 

On Wednesday, May 25, 2011 10:32:30 AM UTC-4, Alexandre Strzelewicz wrote:

 It could be a good idea to add a decorator to escape all requested 
 variables to avoid xss no ? 

 Actually I do : 

 In controller : 

 xss = local_import('xss') 

 def new_widget(): 
 can_modify() 
 # Xss 
 prevention 
 for req in request.vars: 
 request.vars[req] = xss.xssescape(request.vars[req]) 
 [...] 

 In modules/xss.py : 

 http://pastie.org/1971510 



Re: [web2py] local import function name syntax

2011-05-25 Thread Anthony
You shouldn't need to worry about underscores in your module function names. 
Also, note that even in a controller file, any function that takes arguments 
will not be exposed as a URL-accessible action, even if it does not start 
with two underscores. See 
http://web2py.com/book/default/chapter/04#Dispatching.

On Wednesday, May 25, 2011 9:53:44 AM UTC-4, Richard wrote:

 Hello, 

 I start to put in modules the functions I need to use in more then one 
 controller... I would like to know if I still need to use the double 
 underscore at the begining of the function name to prevent it to be used as 
 a controller function? Could it be a good idea to use the underscores to 
 make it clear that those function are not controller function (or page 
 function)?

 Thanks

 Richard



[web2py] Re: trunk - missing 'reset_password' in Auth.__call__ in tools.py

2011-05-25 Thread Massimo Di Pierro
Thanks for reporting the problem.

On May 25, 9:38 am, Carlos carlosgali...@gmail.com wrote:
 I see the change is already in trunk, I've tested it and it now works ok ...
 thanks!


[web2py] Re: Add a decorator @security.xssprevention ?

2011-05-25 Thread Alexandre Strzelewicz
For ajax queries

On May 25, 4:58 pm, Anthony abasta...@gmail.com wrote:
 By default, web2py already escapes all variables rendered in views to
 prevent XSS -- what additional protection does this provide?







 On Wednesday, May 25, 2011 10:32:30 AM UTC-4, Alexandre Strzelewicz wrote:
  It could be a good idea to add a decorator to escape all requested
  variables to avoid xss no ?

  Actually I do :

  In controller :

  xss = local_import('xss')

  def new_widget():
      can_modify()
      # Xss
  prevention
      for req in request.vars:
          request.vars[req] = xss.xssescape(request.vars[req])
      [...]

  In modules/xss.py :

 http://pastie.org/1971510


[web2py] Re: script to clone a database

2011-05-25 Thread Massimo Di Pierro
If you can make the script user optparse, would you mail it to me? I
happy to replace mine with your improved one.

On May 25, 9:38 am, mart msenecal...@gmail.com wrote:
 Massimo,

 this is awesome, thanks!:)

 I wrapped the contents of your main() in a function (used in script,
 not web) where i can pass in these args:

 model=None      -  if not None, points to a model. This will
                     re-write the model used in script in the
                     webApp/applications/models dir (db.py) -
                     this lets me share the db between script
                     and webApp seamlessly :)

 otherDB=None    - name the DB, or default to
                     'storage.sqlite'

 dbfolder=None   - specify db folder. if None, use current
                       dir

 clean=False     - if True, will delete all tables, db, log
                    (i do this so each build has a fresh new
                      SQLite DB)

 truncate=False   - if True, just truncate, don't delete (i
                      use this as well in some places, but now
                      makes more sense to use along side your
                       script.

 Thanks again,
 Mart :)

 On May 24, 1:39 am, ron_m ron.mco...@gmail.com wrote:







  Great, I was doing this manually, this really helps codify the procedure.

  The export_to_csv_file and import_from_csv_file routines are the magic with
  how they fix up all the foreign keys to match the new primary key values.


[web2py] Re: Add a decorator @security.xssprevention ?

2011-05-25 Thread Massimo Di Pierro
So this:

xss.xssescape(text)

would be the same as

str(XML(text))

or

from gluon import xmlescape
xmlescape(text)

On May 25, 10:20 am, Alexandre Strzelewicz
strzelewicz.alexan...@gmail.com wrote:
 For ajax queries

 On May 25, 4:58 pm, Anthony abasta...@gmail.com wrote:







  By default, web2py already escapes all variables rendered in views to
  prevent XSS -- what additional protection does this provide?

  On Wednesday, May 25, 2011 10:32:30 AM UTC-4, Alexandre Strzelewicz wrote:
   It could be a good idea to add a decorator to escape all requested
   variables to avoid xss no ?

   Actually I do :

   In controller :

   xss = local_import('xss')

   def new_widget():
       can_modify()
       # Xss
   prevention
       for req in request.vars:
           request.vars[req] = xss.xssescape(request.vars[req])
       [...]

   In modules/xss.py :

  http://pastie.org/1971510


[web2py] Re: can't use admin, can't see tickets with localhost google appengine SDK

2011-05-25 Thread ron_m
I run the same version of Ubuntu, no problems with seeing or generating 
tickets when I don't get it quite right in the code. Check the permissions 
on the errors directory for you app?

The errors in views are from when the Python code runs which is after 
extend, include and translation of HTML etc. into response.write statements. 
There should be enough in the content of the generated Python to get you 
close to the right place in the original view code.


[web2py] Re: Add a decorator @security.xssprevention ?

2011-05-25 Thread Anthony
On Wednesday, May 25, 2011 11:24:12 AM UTC-4, Massimo Di Pierro wrote: 

 So this: 

 xss.xssescape(text) 

 would be the same as 

 str(XML(text))

 
str(XML(text)) won't escape the text, will it? The __str__ method of an XML 
object just returns the unaltered text (unless sanitize=True), no?
 
Anthony


[web2py] Re: Add a decorator @security.xssprevention ?

2011-05-25 Thread Mathew Grabau
That seems to be true, sanitize defaults to False in the class XML
__init__

On May 25, 10:47 am, Anthony abasta...@gmail.com wrote:
 On Wednesday, May 25, 2011 11:24:12 AM UTC-4, Massimo Di Pierro wrote:

  So this:

  xss.xssescape(text)

  would be the same as

  str(XML(text))

 str(XML(text)) won't escape the text, will it? The __str__ method of an XML
 object just returns the unaltered text (unless sanitize=True), no?

 Anthony


[web2py] Re: Add a decorator @security.xssprevention ?

2011-05-25 Thread Massimo Di Pierro
Do not escape:
 print str(XML('alink/a'))
alink/a

Remove unsafe tags:
 print str(XML('alink/a', sanitize=True))
link

Escape everything:
 print xmlescape('alink/a')
lt;agt;linklt;/agt;






On May 25, 10:47 am, Anthony abasta...@gmail.com wrote:
 On Wednesday, May 25, 2011 11:24:12 AM UTC-4, Massimo Di Pierro wrote:

  So this:

  xss.xssescape(text)

  would be the same as

  str(XML(text))

 str(XML(text)) won't escape the text, will it? The __str__ method of an XML
 object just returns the unaltered text (unless sanitize=True), no?

 Anthony


[web2py] Re: can't use admin, can't see tickets with localhost google appengine SDK

2011-05-25 Thread pbreit
I run 10.04.2 and admin works fine. Are you getting error messages?

I have found it's usually quite easy to resolve HTML errors. The traceback 
usually includes the view file's line number and/or the code listing shows 
the view file converted into Python which is easy enough to identify.


Re: [web2py] advise needed about best way to reorder fields in form for particular user

2011-05-25 Thread pbreit
I do custom forms for all my forms (http://pricetack.com):
http://web2py.com/book/default/chapter/07#Custom-forms


[web2py] advise needed about best way to reorder fields in form for particular user

2011-05-25 Thread Richard Vézina
Hello,

I would like to change the order of the field of my forms depending of
the user and their access to the information... Mainly I would like to
make appear a verification check box at the bottom of all fields when
the verify form is showed to the user. There is also the
approbation form so that why there is extra field back the verify
form for lower autorised access user.

I think I can redefine the model in controller as I want?? But not
sure how to do it (define all the fields types, etc.)...

It could be more wise to use Table Inheritance??

Thanks

Richard


[web2py] Re: Trouble updating with SQLFORM.factory and two tables

2011-05-25 Thread pbreit
Try pulling the requires out of the field definition:

db.auth_user_extended.barcode_id.requires=IS_NOT_IN_DB(db, 
'auth_user_extended.barcode_id')

We also might need to see the controller code since working with 2 tables 
adds complexity.


[web2py] Re: Add a decorator @security.xssprevention ?

2011-05-25 Thread Mathew Grabau
In your controllers in the first place, wouldn't another mitigation be
to code defensively by taking request.vars and validating it in the
first place??? Following that policy and then formatting your response
is a way to avoid the problem.

Definitely don't seem like a good idea to be doing:

def action():
   return response.vars.whatever


in the first place, especially so in an AJAX query.


On May 25, 10:20 am, Alexandre Strzelewicz
strzelewicz.alexan...@gmail.com wrote:
 For ajax queries

 On May 25, 4:58 pm, Anthony abasta...@gmail.com wrote:



  By default, web2py already escapes all variables rendered in views to
  prevent XSS -- what additional protection does this provide?

  On Wednesday, May 25, 2011 10:32:30 AM UTC-4, Alexandre Strzelewicz wrote:
   It could be a good idea to add a decorator to escape all requested
   variables to avoid xss no ?

   Actually I do :

   In controller :

   xss = local_import('xss')

   def new_widget():
       can_modify()
       # Xss
   prevention
       for req in request.vars:
           request.vars[req] = xss.xssescape(request.vars[req])
       [...]

   In modules/xss.py :

  http://pastie.org/1971510


[web2py] Error on startup: No module named DAL

2011-05-25 Thread Arbie Samong
I just finished setup of kubuntu on an old laptop and ported my
project to it. However, when I try to start web2py with:

python web2py.py --password test

I get the error:

Traceback (most recent call last):
  File web2py.py, line 16, in module
import gluon.widget
  File /home/arbie/cvstash/gluon/widget.py, line 24, in module
import main
  File /home/arbie/cvstash/gluon/main.py, line 80, in module
from globals import Request, Response, Session
  File /home/arbie/cvstash/gluon/globals.py, line 18, in module
from compileapp import run_view_in
  File /home/arbie/cvstash/gluon/compileapp.py, line 24, in module
from sql import BaseAdapter, SQLDB, SQLField, DAL, Field
  File /home/arbie/cvstash/gluon/sql.py, line 5, in module
from dal import DAL, Field, Table, Query, Set, Expression, Row,
Rows, drivers, BaseAdapter, SQLField, SQLTable, SQLXorable, SQLQuery,
SQLSet, SQLRows, SQLStorage, SQLDB, GQLDB, SQLALL, SQLCustomType
ImportError: No module named dal

It has the default python2.7 as well as other needed packages (build-
essentials, python-dev). I don´t remember trying to install extra
stuff on my other machine just to get web2py running. I searched
around and this was never posted before.

Any help is appreciated. Thanks!


[web2py] Re: Trouble updating with SQLFORM.factory and two tables

2011-05-25 Thread Ross Peoples
If I remove the requires, then the record updates properly, but the idea is 
that the barcode id should be unique. So is this a bug? I mean I could do 
custom validation on the form to ensure the barcode id is unique, but that 
kind of defeats the purpose of requires.

[web2py] Re: Error on startup: No module named DAL

2011-05-25 Thread Massimo Di Pierro
Can you check that you have gluon/dal.py?
If so, what if you replace in file
/home/arbie/cvstash/gluon/compileapp.py, line 24,
from sql import BaseAdapter, SQLDB, SQLField, DAL, Field
with
from dal import BaseAdapter, SQLDB, SQLField, DAL, Field

Massimo

On May 25, 11:36 am, Arbie Samong phek...@gmail.com wrote:
 I just finished setup of kubuntu on an old laptop and ported my
 project to it. However, when I try to start web2py with:

 python web2py.py --password test

 I get the error:

 Traceback (most recent call last):
   File web2py.py, line 16, in module
     import gluon.widget
   File /home/arbie/cvstash/gluon/widget.py, line 24, in module
     import main
   File /home/arbie/cvstash/gluon/main.py, line 80, in module
     from globals import Request, Response, Session
   File /home/arbie/cvstash/gluon/globals.py, line 18, in module
     from compileapp import run_view_in
   File /home/arbie/cvstash/gluon/compileapp.py, line 24, in module
     from sql import BaseAdapter, SQLDB, SQLField, DAL, Field
   File /home/arbie/cvstash/gluon/sql.py, line 5, in module
     from dal import DAL, Field, Table, Query, Set, Expression, Row,
 Rows, drivers, BaseAdapter, SQLField, SQLTable, SQLXorable, SQLQuery,
 SQLSet, SQLRows, SQLStorage, SQLDB, GQLDB, SQLALL, SQLCustomType
 ImportError: No module named dal

 It has the default python2.7 as well as other needed packages (build-
 essentials, python-dev). I don´t remember trying to install extra
 stuff on my other machine just to get web2py running. I searched
 around and this was never posted before.

 Any help is appreciated. Thanks!


[web2py] 1.96.0 - stable 1.96.1?

2011-05-25 Thread Massimo Di Pierro
I would like to turn 1.96.0 into stable. Is there any open issue I
forgot about that is not in google code?

Massimo


[web2py] Re: 1.96.0 - stable 1.96.1?

2011-05-25 Thread Ross Peoples
The current trunk version is pretty stable for me. I know there are a few 
people out there looking forward to the new import functionality. Plus, it's 
been about a month since the last stable release, so it's probably time :)

Though you may want to make a note that it will not work with Python 2.4, so 
that people still running production web2py systems on Python 2.4 won't get 
an ugly surprise.


Re: [web2py] advise needed about best way to reorder fields in form for particular user

2011-05-25 Thread Richard Vézina
Hello pbreit,

You made that with web2py?! It nice!

Thanks to point me the doc...

Richard

On Wed, May 25, 2011 at 12:18 PM, pbreit pbreitenb...@gmail.com wrote:
 I do custom forms for all my forms (http://pricetack.com):
 http://web2py.com/book/default/chapter/07#Custom-forms



Re: [web2py] Re: 1.96.0 - stable 1.96.1?

2011-05-25 Thread José Luis Redrejo Rodríguez
2011/5/25 Ross Peoples ross.peop...@gmail.com:
 The current trunk version is pretty stable for me. I know there are a few
 people out there looking forward to the new import functionality. Plus, it's
 been about a month since the last stable release, so it's probably time :)
 Though you may want to make a note that it will not work with Python 2.4, so
 that people still running production web2py systems on Python 2.4 won't get
 an ugly surprise.

That's a very important issue and you should make it note in capital
letters. Also, if there is some workaround to do it work with 2.4 (or
what parts will not work) would be important too.

Regards.


[web2py] Re: Error on startup: No module named DAL

2011-05-25 Thread Arbie Samong
Oops. I checked on to see if have gluon/dal.py and it isn't there.
Must be something wrong during transfer (hmmm dropbox!). I grabbed the
latest from trunk and overwritten what I have on the project folder
and it was fixed.

Thanks for the help and sorry for such noobishness ;-)

Thanks,
Arbie

On May 26, 12:56 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 Can you check that you have gluon/dal.py?
 If so, what if you replace in file
 /home/arbie/cvstash/gluon/compileapp.py, line 24,
     from sql import BaseAdapter, SQLDB, SQLField, DAL, Field
 with
     from dal import BaseAdapter, SQLDB, SQLField, DAL, Field

 Massimo

 On May 25, 11:36 am, Arbie Samong phek...@gmail.com wrote:







  I just finished setup of kubuntu on an old laptop and ported my
  project to it. However, when I try to start web2py with:

  python web2py.py --password test

  I get the error:

  Traceback (most recent call last):
    File web2py.py, line 16, in module
      import gluon.widget
    File /home/arbie/cvstash/gluon/widget.py, line 24, in module
      import main
    File /home/arbie/cvstash/gluon/main.py, line 80, in module
      from globals import Request, Response, Session
    File /home/arbie/cvstash/gluon/globals.py, line 18, in module
      from compileapp import run_view_in
    File /home/arbie/cvstash/gluon/compileapp.py, line 24, in module
      from sql import BaseAdapter, SQLDB, SQLField, DAL, Field
    File /home/arbie/cvstash/gluon/sql.py, line 5, in module
      from dal import DAL, Field, Table, Query, Set, Expression, Row,
  Rows, drivers, BaseAdapter, SQLField, SQLTable, SQLXorable, SQLQuery,
  SQLSet, SQLRows, SQLStorage, SQLDB, GQLDB, SQLALL, SQLCustomType
  ImportError: No module named dal

  It has the default python2.7 as well as other needed packages (build-
  essentials, python-dev). I don´t remember trying to install extra
  stuff on my other machine just to get web2py running. I searched
  around and this was never posted before.

  Any help is appreciated. Thanks!


[web2py] Re: script to clone a database

2011-05-25 Thread mart
sure, be glad to :) I can get to it this afternoon.

On May 25, 11:21 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 If you can make the script user optparse, would you mail it to me? I
 happy to replace mine with your improved one.

 On May 25, 9:38 am, mart msenecal...@gmail.com wrote:







  Massimo,

  this is awesome, thanks!:)

  I wrapped the contents of your main() in a function (used in script,
  not web) where i can pass in these args:

  model=None      -  if not None, points to a model. This will
                      re-write the model used in script in the
                      webApp/applications/models dir (db.py) -
                      this lets me share the db between script
                      and webApp seamlessly :)

  otherDB=None    - name the DB, or default to
                      'storage.sqlite'

  dbfolder=None   - specify db folder. if None, use current
                        dir

  clean=False     - if True, will delete all tables, db, log
                     (i do this so each build has a fresh new
                       SQLite DB)

  truncate=False   - if True, just truncate, don't delete (i
                       use this as well in some places, but now
                       makes more sense to use along side your
                        script.

  Thanks again,
  Mart :)

  On May 24, 1:39 am, ron_m ron.mco...@gmail.com wrote:

   Great, I was doing this manually, this really helps codify the procedure.

   The export_to_csv_file and import_from_csv_file routines are the magic 
   with
   how they fix up all the foreign keys to match the new primary key values.


Re: [web2py] Re: 1.96.0 - stable 1.96.1?

2011-05-25 Thread Ross Peoples
Jose,

I learned the hard way that Python 2.4 is no longer supported by web2py and 
a lot of the new stuff in the trunk requires Python 2.5 or higher. I had 
submitted several patches to support Python 2.4, but they were rejected 
because maintaining Python 2.4 support really is a pain, which is why web2py 
dropped support for it.


[web2py] Re: request.files.append syntax

2011-05-25 Thread Ross Peoples
response.file is what you are looking for, not request. And response.files 
is simply a list, and append just appends another item to the list. The 
web2py_ajax.html view is what loops through the list and writes the link 
and script tags. You might want to just go into your layout.html file and 
write this element yourself in HTML.

Re: [web2py] Re: 1.96.0 - stable 1.96.1?

2011-05-25 Thread José Luis Redrejo Rodríguez
2011/5/25 Ross Peoples ross.peop...@gmail.com:
 Jose,
 I learned the hard way that Python 2.4 is no longer supported by web2py and
 a lot of the new stuff in the trunk requires Python 2.5 or higher. I had
 submitted several patches to support Python 2.4, but they were rejected
 because maintaining Python 2.4 support really is a pain, which is why web2py
 dropped support for it.

I know it and I'm not using it yet anymore, but there's a lot of
CentOs and Debian Etch servers around running 2.4, so I think it would
be important to make them notice very clearly that web2py is not going
to work with them and, if possible, where it's going to fail with that
python version. Because if it starts and a good part of the
applications still work, it might hide future errors that should be
known for the implementors.

It's just a question of ellegance keeping well informed all the web2py
users, even if most of us won't have problems as we're using at least
2.5

Regards


[web2py] request.files.append syntax

2011-05-25 Thread Andrew Thompson
I can't seem to find where this function is defined, so I can't figure 
out if it accepts more variables.


Specifically, I'm trying to recreate the 'media' descriptor below:

link rel=stylesheet type=text/css href=print.css 
https://teros.gocyber.com/v2/static/css/print.css media=print /


Does request.files.append take any more parameters?
Or, where can I find it documented?

Thanks.

--
Andrew Thompson
http://aktzero.com/



Re: [web2py] Re: request.files.append syntax

2011-05-25 Thread Andrew Thompson

On 5/25/2011 1:41 PM, Ross Peoples wrote:
response.file is what you are looking for, not request. And 
response.files is simply a list, and append just appends another item 
to the list. The web2py_ajax.html view is what loops through the list 
and writes the link and script tags. You might want to just go 
into your layout.html file and write this element yourself in HTML. 

Whoops! Should have copy/pasted... thought I did... Oh well...

Looks like request.files is simpler than I'd hoped, doesn't seem to 
support any more options.


I was trying to avoid hard coding directories into my layout.

--
Andrew Thompson
http://aktzero.com/



Re: [web2py] Re: 1.96.0 - stable 1.96.1?

2011-05-25 Thread Ross Peoples
Jose,

That is understandable. The two incompatibilities with Python 2.4 that I am 
aware of are:

http://code.google.com/p/web2py/issues/detail?id=269can=1q=python%202.4
and
http://code.google.com/p/web2py/issues/detail?id=267can=1q=python%202.4

This basically means that using from gluon import * will fail, as will 
using HMAC passwords in Auth. Since much of web2py has been modified to call 
from gluon import * internally, this means that the web2py server won't 
even start under Python 2.4, as issue 267 above (second link) points out.

If Python 2.4 support is a must for some people, then these two links 
include patches that will make most of web2py work, but it would obviously 
be completely unsupported and future updates would probably render the 
patches useless.

In the interest of keeping everyone informed, I thought it would be good for 
me to point out my experience with hacking web2py to run under Python 2.4.

Regards


Re: [web2py] Re: request.files.append syntax

2011-05-25 Thread Ross Peoples
You could always do something like this in your layout.html:

{{if 'extra_css_files' in response:}}
  {{for file, media in response.extra_css_files:}}
link rel=stylesheet type=text/css href={{=file}} 
media={{=media}} /
  {{pass}}
{{pass}}

Then in your menu.py, you would want to put this in:

response.extra_css_files = {}

And anywhere you want to include your print.css or any other type of CSS 
media, you would simply do this:

response.extra_css_files[URL('static', 'css/print.css')] = 'print'

Hardcoding is the easiest method, but if you plan on dynamically loading CSS 
based on media, then this would probably be the way to go.


[web2py] Re: Trouble updating with SQLFORM.factory and two tables

2011-05-25 Thread pbreit
I just meant take the requires out of the table definition and put it as a 
statement below the table. That's how all the examples are in the 
book: http://web2py.com/book/default/chapter/07#Database-Validators

I'm not sure it's the case in this instance or exactly what the issue is but 
sometimes the requires cannot be placed in the table definition.

If it still doesn't work, we need to see some code and a further error 
trace.


Re: [web2py] Re: 1.96.0 - stable 1.96.1?

2011-05-25 Thread pbreit
Python 2.4 users can also easily use an older version of Web2py.

[web2py] ATTENTION trunk users!!!!

2011-05-25 Thread Massimo Di Pierro
There is a new feature in trunk that needs tests and CAN mess up your
database metadata so...

1) remember - user trunk at your own risk
2) it would be great if you could test it but make sure you backup
your metadata (databases/*.table) first
3) if you upgrade to trunk please let me know if you encounter any
problem with existing apps on upgrade

What is the new feature? It changes the format of the databases/
*.table metadata to a more verbose format. Why? Because this will
allow to open a database from a script without having to run the
models. Web2py will be able to discover the metadata and rebuild the
table definitions automatically.

This is half done but needs a little more work and testing.

Massimo


Re: [web2py] ATTENTION trunk users!!!!

2011-05-25 Thread David J.

Thanks Massimo;

Sounds good;

Perhaps you can also let us know when it is safe to pull from Trunk for 
those using trunk in production.


Thanks.

David

On 5/25/11 2:20 PM, Massimo Di Pierro wrote:

There is a new feature in trunk that needs tests and CAN mess up your
database metadata so...

1) remember - user trunk at your own risk
2) it would be great if you could test it but make sure you backup
your metadata (databases/*.table) first
3) if you upgrade to trunk please let me know if you encounter any
problem with existing apps on upgrade

What is the new feature? It changes the format of the databases/
*.table metadata to a more verbose format. Why? Because this will
allow to open a database from a script without having to run the
models. Web2py will be able to discover the metadata and rebuild the
table definitions automatically.

This is half done but needs a little more work and testing.

Massimo





Re: [web2py] ATTENTION trunk users!!!!

2011-05-25 Thread Bruno Rocha
I would like to have a 'stable' repository to pull from my production
servers (it will remove the need to manage the branches)
--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]



On Wed, May 25, 2011 at 3:20 PM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 There is a new feature in trunk that needs tests and CAN mess up your
 database metadata so...

 1) remember - user trunk at your own risk
 2) it would be great if you could test it but make sure you backup
 your metadata (databases/*.table) first
 3) if you upgrade to trunk please let me know if you encounter any
 problem with existing apps on upgrade

 What is the new feature? It changes the format of the databases/
 *.table metadata to a more verbose format. Why? Because this will
 allow to open a database from a script without having to run the
 models. Web2py will be able to discover the metadata and rebuild the
 table definitions automatically.

 This is half done but needs a little more work and testing.

 Massimo


Re: [web2py] ATTENTION trunk users!!!!

2011-05-25 Thread Bruno Rocha
a HG repository of course, but, it would be very nice if some could maintain
multiple repositories as git,svn, bazaar and hg for automate scripts on
production servers.
--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]



On Wed, May 25, 2011 at 3:56 PM, Bruno Rocha rochacbr...@gmail.com wrote:

 I would like to have a 'stable' repository to pull from my production
 servers (it will remove the need to manage the branches)
 --
 Bruno Rocha
 [ About me: http://zerp.ly/rochacbruno ]



 On Wed, May 25, 2011 at 3:20 PM, Massimo Di Pierro 
 massimo.dipie...@gmail.com wrote:

 There is a new feature in trunk that needs tests and CAN mess up your
 database metadata so...

 1) remember - user trunk at your own risk
 2) it would be great if you could test it but make sure you backup
 your metadata (databases/*.table) first
 3) if you upgrade to trunk please let me know if you encounter any
 problem with existing apps on upgrade

 What is the new feature? It changes the format of the databases/
 *.table metadata to a more verbose format. Why? Because this will
 allow to open a database from a script without having to run the
 models. Web2py will be able to discover the metadata and rebuild the
 table definitions automatically.

 This is half done but needs a little more work and testing.

 Massimo





Re: [web2py] Re: 1.96.0 - stable 1.96.1?

2011-05-25 Thread Bruno Rocha
On Wed, May 25, 2011 at 3:08 PM, pbreit pbreitenb...@gmail.com wrote:

 Python 2.4 users can also easily use an older version of Web2py.


Indeed, if you can run older version of Python, you can run older version of
web2py!


Re: [web2py] ATTENTION trunk users!!!!

2011-05-25 Thread pbreit
Yeah, since I'm moving into production, I'm getting concerned about bug 
fixes only going in trunk. I realize managing two branches is tricky but 
that can't be too far on the horizon.

Re: [web2py] Re: request.files.append syntax

2011-05-25 Thread pbreit
Or heaven forbid:
link rel=stylesheet href={{=URL('static', 'css/blueprint/screen.css')}} 
type=text/css media=print

I don't really understand the response.files thing. I guess it's to be able 
to specify files elsewhere without modifying web2py_ajax.html?


[web2py] Difference between crud.create and SQLFORM

2011-05-25 Thread rixder
Hi!
First of all... I love web2py framework :-)
Problem:
I've made modification:
http://www.web2pyslices.com/main/slices/take_slice/113
and now if I use: form=crud.create(db.table) everything is ok. But if
I use
form=SQLFORM(db.table) nothing is happen, any error and any new
record.
I want ajax form with one field but with crud i have got tape fields
which may be
populate automaticaly...
What is the best sollution?

Best Regards,
Pawel





[web2py] Re: ATTENTION trunk users!!!!

2011-05-25 Thread Massimo Di Pierro
It is never safe to pull from trunk. ;-) when it is safe I move it to
stable

by the way I added support for circular references:

db.define_table('a',Field('name'),Field('b','reference b'))
db.define_table('b',Field('name'),Field('a','reference a'))
db.define_table('c',Field('name'),Field('c','reference c'))

at the expense of no check for broken reference

db.define_table('a',Field('name'),Field('b','reference d'))
cannot check if the reference if broken since d may or may not be
defined.

will be in trunk later in the day.

On May 25, 1:29 pm, David J. da...@styleflare.com wrote:
 Thanks Massimo;

 Sounds good;

 Perhaps you can also let us know when it is safe to pull from Trunk for
 those using trunk in production.

 Thanks.

 David

 On 5/25/11 2:20 PM, Massimo Di Pierro wrote:







  There is a new feature in trunk that needs tests and CAN mess up your
  database metadata so...

  1) remember - user trunk at your own risk
  2) it would be great if you could test it but make sure you backup
  your metadata (databases/*.table) first
  3) if you upgrade to trunk please let me know if you encounter any
  problem with existing apps on upgrade

  What is the new feature? It changes the format of the databases/
  *.table metadata to a more verbose format. Why? Because this will
  allow to open a database from a script without having to run the
  models. Web2py will be able to discover the metadata and rebuild the
  table definitions automatically.

  This is half done but needs a little more work and testing.

  Massimo


Re: [web2py] Re: ATTENTION trunk users!!!!

2011-05-25 Thread David J.

Yes; Thats True;

if production == True:
'clone stable'
else:
'good luck buster'


On 5/25/11 3:50 PM, Massimo Di Pierro wrote:

It is never safe to pull from trunk. ;-) when it is safe I move it to
stable

by the way I added support for circular references:

db.define_table('a',Field('name'),Field('b','reference b'))
db.define_table('b',Field('name'),Field('a','reference a'))
db.define_table('c',Field('name'),Field('c','reference c'))

at the expense of no check for broken reference

db.define_table('a',Field('name'),Field('b','reference d'))
cannot check if the reference if broken since d may or may not be
defined.

will be in trunk later in the day.

On May 25, 1:29 pm, David J.da...@styleflare.com  wrote:

Thanks Massimo;

Sounds good;

Perhaps you can also let us know when it is safe to pull from Trunk for
those using trunk in production.

Thanks.

David

On 5/25/11 2:20 PM, Massimo Di Pierro wrote:








There is a new feature in trunk that needs tests and CAN mess up your
database metadata so...
1) remember - user trunk at your own risk
2) it would be great if you could test it but make sure you backup
your metadata (databases/*.table) first
3) if you upgrade to trunk please let me know if you encounter any
problem with existing apps on upgrade
What is the new feature? It changes the format of the databases/
*.table metadata to a more verbose format. Why? Because this will
allow to open a database from a script without having to run the
models. Web2py will be able to discover the metadata and rebuild the
table definitions automatically.
This is half done but needs a little more work and testing.
Massimo




Re: [web2py] Re: ATTENTION trunk users!!!!

2011-05-25 Thread Bruno Rocha
On Wed, May 25, 2011 at 5:05 PM, David J. da...@styleflare.com wrote:

 if production == True:
'clone stable'


did you mean $hg clone http://code.google... web2py ? managing heads and
branches to get stable form repository? or is there a stable hg repository?


Re: [web2py] Re: alias field names

2011-05-25 Thread howesc
i don't see the reason for this.  true, from GAE's docs 
(http://code.google.com/appengine/articles/storage_breakdown.html):

Because App Engine's datastore is essentially schemaless, every entity of a 
particular kind must store the name of each property in addition to the 
value, even if every other entity of that kind uses the same set of 
properties. While this redundancy does result in a slight storage overhead, 
it also offers more flexibility for model definitions (see Effective 
PolyModel http://code.google.com/appengine/articles/polymodel.html for an 
example).

i understand saving space on limited hardware, and yes with millions of rows 
you might have a GB of storage for those names, so that might cost you $0.15 
a month, but i believe that cluttering your code with extra things like 
aliases, and making a database that can't be used without the code (no one 
would be able to understand the data if viewed in the GAE console), i'd pay 
the $0.15 a month.

just my $0.03. ;)

cfh


[web2py] webkit remotedebugger

2011-05-25 Thread dspiteself
Who would like to debug their javascript and css live in from web2py.
start chrome.exe --remote-debugging-port=9222
Then in another tab that contains the web2py admin open a websocket
connection to http://localhost:9222/json
you can do things like set breakpoints and other debug tasks, live
preview css changes save them back to the file, send server
information to the console. Really the possibilities only end with our
imaginations.  This kind of functionality would make web2py really
stand out in rapid app development. The first one to impliment this
kind of integration will get some serious visibility.
Would anyone be interested in working on this kind of integration with
me.I propose we add a debug action in the admin default controller.We
start with from the existing webkit inspect.
Does any one know if we could start with their bsd licensed code?
http://codesearch.google.com/codesearch/p?hl=en#OAMlx_jo-ck/src/third_party/WebKit/Source/WebCore/inspector/front-end/inspector.jsq=inspector%20frontendexact_package=chromiumd=7

Works now on chromes dev and canary channels support is coming to all
webkit browsers including mobile(blackberry playbook is first)


http://code.google.com/chrome/devtools/docs/remote-debugging.html
http://www.youtube.com/watch?v=TH7sJbyXHuk


Re: [web2py] Re: ATTENTION trunk users!!!!

2011-05-25 Thread pbreit
I suspect he meant $hg update R-1.95.1

And, more Pythonic:

if production:
...


Re: [web2py] Re: ATTENTION trunk users!!!!

2011-05-25 Thread David J
Hey sorry for the delayed response.  But if was meant as joke.
On May 25, 2011 7:30 PM, pbreit pbreitenb...@gmail.com wrote:
 I suspect he meant $hg update R-1.95.1

 And, more Pythonic:

 if production:
 ...


[web2py] Re: ATTENTION trunk users!!!!

2011-05-25 Thread ron_m
I backed up my database, made a copy of the application databases directory, 
hg pull and hg update on trunk.

Got this traceback right away

Traceback (most recent call last):
  File /home/camcentral/Dev/web2py-hg/gluon/restricted.py, line 184, in 
restricted
exec ccode in environment
  File /home/camcentral/Dev/web2py-hg/applications/ccims/models/A_db.py 
http://127.0.0.1:8000/admin/default/edit/ccims/models/A_db.py, line 49, in 
module
auth.define_tables(username=True)  # creates all needed tables
  File /home/camcentral/Dev/web2py-hg/gluon/tools.py, line 1148, in 
define_tables
format='%(username)s')
  File /home/camcentral/Dev/web2py-hg/gluon/dal.py, line 4175, in define_table
polymodel=polymodel)
  File /home/camcentral/Dev/web2py-hg/gluon/dal.py, line 633, in create_table
fake_migrate=fake_migrate)
  File /home/camcentral/Dev/web2py-hg/gluon/dal.py, line 716, in migrate_table
if query:
UnboundLocalError: local variable 'query' referenced before assignment

Did I miss a step? In development I default migrate=True fake_migrate=False

Ron




[web2py] Re: ATTENTION trunk users!!!!

2011-05-25 Thread ron_m
query isn't set in the last elif branch before the else


[web2py] Re: ATTENTION trunk users!!!!

2011-05-25 Thread ron_m
I added query = None after line 668 which is the line containing

for key in keys:

just before the line

if not key in sql_fields_old:

and got rid of all the query = None statements in the if elif branches plus 
got rid of the else branch.

I am happy to report this allowed the application to run completely without 
error.

I don't use all the features of web2py but then I am sure very few of us do.

Ron


[web2py] cache block of content in template rather than codebehind

2011-05-25 Thread Brian Will
I'd like to use cache.ram with some chunks of content in my templates,
and I'd rather not have to translate the chunks into the helper
equivalents, e.g. div to DIV(). Is there something like
{{cacheblock}}stuff{{end}}? Should there be?


[web2py] Re: cache block of content in template rather than codebehind

2011-05-25 Thread Anthony
On Wednesday, May 25, 2011 8:15:39 PM UTC-4, Brian Will wrote: 

 I'd like to use cache.ram with some chunks of content in my templates, 
 and I'd rather not have to translate the chunks into the helper 
 equivalents, e.g. div to DIV(). Is there something like 
 {{cacheblock}}stuff{{end}}? Should there be?

 
Maybe you could do something like:
 
{{=cache.ram('cached_view', lambda: 
XML(response.render('cacheable_view.html', response._vars)))}}
 
Or you could do the caching in the controller and just return the string to 
the view.
 
Anthony
 
 


[web2py] Re: ATTENTION trunk users!!!!

2011-05-25 Thread Massimo Di Pierro
Did anybody try with mysql?

Massimo

On May 25, 7:09 pm, ron_m ron.mco...@gmail.com wrote:
 I added query = None after line 668 which is the line containing

 for key in keys:

 just before the line

 if not key in sql_fields_old:

 and got rid of all the query = None statements in the if elif branches plus
 got rid of the else branch.

 I am happy to report this allowed the application to run completely without
 error.

 I don't use all the features of web2py but then I am sure very few of us do.

 Ron


[web2py] Re: ATTENTION trunk users!!!!

2011-05-25 Thread mattgorecki
I'm using MySQL and I just updated.  All of the *.table files updated
and the my app seems to be running okay so far.

Matt

On May 25, 7:32 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 Did anybody try with mysql?

 Massimo

 On May 25, 7:09 pm, ron_m ron.mco...@gmail.com wrote:







  I added query = None after line 668 which is the line containing

  for key in keys:

  just before the line

  if not key in sql_fields_old:

  and got rid of all the query = None statements in the if elif branches plus
  got rid of the else branch.

  I am happy to report this allowed the application to run completely without
  error.

  I don't use all the features of web2py but then I am sure very few of us do.

  Ron


[web2py] experimental in trunk...

2011-05-25 Thread Massimo Di Pierro
now you can do, from ANY python program

from gluon import DAL
db=DAL('sqlite://storage.sqlite',folder='applications/app/
databases',auto_import=True)
print db.tables

auto_import = True will rebuild all tables WITHOUT executing the
modules. Tables will have the right names, field names and field types
but will not have the right attributes (default, widget, readable,
writable, etc...) because they make no sense without an HTTP request.
This is only thought to allow a script to perform inserts and selects.

CAVEAT: this requires you run the app at least once using the new
trunk code since requires the new metadata format. By running the app
the *.table files are automatically converted to the new format.

Give it a try. Let me know if you have ideas for improvements.

Massimo

P.S. More stuff coming soon. ;-)



[web2py] Re: ATTENTION trunk users!!!!

2011-05-25 Thread Massimo Di Pierro
:-)

good. If the app starts than your metadata is correct.

On May 25, 8:41 pm, mattgorecki m...@goelephant.com wrote:
 I'm using MySQL and I just updated.  All of the *.table files updated
 and the my app seems to be running okay so far.

 Matt

 On May 25, 7:32 pm, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:







  Did anybody try with mysql?

  Massimo

  On May 25, 7:09 pm, ron_m ron.mco...@gmail.com wrote:

   I added query = None after line 668 which is the line containing

   for key in keys:

   just before the line

   if not key in sql_fields_old:

   and got rid of all the query = None statements in the if elif branches 
   plus
   got rid of the else branch.

   I am happy to report this allowed the application to run completely 
   without
   error.

   I don't use all the features of web2py but then I am sure very few of us 
   do.

   Ron


[web2py] field default lambdas being executed always?

2011-05-25 Thread Carlos
Hi,

Why are field default lambdas being executed always (as part of 
define_table)?.

* Example:

   def xdefault(v):
   print '= VALUE  %s' % v
   return v

   db.define_table(
   'xtable',
   Field('xfield1', default=lambda: xdefault('v1')),
   Field('xfield2', default=lambda: xdefault('v2')),
   Field('xfield3', default=lambda: xdefault('v3')),
   )

* Output:

   = VALUE  v1
   = VALUE  v2
   = VALUE  v3

* Stack trace for one of them:

   File C:\web2py\gluon\dal.py in define_table at line 4156
  
self._adapter.create_table(t,migrate=migrate,fake_migrate=fake_migrate,polymodel=polymodel)
   File C:\web2py\gluon\dal.py in create_table at line 551
  not_null = self.NOT_NULL(field.default,field.type)
   File C:\web2py\gluon\dal.py in NOT_NULL at line 750
  return 'NOT NULL DEFAULT %s' % self.represent(default,field_type)
   File C:\web2py\gluon\dal.py in represent at line 1200
  obj = obj()
   File C:\web2py\applications\test\models\db.py in lambda at line 88
  ... Field('xfield', default=lambda: xdefault('= VALUE =')), 
...
   File C:\web2py\applications\test\models\db.py in xdefault at line 83

I thought it was safe to put lambdas as field default values with the 
certainty that they won't be executed unless / until absolutely required 
(when new instances of the table are created without such default values), 
i.e. deferred execution.

Is this the expected behavior?.

p.s. I'm using trunk.

Thanks,

   Carlos



[web2py] Re: experimental in trunk...

2011-05-25 Thread mattgorecki
In order to do

from gluon import DAL

from an external program, I would need to add gluon to my Python path,
correct?  What directory does gluon live in?

Matt

On May 25, 7:43 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 now you can do, from ANY python program

 from gluon import DAL
 db=DAL('sqlite://storage.sqlite',folder='applications/app/
 databases',auto_import=True)
 print db.tables

 auto_import = True will rebuild all tables WITHOUT executing the
 modules. Tables will have the right names, field names and field types
 but will not have the right attributes (default, widget, readable,
 writable, etc...) because they make no sense without an HTTP request.
 This is only thought to allow a script to perform inserts and selects.

 CAVEAT: this requires you run the app at least once using the new
 trunk code since requires the new metadata format. By running the app
 the *.table files are automatically converted to the new format.

 Give it a try. Let me know if you have ideas for improvements.

 Massimo

 P.S. More stuff coming soon. ;-)


[web2py] Re: experimental in trunk...

2011-05-25 Thread Massimo Di Pierro
import sys; sys.path.append('/path/to/web2py')

On May 25, 8:53 pm, mattgorecki m...@goelephant.com wrote:
 In order to do

 from gluon import DAL

 from an external program, I would need to add gluon to my Python path,
 correct?  What directory does gluon live in?

 Matt

 On May 25, 7:43 pm, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:







  now you can do, from ANY python program

  from gluon import DAL
  db=DAL('sqlite://storage.sqlite',folder='applications/app/
  databases',auto_import=True)
  print db.tables

  auto_import = True will rebuild all tables WITHOUT executing the
  modules. Tables will have the right names, field names and field types
  but will not have the right attributes (default, widget, readable,
  writable, etc...) because they make no sense without an HTTP request.
  This is only thought to allow a script to perform inserts and selects.

  CAVEAT: this requires you run the app at least once using the new
  trunk code since requires the new metadata format. By running the app
  the *.table files are automatically converted to the new format.

  Give it a try. Let me know if you have ideas for improvements.

  Massimo

  P.S. More stuff coming soon. ;-)


Re: [web2py] experimental in trunk...

2011-05-25 Thread Bruno Rocha
Cool feature! Thanks. I am now planning to use it for a task queue based in
ActiveMQ.

web2py tagline is really 'improvements on every two weeks, or less'
--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]



On Wed, May 25, 2011 at 10:43 PM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 now you can do, from ANY python program

 from gluon import DAL
 db=DAL('sqlite://storage.sqlite',folder='applications/app/
 databases',auto_import=True)
 print db.tables

 auto_import = True will rebuild all tables WITHOUT executing the
 modules. Tables will have the right names, field names and field types
 but will not have the right attributes (default, widget, readable,
 writable, etc...) because they make no sense without an HTTP request.
 This is only thought to allow a script to perform inserts and selects.

 CAVEAT: this requires you run the app at least once using the new
 trunk code since requires the new metadata format. By running the app
 the *.table files are automatically converted to the new format.

 Give it a try. Let me know if you have ideas for improvements.

 Massimo

 P.S. More stuff coming soon. ;-)




[web2py] Re: field default lambdas being executed always?

2011-05-25 Thread Massimo Di Pierro
Fixed. It was the migration trying to figure out the default in NOT
NULL define tables.

On May 25, 8:48 pm, Carlos carlosgali...@gmail.com wrote:
 Hi,

 Why are field default lambdas being executed always (as part of
 define_table)?.

 * Example:

    def xdefault(v):
        print '= VALUE  %s' % v
        return v

    db.define_table(
        'xtable',
        Field('xfield1', default=lambda: xdefault('v1')),
        Field('xfield2', default=lambda: xdefault('v2')),
        Field('xfield3', default=lambda: xdefault('v3')),
    )

 * Output:

    = VALUE  v1
    = VALUE  v2
    = VALUE  v3

 * Stack trace for one of them:

    File C:\web2py\gluon\dal.py in define_table at line 4156

 self._adapter.create_table(t,migrate=migrate,fake_migrate=fake_migrate,poly 
 model=polymodel)
    File C:\web2py\gluon\dal.py in create_table at line 551
       not_null = self.NOT_NULL(field.default,field.type)
    File C:\web2py\gluon\dal.py in NOT_NULL at line 750
       return 'NOT NULL DEFAULT %s' % self.represent(default,field_type)
    File C:\web2py\gluon\dal.py in represent at line 1200
       obj = obj()
    File C:\web2py\applications\test\models\db.py in lambda at line 88
       ... Field('xfield', default=lambda: xdefault('= VALUE =')),
 ...
    File C:\web2py\applications\test\models\db.py in xdefault at line 83

 I thought it was safe to put lambdas as field default values with the
 certainty that they won't be executed unless / until absolutely required
 (when new instances of the table are created without such default values),
 i.e. deferred execution.

 Is this the expected behavior?.

 p.s. I'm using trunk.

 Thanks,

    Carlos


[web2py] Re: experimental in trunk...

2011-05-25 Thread mart
if you want to be light weight, you could also make a copy of dal.py
and put it anywhere it could be referenced, maybe same folder if you
want.

then you can simply have this import

from dal import DAL
from dal import Field


or in a folder structure that can be seen as a package by your script

then you would simply do

from folder1.folder2.dal import DAL
from folder1.folder2.dal import Field

Mart :)

On May 25, 10:09 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 Cool feature! Thanks. I am now planning to use it for a task queue based in
 ActiveMQ.

 web2py tagline is really 'improvements on every two weeks, or less'
 --
 Bruno Rocha
 [ About me:http://zerp.ly/rochacbruno]

 On Wed, May 25, 2011 at 10:43 PM, Massimo Di Pierro 







 massimo.dipie...@gmail.com wrote:
  now you can do, from ANY python program

  from gluon import DAL
  db=DAL('sqlite://storage.sqlite',folder='applications/app/
  databases',auto_import=True)
  print db.tables

  auto_import = True will rebuild all tables WITHOUT executing the
  modules. Tables will have the right names, field names and field types
  but will not have the right attributes (default, widget, readable,
  writable, etc...) because they make no sense without an HTTP request.
  This is only thought to allow a script to perform inserts and selects.

  CAVEAT: this requires you run the app at least once using the new
  trunk code since requires the new metadata format. By running the app
  the *.table files are automatically converted to the new format.

  Give it a try. Let me know if you have ideas for improvements.

  Massimo

  P.S. More stuff coming soon. ;-)


[web2py] Virtual fields and with_alias error

2011-05-25 Thread Jim Karsten
I am getting an exception raised when I combine virtual fields and aliases. 
Here is an example that produces the error. The example may not have 
practical use. It is used for illustration only. 

# In models/db.py 
db.define_table('person', 
Field('first_name'), 
Field('last_name')) 
db.define_table('couple', 
Field('husband_id', 
requires=IS_IN_DB(db, 'person.id', '%(first_name)s')), 
Field('wife_id', 
requires=IS_IN_DB(db, 'person.id', '%(first_name)s') 
)) 

class PersonVirtFields(object): 
def name(self): 
return %s %s % (self.person.first_name, self.person.last_name) 

db.person.virtualfields.append(PersonVirtFields()) 

# In controller 
def index(): 
husband = db.person.with_alias('husband') 
rows = db(db.couple.id0).select( husband.first_name, 
left=husband.on(husband.id==db.couple.husband_id)) 
return dict(rows=rows) 

The exception is: 
AttributeError: 'PersonVirtFields' object has no attribute 'person' 

I can avoid the exception if I change the line in the PersonVirtFields name 
method to: 
return %s %s % (self.husband.first_name, self.husband.last_name) 

The virtual class appears to be receiving the table name as per its alias. 
Is this a bug or is that expected behaviour? 

Regards, 
Jim Karsten 

[web2py] Re: experimental in trunk...

2011-05-25 Thread mattgorecki
I've got a working DAL connection that I can SELECT from.  I'm running
into a problem with an update like so:

db(db.feed.id == f.id).update(last_update=now)

The row isn't updating and I'm not getting any errors.  db._lastsql
shows this: UPDATE feed SET last_update='2011-05-25 20:40:56' WHERE
(feed.id = 1);  Which updates just fine in the MySQL console.

Any suggestions?

Matt

On May 25, 8:21 pm, mart msenecal...@gmail.com wrote:
 if you want to be light weight, you could also make a copy of dal.py
 and put it anywhere it could be referenced, maybe same folder if you
 want.

 then you can simply have this import

 from dal import DAL
 from dal import Field

 or in a folder structure that can be seen as a package by your script

 then you would simply do

 from folder1.folder2.dal import DAL
 from folder1.folder2.dal import Field

 Mart :)

 On May 25, 10:09 pm, Bruno Rocha rochacbr...@gmail.com wrote:







  Cool feature! Thanks. I am now planning to use it for a task queue based in
  ActiveMQ.

  web2py tagline is really 'improvements on every two weeks, or less'
  --
  Bruno Rocha
  [ About me:http://zerp.ly/rochacbruno]

  On Wed, May 25, 2011 at 10:43 PM, Massimo Di Pierro 

  massimo.dipie...@gmail.com wrote:
   now you can do, from ANY python program

   from gluon import DAL
   db=DAL('sqlite://storage.sqlite',folder='applications/app/
   databases',auto_import=True)
   print db.tables

   auto_import = True will rebuild all tables WITHOUT executing the
   modules. Tables will have the right names, field names and field types
   but will not have the right attributes (default, widget, readable,
   writable, etc...) because they make no sense without an HTTP request.
   This is only thought to allow a script to perform inserts and selects.

   CAVEAT: this requires you run the app at least once using the new
   trunk code since requires the new metadata format. By running the app
   the *.table files are automatically converted to the new format.

   Give it a try. Let me know if you have ideas for improvements.

   Massimo

   P.S. More stuff coming soon. ;-)


Re: [web2py] Re: experimental in trunk...

2011-05-25 Thread Bruno Rocha



 Any suggestions?

 Matt


Are you commiting?

db.commit() is necessary when out of web2py env


[web2py] easier auth customization in trunk

2011-05-25 Thread Massimo Di Pierro
Now you can do this:

auth.settings.extra_fields['auth_user']=(Field('address'),Field('country'),auth.signature)
auth.define_tables()

I do not think it needs any additional explanation.


[web2py] Re: experimental in trunk...

2011-05-25 Thread mattgorecki
Thank you, sir.  That works a bit better.

Matt

On May 25, 8:49 pm, Bruno Rocha rochacbr...@gmail.com wrote:
  Any suggestions?

  Matt

 Are you commiting?

 db.commit() is necessary when out of web2py env


Re: [web2py] Re: alias field names

2011-05-25 Thread Richard Baron Penman
Currently the datastore is at 1.3GB and costs next to nothing, so normally I
wouldn't care. But this project is for a client who doesn't want to enable
billing so I am trying every optimization I can find.


On Thu, May 26, 2011 at 7:16 AM, howesc how...@umich.edu wrote:

 i don't see the reason for this.  true, from GAE's docs (
 http://code.google.com/appengine/articles/storage_breakdown.html):

 Because App Engine's datastore is essentially schemaless, every entity of
 a particular kind must store the name of each property in addition to the
 value, even if every other entity of that kind uses the same set of
 properties. While this redundancy does result in a slight storage overhead,
 it also offers more flexibility for model definitions (see Effective
 PolyModel http://code.google.com/appengine/articles/polymodel.html for
 an example).

 i understand saving space on limited hardware, and yes with millions of
 rows you might have a GB of storage for those names, so that might cost you
 $0.15 a month, but i believe that cluttering your code with extra things
 like aliases, and making a database that can't be used without the code (no
 one would be able to understand the data if viewed in the GAE console), i'd
 pay the $0.15 a month.

 just my $0.03. ;)

 cfh



[web2py] Re: field default lambdas being executed always?

2011-05-25 Thread Carlos
great - thanks!

[web2py] error @ trunk - NoneType object has no attribute Table

2011-05-25 Thread Carlos
Hi,

I'm getting the following error @ trunk ...

web2py™ Version 1.96.0 (2011-05-25 21:52:16)
Python Python 2.6.4: C:\Python26\python.exe
Traceback

Traceback (most recent call last):
  File C:\web2py\gluon\restricted.py, line 184, in restricted
exec ccode in environment
  File C:/web2py/applications/test/models/db.py, line 33, in module
auth = Auth(db)# 
authentication/authorization
  File C:\web2py\gluon\tools.py, line 1014, in __init__
self.signature = db.Table(self.db,'auth_signature',
AttributeError: 'NoneType' object has no attribute 'Table'

Error snapshot help Detailed traceback description

type 'exceptions.AttributeError'('NoneType' object has no attribute 
'Table') 


Thanks,

   Carlos



[web2py] experimental in trunk... common_fields and precints

2011-05-25 Thread Massimo Di Pierro
There are two more features in trunk that I could use some testing
with (common fields and precints)

Imagine you have created an app school designed to manage one
school. It has one database and many tables. You wrote it with one
school in mind. Now you want to turn it into a service so that
multiple schools can register and use it. You want to identify the
school for example by the url http://harvard.anyschool.org and each
school should ONLY see its own users, groups, records, etc. etc.

Before today to do this you would have to rewrite all your tables and
queries.

Today you can do it without changing your code at all. You just have
to add this line after db=DAL(...)

 
db._common_fields=[Field('request_precinct',default=request.env.http_host,writable=False,readable=False)]

Yes. That is it!

How does it work?

1) db._common_fields is a list of fields that you want to add to all
tables.
2) The field called 'request_precinct' is special. Every query
involving a table having this field is automatically filtered byfield
value == field default. In our example the default is
request.env.http_host, i.e. the hostname in the http request which
identifies the school.
3) The field is hidden (writable=False,readable=False) but has a
default therefore it is automatically set for all inserts.

There is nothing special about schools here. You can use it with any
other app.

Give it a try and let me know.

I could use some help in writing some documentation about the new
features added today. ;-)

Massimo





[web2py] Re: error @ trunk - NoneType object has no attribute Table

2011-05-25 Thread Massimo Di Pierro
just fixed it. Thanks for reporting.

On May 25, 10:27 pm, Carlos carlosgali...@gmail.com wrote:
 Hi,

 I'm getting the following error @ trunk ...

 web2py™ Version 1.96.0 (2011-05-25 21:52:16)
 Python Python 2.6.4: C:\Python26\python.exe
 Traceback

 Traceback (most recent call last):
   File C:\web2py\gluon\restricted.py, line 184, in restricted
     exec ccode in environment
   File C:/web2py/applications/test/models/db.py, line 33, in module
     auth = Auth(db)                                #
 authentication/authorization
   File C:\web2py\gluon\tools.py, line 1014, in __init__
     self.signature = db.Table(self.db,'auth_signature',
 AttributeError: 'NoneType' object has no attribute 'Table'

 Error snapshot help Detailed traceback description

 type 'exceptions.AttributeError'('NoneType' object has no attribute
 'Table')

 Thanks,

    Carlos


[web2py] Re: Virtual fields and with_alias error

2011-05-25 Thread Massimo Di Pierro
I think it is a bug. Please open a ticket.

On May 25, 9:23 pm, Jim Karsten iiijjj...@gmail.com wrote:
 I am getting an exception raised when I combine virtual fields and aliases.
 Here is an example that produces the error. The example may not have
 practical use. It is used for illustration only.

 # In models/db.py
 db.define_table('person',
 Field('first_name'),
 Field('last_name'))
 db.define_table('couple',
 Field('husband_id',
 requires=IS_IN_DB(db, 'person.id', '%(first_name)s')),
 Field('wife_id',
 requires=IS_IN_DB(db, 'person.id', '%(first_name)s')
 ))

 class PersonVirtFields(object):
 def name(self):
 return %s %s % (self.person.first_name, self.person.last_name)

 db.person.virtualfields.append(PersonVirtFields())

 # In controller
 def index():
 husband = db.person.with_alias('husband')
 rows = db(db.couple.id0).select( husband.first_name,
 left=husband.on(husband.id==db.couple.husband_id))
 return dict(rows=rows)

 The exception is:
 AttributeError: 'PersonVirtFields' object has no attribute 'person'

 I can avoid the exception if I change the line in the PersonVirtFields name
 method to:
 return %s %s % (self.husband.first_name, self.husband.last_name)

 The virtual class appears to be receiving the table name as per its alias.
 Is this a bug or is that expected behaviour?

 Regards,
 Jim Karsten


[web2py] Re: experimental in trunk... common_fields and precints

2011-05-25 Thread mattgorecki
So in this example request_precinct would equal harvard.anyschool.org?

Matt

On May 25, 9:47 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 There are two more features in trunk that I could use some testing
 with (common fields and precints)

 Imagine you have created an app school designed to manage one
 school. It has one database and many tables. You wrote it with one
 school in mind. Now you want to turn it into a service so that
 multiple schools can register and use it. You want to identify the
 school for example by the urlhttp://harvard.anyschool.organd each
 school should ONLY see its own users, groups, records, etc. etc.

 Before today to do this you would have to rewrite all your tables and
 queries.

 Today you can do it without changing your code at all. You just have
 to add this line after db=DAL(...)

 db._common_fields=[Field('request_precinct',default=request.env.http_host,writable=False,readable=False)]

 Yes. That is it!

 How does it work?

 1) db._common_fields is a list of fields that you want to add to all
 tables.
 2) The field called 'request_precinct' is special. Every query
 involving a table having this field is automatically filtered byfield
 value == field default. In our example the default is
 request.env.http_host, i.e. the hostname in the http request which
 identifies the school.
 3) The field is hidden (writable=False,readable=False) but has a
 default therefore it is automatically set for all inserts.

 There is nothing special about schools here. You can use it with any
 other app.

 Give it a try and let me know.

 I could use some help in writing some documentation about the new
 features added today. ;-)

 Massimo


[web2py] Re: can't use admin, can't see tickets with localhost google appengine SDK

2011-05-25 Thread Luis Goncalves
In reply to your and ron_m's messages:

On Ubuntu 10.04.02 with python 2.6.5,

When I have a simple error in my python controller (say,  return
dict(ans=ans)  , where ans hasn't been defined),

if I run python web2py.py :

I first get the web-browser error:

   Internal error
   Ticket issued: welcome/
127.0.0.1.2011-05-26.04-31-29.b6c7d52d-b576-406b-ba3d-74308226e85b

and clicking on the ticket opens another tab with another
Internal error ticket (ad infinitum if I keep on clicking)

   invalid request

I also don't see any messages on the terminal where I ran
web2py.py.

If I run the gae with python dev_appserver.py ../web2py/

I first get an Internal error ticket,

and if I click on it, I get a new tab with invalid request (and
no link).

At least with the GAE I can see the error traceback in the shell
running the server!

Permissions are:
  drwxrwxr-x 2 zb zb 4.0K 2011-05-25 21:27 errors/

  and in errors/

  -rw-r--r-- 1 zb zb 87K 2011-05-25 21:27
127.0.0.1.2011-05-25.21-27-52.12358da4-3e47-461b-9fae-fd190aebfb65

which seems to be OK for viewing

So it's still a mystery why I don't get web tickets and admin!

(Note: I am at least missing the Tk library, because I get a warning
when I run web2py.py:
   WARNING:web2py:GUI not available because Tk library is not
installed
 -- does not seem that has anything to do with it, though, other than
being an indication that I don't technically have everything that
web2py needs, which oddly enough I did have on my old debian system!)

Thank you, pbreit and ron_m for your help and advice!!!

Luis.

On May 25, 9:03 am, pbreit pbreitenb...@gmail.com wrote:
 I run 10.04.2 and admin works fine. Are you getting error messages?

 I have found it's usually quite easy to resolve HTML errors. The traceback
 usually includes the view file's line number and/or the code listing shows
 the view file converted into Python which is easy enough to identify.


[web2py] Re: can't use admin, can't see tickets with localhost google appengine SDK

2011-05-25 Thread pbreit
Are you running on Mac, Windows or Linux? Here's the command I run on Mac:
python web2py.py -a recycle -i 127.0.0.1 -p 8001'

If you are running from command line you don't even use Tk. Are you using 
one of the binaries or the source code (I prefer source)? Have you tried 
re-installing?


[web2py] Re: can't use admin, can't see tickets with localhost google appengine SDK

2011-05-25 Thread ron_m
Looks like you get a ticket trying to display the application error ticket. 
I had that once but I was debugging something in trunk that was broken at 
the time.

You mentioned you have a fully and properly working debain version. I 
believe it is legit to move the files under errors in your application to 
the system that works and look at them there using the admin interface. That 
might help get a handle on it.

Also when the admin system gets an error you will find the ticket file under 
applications/admin/errors.

You are using stable from web2py currently 1.95.1?

I would be tempted to download the zip file, unpack it and slide it into 
place where the existing one is now after you rename the top directory of 
the old one. Then you can run a diff to see if something got changed 
somehow.

Is there a requirement to run GAE on python 2.5? What version of Python is 
on your debian system where everything is working? I run standalone or under 
apache with wsgi on Python 2.6.5 without issues. Have a look at 
web2py/scripts/setup-web2py-ubuntu.sh and you can see the packages that get 
loaded in there. I wouldn't load in matplotlib or reportlab unless you need 
them.

Ron