[web2py] Getting Apache error on a web2py.com page

2010-12-27 Thread Kenneth Lundström
I was looking for making a page into a popup and found this page in 
Google groups:

http://groups.google.com/group/web2py/browse_thread/thread/a753c07af1e396bc/56f7ed4ca7a62fb1?lnk=gstq=popup+login#56f7ed4ca7a62fb1

There is a link to page:
http://www.web2py.com/events/default/index

which returns:


 OK

The server encountered an internal error or misconfiguration and was 
unable to complete your request.


Please contact the server administrator, [no address given] and inform 
them of the time the error occurred, and anything you might have done 
that may have caused the error.


More information about this error may be available in the server error log.


Kenneth




[web2py] SQLFORM into a pop window

2010-12-27 Thread Kenneth Lundström
Does anybody have a example of how to make a sqlform open up in a popup 
window?



Kenneth



[web2py] cron quest

2010-12-27 Thread Manuele Pesenti

Hi *!
I'm trying to set up a function in crontab, I'd like to run it daily or 
after run web2py so following the doc I write the crontab file as follows:


#crontab
@reboot  *  *  *  *  root *cronfun/fetch_all_data
@daily   *  *  *  *  root *cronfun/fetch_all_data

now running web2py it seams it has been ignored. There's something more 
to do? Do I have to choose the web2py application to run in some way or 
specify some extension running the web2py server?


thank you very much

Manuele


[web2py] Re: Left Join with aliased table and the new DAL

2010-12-27 Thread HaM
First, Merry Christmas.

Since I still experiencing problem on left join I have looked more
deeply and try to find where is the difference between old and new
DAL.
I found that my problem only appears on a more complex request:

Domain = dbPsnol.domain
Client = dbPsnol.client
Contact = dbPsnol.contact
Manager = dbPsnol.contact.with_alias('manager')
Datacenter = dbPsnol.datacenter
PsnVersion = dbPsnol.psn_version
Server = dbPsnol.server

query = dbPsnol((Domain.id==request.args[0])
(Client.id==Domain.client_id)
(Datacenter.id==Domain.dc_id)
(PsnVersion.id==Domain.psn_version_id))

sql = query._select(Domain.name, Client.name,
Manager.name, left=[
Manager.on(Manager.id==Client.manager_id)])
print sql

With the old DAL:
SELECT domain.name, client.name, manager.name FROM datacenter, domain,
psn_version, client LEFT JOIN contact AS manager ON
manager.id=client.manager_id WHERE (((domain.id=211 AND
psn_version.id=domain.psn_version_id) AND datacenter.id=domain.dc_id)
AND client.id=domain.client_id);

With the new DAL:
SELECT  domain.name, client.name, manager.name FROM datacenter,
domain, client, psn_version LEFT JOIN contact AS manager ON
(manager.id = client.manager_id) WHERE domain.id = 211) AND
(psn_version.id = domain.psn_version_id)) AND (datacenter.id =
domain.dc_id)) AND (client.id = domain.client_id));

The difference is almost invisible, but tables client and psn_version
have swap in the FROM part of the request. It seems that my problem
come from there since the new DAL syntax isn't correct for PostgreSQL.

For my second problem (INNER JOIN and alias) I will open a new ticket
quickly. Many thanks for your work.


On 24 déc, 02:57, mdipierro mdipie...@cs.depaul.edu wrote:
 I took a second look. The first problem is indeed fixed. The second
 problem is not a new dal issue. It is just that aliased tables in
 INNER JOINs never worked well. I will continue to look into it. This
 may take a while so could you open a ticket on google code? Thanks.

 On Dec 22, 2:52 am, HaM yarib...@gmail.com wrote:

  Ok in order to simplify the problem I have changed my code to this:
  Domain = db.domain
  Client = db.client
  Manager = db.contact.with_alias('manager')

  sql = db((Domain.id==1)(Client.id==Domain.client_id))._select(
                  Domain.name, Client.name, Manager.name,
                  left=[Manager.on(Manager.id==Client.manager_id)])
  print sql

  The result is:
  SELECT  domain.name, client.name, contact.name FROM domain, client,
  contact LEFT JOIN contact AS manager ON (contact.id =
  client.manager_id) WHERE ((domain.id = 1) AND (client.id =
  domain.client_id));

  And this request is not correct for PostgreSQL. I think that it should
  be :
  SELECT  domain.name, client.name, manager.name FROM domain, client
  LEFT JOIN contact as manager ON (manager.id = client.manager_id) WHERE
  ((domain.id = 1) AND (client.id = domain.client_id));

  Which works well.

  In order to push research further I also tried to do only INNER JOIN
  with an aliased table and it partially works:
  Domain = db.domain
  Client = db.client
  Manager = db.contact.with_alias('manager')
  sql = db((Domain.id==1)
          (Client.id==Domain.client_id)
          (Manager.id==Client.manager_id))._select(
          Domain.name, Client.name, Manager.name)
  print sql

  Result:
  SELECT  domain.name, client.name, contact.name FROM domain, client,
  contact WHERE (((domain.id = 1) AND (client.id = domain.client_id))
  AND (contact.id = client.manager_id));

  It works but it doesn't use the alias name for the table contact. Thus
  the resulting dict() doesn't contains the key manager but the key
  contact.

  Thank you for investigating this problem so quickly.

  On Dec 21, 10:57 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   hmm...

   I am trying your select and it now generates the same sql as the old
   dal. please try this:

   Domain = db.domain
   Client = db.client
   Manager = db.contact.with_alias('manager')
   sql = db(Domain.id==1)._select(
       Domain.ALL, Client.ALL,Manager.ALL,
       left=[Client.on(Client.id==Domain.client_id),
             Manager.on(Manager.id==Client.manager_id)])
   print sql

   what do you get?
   I get

   SELECT  domain.id, domain.name, domain.client_id, client.id,
   client.name, client.manager_id, manager.id, manager.name FROM domain
   LEFT JOIN client ON (client.id = domain.client_id) LEFT JOIN contact
   AS manager ON (manager.id = client.manager_id) WHERE (domain.id = 1);

   On Dec 21, 2:55 pm, HaM yarib...@gmail.com wrote:

I just tried with the last revision (1414:da25156addab) and the
problem stills the same.




Re: [web2py] Re: memory leak - model remains in memory after requests

2010-12-27 Thread David Zejda
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I think you are right. It is highly probable that my app is leaking
somehow. I do not cache dal objects directly and I use finite set of
indentifiers for cached objects, but it is possible that some of my
objects reference dal objects in an unwanted way, leading to some kind
of circular references which prevent garbage collection. It is not easy
to identify where exactly is the problem rooted, because my model is
quite complex (more than 100 tables, highly interlinked, etc.) and I
cache business objects built above DAL a lot. Maybe I'll use some tool
to examine the references between objects in memory (objgraph?).

So, I agree that there is probably no leak directly in web2py or Rocket
and uWSGI does not bring cure for the memory leak disease causation, but
it removes the symptoms, which makes me satisfied for now. The new setup
is also more stable. With Rocket my web2py freezed every couple of hours
(http://groups.google.com/group/web2py/browse_thread/thread/bd4f6e9f20d1a5aa)
and I had to monitor its state and force restarts whenever it happened.
Now it either freezes no more or Cherokee restarts uwsgi behind the
scenes whenever necessary. :)

David

Timbo wrote:
 So you do use caching?  Is it RAM caching or disk caching?  If RAM
 caching, it could be that running under Cherokee and uWSGI is deleting
 the environment that web2py is run in after a certain number of
 requests.  This would reduce the usefulness of a RAM cache but would
 also produce the results you're seeing. Whereas a Python-based server
 (Rocket or Cherrypy) would not do this and a RAM cache would persist
 as long as the server process (or until otherwise deleted).
 
 Please let us know when you look into the possibilities of caching
 being the issue.
 
 @ron_m: Awesome.  Great suggestions!
 
 -tim
 
 On Dec 25, 3:20 pm, David Zejda d...@atlas.cz wrote:
 Thanks for the all replies!

 I do not directly cache DAL objects, but yes, caching may be behind
 the leak
 through some references between objects. Maybe I'll examine it with
 objgraph,
 and I agree, it would be nice to have the function at hand in the
 admin interface.

 Cherrypy  anyserver brings no significant change.

 With Cherokee  uWSGI the problem has gone. Moreover the new setup is
 subjectively
 faster to the previous one (Rocket behind Apache proxy). :)

 David
 
 

- --
David Zejda, Open-IT cz
web development  services
http://www.o-it.info
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAk0YZeMACgkQ3oCkkciamVFgdgCfczag6uRCsadFl+TtTBj+SDgV
BokAoLfKc4Caslc0QISWt1fXf6lAhCBv
=+XpP
-END PGP SIGNATURE-


[web2py] autocomplete - style: widht hard coded ??

2010-12-27 Thread Ole Martin Maeland
Hi,

I have a autocomplete field in a form, and I would like it to be wider.
Looking at the code it looks like it is hard coded - width: 200px, how do I
overriede that in CSS ??



jQuery('#_autocomplete_paper_div').fadeOut('slow'); type=textinput
id=_autocomplete_paper_auto name=paper value= type=hiddendiv
id=_autocomplete_paper_div style=position: absolute; display:
none;select style=width: 200px; class=autocomplete


Regards,
Martin


[web2py] Re: CSS probleme

2010-12-27 Thread Martin.Mulone
There are no css customization over upload input in the base.css, because 
any css rules is override with the browser, perhaps some yes, but it's hard 
to achieve and requiere some js hacks and don't work with all browser.  See 
http://www.quirksmode.org/dom/inputfile.html if you want to do that, any 
easy solution is welcome.

Re: [web2py] autocomplete - style: widht hard coded ??

2010-12-27 Thread Branko Vukelić
Better modify the code.

On Mon, Dec 27, 2010 at 11:28 AM, Ole Martin Maeland
olemael...@gmail.com wrote:
 Hi,

 I have a autocomplete field in a form, and I would like it to be wider.
 Looking at the code it looks like it is hard coded - width: 200px, how do I
 overriede that in CSS ??



 jQuery('#_autocomplete_paper_div').fadeOut('slow'); type=textinput
 id=_autocomplete_paper_auto name=paper value= type=hiddendiv
 id=_autocomplete_paper_div style=position: absolute; display:
 none;select style=width: 200px; class=autocomplete


 Regards,
 Martin




-- 
Branko Vukelic

stu...@brankovukelic.com
http://www.brankovukelic.com/


Re: [web2py] Re: CSS probleme

2010-12-27 Thread Branko Vukelić
On Mon, Dec 27, 2010 at 11:30 AM, Martin.Mulone mulone.mar...@gmail.com wrote:
  See http://www.quirksmode.org/dom/inputfile.html if you want to do that,
 any easy solution is welcome.

I don't think there's a good solution for that that doesn't involve
javascript. And even the best-looking solutions I've seen simply
cripple the basic functionality. I think it's better to just unstyle
form controls entirely, and manipulate only things like font-family,
font-size, padding, margin, width, and height to make layout easier.

-- 
Branko Vukelic

stu...@brankovukelic.com
http://www.brankovukelic.com/


Re: [web2py] Re: The stability of web2py releases

2010-12-27 Thread Martín Mulone
+1 to bitbucket. Bitbucket is great!, If we can clone in bitbucket,
also if we can separate welcome/ and admin/ as independant app, we can
contribute more to the web2py.

2010/12/24 Branko Vukelić stu...@brankovukelic.com:
 2010/12/24 Kenneth Lundström kenneth.t.lundst...@gmail.com:
 Is there instructions how to use the hg stuff to use the trunk. Could not
 find the hg command in the book?

 Look here:

 http://code.google.com/p/web2py/source/checkout

 I think the double-update button is a good idea. I was going to
 suggest/implement the same thing. I haven't looked yet at how the
 update works server-side. Will look as soon as I have more time.

 @Massimo, what do you think about cloning the project to Bitbucket?

 https://bitbucket.org/


 --
 Branko Vukelic

 stu...@brankovukelic.com
 http://www.brankovukelic.com/




-- 
My blog: http://martin.tecnodoc.com.ar
My portfolio *spanish*: http://www.tecnodoc.com.ar
Checkout my last proyect instant-press: http://www.instant2press.com


Re: [web2py] autocomplete - style: widht hard coded ??

2010-12-27 Thread Ole Martin Maeland
the code is a autogenerated form using SQLFORM - from the construction of
the db, where I defined the autocomplete widget. would not like to hardcode
it in the view template - so are there any other way to change the widht ??

regards
Ole Martin

2010/12/27 Branko Vukelić stu...@brankovukelic.com

 Better modify the code.

 On Mon, Dec 27, 2010 at 11:28 AM, Ole Martin Maeland
 olemael...@gmail.com wrote:
  Hi,
 
  I have a autocomplete field in a form, and I would like it to be wider.
  Looking at the code it looks like it is hard coded - width: 200px, how do
 I
  overriede that in CSS ??
 
 
 
  jQuery('#_autocomplete_paper_div').fadeOut('slow'); type=textinput
  id=_autocomplete_paper_auto name=paper value= type=hiddendiv
  id=_autocomplete_paper_div style=position: absolute; display:
  none;select style=width: 200px; class=autocomplete
 
 
  Regards,
  Martin
 



 --
 Branko Vukelic

 stu...@brankovukelic.com
 http://www.brankovukelic.com/




-- 
Hilsen
Ole Martin
Mob: 95227471


[web2py] SimpleGeo - free tools for creating location aware apps with Python Client and SDK

2010-12-27 Thread Tom Atkins
Just for interest if you're building a location aware app:

http://simplegeo.com


[web2py] jquey effect problem

2010-12-27 Thread Sahil Arora
I tried this code to see the jquery effect.

div class=one id=a onclick=jQuery('.two').slideToggle()Hello/div
div class=two hidden id=bWorld/div

but onclicking on Hello slide Toggles but nothing appears( 'world' doesn't
appear).Just a blank line.

-- 
Sahil Arora
B.Tech 2nd year
Computer Science and Engineering
IIT Delhi
Contact No: +91 9871491046
Homepage-www.cse.iitd.ac.in/~cs1090213


[web2py] Re: jquey effect problem

2010-12-27 Thread Luther Goh Lu Feng
The syntax is correct. Is the jquery library included?

You need to include something like

script src=//ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js/
script

Also look at the javascript console for possible errors.


On Dec 27, 8:21 pm, Sahil Arora sahilarora...@gmail.com wrote:
 I tried this code to see the jquery effect.

 div class=one id=a onclick=jQuery('.two').slideToggle()Hello/div
 div class=two hidden id=bWorld/div

 but onclicking on Hello slide Toggles but nothing appears( 'world' doesn't
 appear).Just a blank line.

 --
 Sahil Arora
 B.Tech 2nd year
 Computer Science and Engineering
 IIT Delhi
 Contact No: +91 9871491046
 Homepage-www.cse.iitd.ac.in/~cs1090213


Re: [web2py] Re: jquey effect problem

2010-12-27 Thread Sahil Arora
i am doing this in default/index.html page in a application which extends
layout.html which i think includes web2py_ajax.html . So is there any need
to include any thing else.

On Mon, Dec 27, 2010 at 6:29 PM, Luther Goh Lu Feng elf...@yahoo.comwrote:

 The syntax is correct. Is the jquery library included?

 You need to include something like

 script src=//ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js/
 script

 Also look at the javascript console for possible errors.


 On Dec 27, 8:21 pm, Sahil Arora sahilarora...@gmail.com wrote:
  I tried this code to see the jquery effect.
 
  div class=one id=a
 onclick=jQuery('.two').slideToggle()Hello/div
  div class=two hidden id=bWorld/div
 
  but onclicking on Hello slide Toggles but nothing appears( 'world'
 doesn't
  appear).Just a blank line.
 
  --
  Sahil Arora
  B.Tech 2nd year
  Computer Science and Engineering
  IIT Delhi
  Contact No: +91 9871491046
  Homepage-www.cse.iitd.ac.in/~cs1090213http://Homepage-www.cse.iitd.ac.in/%7Ecs1090213




-- 
Sahil Arora
B.Tech 2nd year
Computer Science and Engineering
IIT Delhi
Contact No: +91 9871491046
Homepage-www.cse.iitd.ac.in/~cs1090213


[web2py] Possible bug in SQLFORM.factory in version 1.91.4?

2010-12-27 Thread Lisandro
I've been working with web2py for a while. Lastnight I updated to last
version, and my webforms collapsed (those constructed with
SQLFORM.factory).

More precisely, the problem appeared in the forms where I mix some
existing fields of the database with other fields defined on the run,
just like this example:
--
form = SQLFORM.factory(
  db.mytable.oneexistingfield,
  Field('nonexistingfield', 'string'),
  db.mytable.anotherexistingfield)
--


Anyway. After some minutes searching for the cause of the problem,
I've decided to start from scratch with an example. I downloaded the
version 1.91.4 (I'm using Ubuntu 10.04). I created a new application.

The model (very simple, I took it from web2py examples):
--
db.define_table('person',
   Field('name'))
db.define_table('dog',
   Field('name'),
   Field('owner', db.person))
--



Then, I wrote the index function on default.py controller:
--
def index():
   form = SQLFORM.factory(db.dog)
   dogs = db(db.dog.id0).select()
   return dict(form=form, dogs=dogs)
--
In the view I just added {{=form}} and {{=BEAUTIFY(dogs)}}, just to
see the result of the function.



When I try to run the function, I receive the following error:
--
Traceback (most recent call last):
 File /home/lisandro/pylicencias/gluon/restricted.py, line 188, in
restricted
   exec ccode in environment
 File /home/lisandro/pylicencias/applications/prueba/controllers/
default.py, line 20, in module
 File /home/lisandro/pylicencias/gluon/globals.py, line 95, in
lambda
   self._caller = lambda f: f()
 File /home/lisandro/pylicencias/applications/prueba/controllers/
default.py, line 14, in index
   form = SQLFORM.factory(db.dog)
 File /home/lisandro/pylicencias/gluon/sqlhtml.py, line 1182, in
factory
   return SQLFORM(SQLDB(None).define_table(table_name, *fields),
 File /home/lisandro/pylicencias/gluon/dal.py, line 3314, in
define_table
   t._create_references()
 File /home/lisandro/pylicencias/gluon/dal.py, line 3607, in
_create_references
   rtable = self._db[rtablename]
 File /home/lisandro/pylicencias/gluon/dal.py, line 3335, in
__getitem__
   return dict.__getitem__(self, str(key))
KeyError: 'person'
--


The SAME code, but using SQLFORM(db.dog) instead of
SQLFORM.factory(db.dog), works just fine.
The SAME code, but with an older version of web2py, works just fine.
What happened to SQLFORM.factory? Some bug? Or it's just me that I'm
doing something wrong?

Thanks in advance.


[web2py] Re: jquey effect problem

2010-12-27 Thread Luther Goh Lu Feng
I suggest inspecting the source to see the hhtml for the blank line.

On Dec 27, 9:10 pm, Sahil Arora sahilarora...@gmail.com wrote:
 see the attachment..
 first is before clicking on hello
 second is after clicking..
 only a blank line comes

 On Mon, Dec 27, 2010 at 6:32 PM, Sahil Arora sahilarora...@gmail.comwrote:









  i am doing this in default/index.html page in a application which extends
  layout.html which i think includes web2py_ajax.html . So is there any need
  to include any thing else.

  On Mon, Dec 27, 2010 at 6:29 PM, Luther Goh Lu Feng elf...@yahoo.comwrote:

  The syntax is correct. Is the jquery library included?

  You need to include something like

  script src=//ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js/
  script

  Also look at the javascript console for possible errors.

  On Dec 27, 8:21 pm, Sahil Arora sahilarora...@gmail.com wrote:
   I tried this code to see the jquery effect.

   div class=one id=a
  onclick=jQuery('.two').slideToggle()Hello/div
   div class=two hidden id=bWorld/div

   but onclicking on Hello slide Toggles but nothing appears( 'world'
  doesn't
   appear).Just a blank line.

   --
   Sahil Arora
   B.Tech 2nd year
   Computer Science and Engineering
   IIT Delhi
   Contact No: +91 9871491046
   Homepage-www.cse.iitd.ac.in/~cs1090213http://Homepage-www.cse.iitd.ac.in/%7Ecs1090213

  --
  Sahil Arora
  B.Tech 2nd year
  Computer Science and Engineering
  IIT Delhi
  Contact No: +91 9871491046
  Homepage-www.cse.iitd.ac.in/~cs1090213http://Homepage-www.cse.iitd.ac.in/%7Ecs1090213

 --
 Sahil Arora
 B.Tech 2nd year
 Computer Science and Engineering
 IIT Delhi
 Contact No: +91 9871491046
 Homepage-www.cse.iitd.ac.in/~cs1090213

  1.png
 203KViewDownload

  2.png
 208KViewDownload


[web2py] How can I translate/customize plugin_wiki multiselect widget?

2010-12-27 Thread Tito Garrido
Hi Folks,

How can I personalize plugin_wiki multiselect widget?

Regards,

Tito

-- 

Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___


Re: [web2py] How can I translate/customize plugin_wiki multiselect widget?

2010-12-27 Thread Bruno Rocha
plugin_multiselect is only JavaScript.

You have to edit css and JS files in /static/plugin_wiki/multiselect/



2010/12/27 Tito Garrido titogarr...@gmail.com

 Hi Folks,

 How can I personalize plugin_wiki multiselect widget?

 Regards,

 Tito

 --

 Linux User #387870
 .
  _/_õ|__|
 ..º[ .-.___.-._| . . . .
 .__( o)__( o).:___




-- 

Bruno Rocha
http://about.me/rochacbruno/bio


Re: [web2py] SimpleGeo - free tools for creating location aware apps with Python Client and SDK

2010-12-27 Thread Bruno Rocha
Thanks for sharing, exactly what I need for a new project.

2010/12/27 Tom Atkins minkto...@gmail.com

 Just for interest if you're building a location aware app:

 http://simplegeo.com





-- 

Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] Re: 1.91.4 error reading version file

2010-12-27 Thread reyelts
So is this a packaging error when building the source package for
download from web2py.com?

On Dec 25, 5:22 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Dec 25, 2010, at 1:40 PM, reyelts wrote:



  Either the code should be looking for the name 'version' (since that's
  what is shipped) or the file should be renamed 'VERSION' (since that's
  what's hardcoded in the source). Shipping 'version' and coding
  'VERSION' is just asking for the problem we currently see.

 FWIW, it's 'VERSION' in the Mercurial source repository.


[web2py] INNER JOIIN and aliased table

2010-12-27 Thread HaM
Hi,

I'm trying to do INNER JOIN with aliased table and I'm experiencing
problem.
Here is my example:

Domain = db.domain
Client = db.client
Manager = db.contact.with_alias('manager')
sql = db((Domain.id==1)
(Client.id==Domain.client_id)
(Manager.id==Client.manager_id))._select(
Domain.name, Client.name, Manager.name)
print sql

Result:
SELECT  domain.name, client.name, contact.name FROM domain, client,
contact WHERE (((domain.id = 1) AND (client.id = domain.client_id))
AND (contact.id = client.manager_id));

It works but it doesn't use the alias name for the table contact. Thus
the resulting dict() doesn't contains the key manager but the key
contact.

Thanks again for your investigations.


Re: [web2py] Re: The stability of web2py releases

2010-12-27 Thread R. Strusberg
+1

2010/12/24 ron_m ron.mco...@gmail.com:
 I for one am happy with the current release cycle. It is a good balance
 between new features and the ultimate stability of release 1.XX.N  where N
 is the last version before XX+1 for example. The nightly build is a bit of a
 misnomer, many projects (C or C++ mostly) have some automated process that
 takes trunk and compiles it to produce a .tar.gz labelled nightly which
 might work. For web2py we should just hg pull; hg update to achieve that
 result. The nightly for web2py is more like a beta because Massimo hand
 picks code from trunk that will or will not be in the nightly which could
 really be a weekly.

 I am currently developing the application I am working on and testing is
 easy enough that I test trunk at least daily. The web2py server is quite
 easy to use but the code in some places is complicated and has many possible
 use cases. It is only through exposure out to the user base that a large
 number of use cases of the code get tested. I have even seen problems
 reported where something was fixed but used by maybe one person in a way
 that should not have worked resulting in the dreaded bug that worked and
 became a useful feature for someone.

 Once I go to production I will probably move the releases a lot slower
 through the installed base. In fact I have 2 beta production systems up now
 and only push a new web2py when I push a new version of the application to
 the stakeholders to look at.

 Massimo provides a fantastic service with the web2py project and I would not
 like to see him stifled by a load of process. Anyone that has time to test
 will definitely help the quality, if you don't have time, that is okay too.
 I personally don't mind doing some release management between where Massimo
 is burning the midnight oil and what I let out into the production systems I
 have/will manage. The product is alive with new features and bug fixes
 sometimes occur in minutes once reported. That is worth a lot.

 Ron





Re: [web2py] Re: The stability of web2py releases

2010-12-27 Thread Bruno Rocha
Is there a web2py clone in bitbucket (updated 16 months ago)

https://bitbucket.org/mdipierro/web2py/overview

https://bitbucket.org/mdipierro/web2py/overviewJust needs to update this
repository

2010/12/27 R. Strusberg strusb...@gmail.com

 +1

 2010/12/24 ron_m ron.mco...@gmail.com:
  I for one am happy with the current release cycle. It is a good balance
  between new features and the ultimate stability of release 1.XX.N  where
 N
  is the last version before XX+1 for example. The nightly build is a bit
 of a
  misnomer, many projects (C or C++ mostly) have some automated process
 that
  takes trunk and compiles it to produce a .tar.gz labelled nightly which
  might work. For web2py we should just hg pull; hg update to achieve
 that
  result. The nightly for web2py is more like a beta because Massimo hand
  picks code from trunk that will or will not be in the nightly which could
  really be a weekly.
 
  I am currently developing the application I am working on and testing is
  easy enough that I test trunk at least daily. The web2py server is quite
  easy to use but the code in some places is complicated and has many
 possible
  use cases. It is only through exposure out to the user base that a large
  number of use cases of the code get tested. I have even seen problems
  reported where something was fixed but used by maybe one person in a way
  that should not have worked resulting in the dreaded bug that worked and
  became a useful feature for someone.
 
  Once I go to production I will probably move the releases a lot slower
  through the installed base. In fact I have 2 beta production systems up
 now
  and only push a new web2py when I push a new version of the application
 to
  the stakeholders to look at.
 
  Massimo provides a fantastic service with the web2py project and I would
 not
  like to see him stifled by a load of process. Anyone that has time to
 test
  will definitely help the quality, if you don't have time, that is okay
 too.
  I personally don't mind doing some release management between where
 Massimo
  is burning the midnight oil and what I let out into the production
 systems I
  have/will manage. The product is alive with new features and bug fixes
  sometimes occur in minutes once reported. That is worth a lot.
 
  Ron
 
 
 




-- 

Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] Ajax pattern with Web2py

2010-12-27 Thread Markus Schmitz
Good afternoon everybody,

I am trying my hand at a web2py based application and as long as I
stay with the good old postback pattern, everything works brilliantly
and coding is very efficient. In this style I programmed in the new
application the account management, a database logging feature, a FAQ
section, a feedback section, some import and export functionality.

Also the core functionality (with BI like functionality) works ok in a
post back manner, but is reaching performance and usability limits. I
would like to ajaxify the application and could obviously do so with
a corresponding amount of javascript+jquery. But suddenly the
efficiency gains of web2py are evaporating. I am aware of the ajax and
load functions in web2py, but they somehow do not fit my needs. So I
get the feeling, I either do not understand the ajax concept of web2py
or I am designing my app wrongly.

Here is an example, what I would like to do (one of many examples):

- display some data retrieved in a structured table like manner (easy
to be done with web2py).
- By clicking on an entry a modal popup window shall open and display
the data to be edited
- After editing and pressing 'save' the modal window closes and the
original table updates.

All of this without a postback. The wiki plugin works with a modal
window (the widget builder), but the result is taken with copy and
paste to the wiki text instead of being inserted automatically. So it
does not help me much.

Another example would be:

- I have on a page a tree, a form to search/filter data and a chart.
- When a node in the tree is clicked, than the filter selection
changes and the chart needs to reload accordingly
- When a node in the chart is selected, then again the filter changes
and the tree needs to reload
- Naturally if the filter form changes, both tree and chart needs to
reload.

I implemented this with javascript events on the tree and chart and
old fashioned postback, but which ajax pattern would you suggest for
this? Naturally I would like to minimize the javascript hacking on the
page as much as possible.

I am not looking for concrete coding tips here, more for the general
patterns of how to do ajax with web2py with minimal effort.

Regards

Markus


[web2py] type 'exceptions.AttributeError'('str' object has no attribute 'update_record')

2010-12-27 Thread reyelts
I think I found another issue with upgrading from 1.81.4 to 1.91.4. My
code that updates table entries craps out with the subject exception.
I'm just doing the normal update_record as described in the book:

   elif form.accepts(request.vars,session,dbio=False):
 del form.vars['button']
 now = datetime.datetime.now()
 form.vars['PS_timestamp_updated'] = now
 if not PSDBrec:
form.vars['PS_id'] = auth.user.id
form.vars.id = db.PSDB.insert(**dict(form.vars))
session.flash = 'measurement create complete'
 else:
PSDBrec.update_record(**dict(form.vars))   
exception flagged here
session.flash = measurement edit complete
 db.commit()
 redirect(URL(r=request,c='default',f='index'))
  elif form.errors:
 response.flash = 'measurement form has errors'

The variables section of the error ticket is interesting. It shows
PSDBrec.update_record as undefined:

   Variables
   PSDBrec  '1'
   form.varsStorage {'PS_estimated_activity': 0.0,
'PS_skin...old_triceps': 0.0,'PS_circumference_hips': 0.0}
   builtindict  type 'dict'
   form gluon.sqlhtml.SQLFORM object at 0xaf8947ec
   PSDBrec.update_recordundefined


[web2py] Call for posting issues on Google Code

2010-12-27 Thread Bruno Rocha
Many issues have emerged here in the list, I think it
looks a little messy to manage these issues in this group.

I think it's very important to post the issue here and report it as
this can generate a good discussion between other users (and often was not
even a bug, and sometimes can be solved here)

But in parallel we need to post a Issue in Google Code Project Page. ( I
think it will help Massimo and other contributors to manage open issues)

Please, when a issue is really identified go to -
http://code.google.com/p/web2py/issues/list and post it.

I dont know if Google Code has an API for entering the issues (BitBucket
has), we can try to include a 'report issue' in admin and in tickets page.

(BitBucket has a better issue management page IMHO)

By now, posting issue in GoogleCode will help a lot (I think)

-- 

Bruno Rocha
http://about.me/rochacbruno/bio


Re: [web2py] Re: jquey effect problem

2010-12-27 Thread Martín Mulone
For me this code is working, the jquery is loaded?, your source code
point to /hello/static/js/jquery.js this exist?. Also try  to add ;
to the end of jquery sentence and change .two with #b.

2010/12/27 Sahil Arora sahilarora...@gmail.com:

 I have attached the source html...i amgetting no idea
 On Mon, Dec 27, 2010 at 7:53 PM, Luther Goh Lu Feng elf...@yahoo.com
 wrote:

 I suggest inspecting the source to see the hhtml for the blank line.

 On Dec 27, 9:10 pm, Sahil Arora sahilarora...@gmail.com wrote:
  see the attachment..
  first is before clicking on hello
  second is after clicking..
  only a blank line comes
 
  On Mon, Dec 27, 2010 at 6:32 PM, Sahil Arora
  sahilarora...@gmail.comwrote:
 
 
 
 
 
 
 
 
 
   i am doing this in default/index.html page in a application which
   extends
   layout.html which i think includes web2py_ajax.html . So is there any
   need
   to include any thing else.
 
   On Mon, Dec 27, 2010 at 6:29 PM, Luther Goh Lu Feng
   elf...@yahoo.comwrote:
 
   The syntax is correct. Is the jquery library included?
 
   You need to include something like
 
   script
   src=//ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js/
   script
 
   Also look at the javascript console for possible errors.
 
   On Dec 27, 8:21 pm, Sahil Arora sahilarora...@gmail.com wrote:
I tried this code to see the jquery effect.
 
div class=one id=a
   onclick=jQuery('.two').slideToggle()Hello/div
div class=two hidden id=bWorld/div
 
but onclicking on Hello slide Toggles but nothing appears( 'world'
   doesn't
appear).Just a blank line.
 
--
Sahil Arora
B.Tech 2nd year
Computer Science and Engineering
IIT Delhi
Contact No: +91 9871491046
   
Homepage-www.cse.iitd.ac.in/~cs1090213http://Homepage-www.cse.iitd.ac.in/%7Ecs1090213
 
   --
   Sahil Arora
   B.Tech 2nd year
   Computer Science and Engineering
   IIT Delhi
   Contact No: +91 9871491046
  
   Homepage-www.cse.iitd.ac.in/~cs1090213http://Homepage-www.cse.iitd.ac.in/%7Ecs1090213
 
  --
  Sahil Arora
  B.Tech 2nd year
  Computer Science and Engineering
  IIT Delhi
  Contact No: +91 9871491046
  Homepage-www.cse.iitd.ac.in/~cs1090213
 
   1.png
  203KViewDownload
 
   2.png
  208KViewDownload


 --
 Sahil Arora
 B.Tech 2nd year
 Computer Science and Engineering
 IIT Delhi
 Contact No: +91 9871491046
 Homepage-www.cse.iitd.ac.in/~cs1090213




-- 
My blog: http://martin.tecnodoc.com.ar
My portfolio *spanish*: http://www.tecnodoc.com.ar
Checkout my last proyect instant-press: http://www.instant2press.com


Re: [web2py] Re: 1.91.4 error reading version file

2010-12-27 Thread Jonathan Lundell
On Dec 27, 2010, at 7:39 AM, reyelts wrote:
 
 So is this a packaging error when building the source package for
 download from web2py.com?

I got VERSION just now when I downloaded it. 
http://www.web2py.com/examples/static/web2py_src.zip

Is 'version' repeatable for you? What OS and file system, and how are you 
unpacking it?

 
 On Dec 25, 5:22 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Dec 25, 2010, at 1:40 PM, reyelts wrote:
 
 
 
 Either the code should be looking for the name 'version' (since that's
 what is shipped) or the file should be renamed 'VERSION' (since that's
 what's hardcoded in the source). Shipping 'version' and coding
 'VERSION' is just asking for the problem we currently see.
 
 FWIW, it's 'VERSION' in the Mercurial source repository.




[web2py] Re: Getting Apache error on a web2py.com page

2010-12-27 Thread mdipierro
yes that is broken. I will eventually fix it

On Dec 27, 2:32 am, Kenneth Lundström kenneth.t.lundst...@gmail.com
wrote:
 I was looking for making a page into a popup and found this page in
 Google 
 groups:http://groups.google.com/group/web2py/browse_thread/thread/a753c07af1...

 There is a link to page:http://www.web2py.com/events/default/index

 which returns:

   OK

 The server encountered an internal error or misconfiguration and was
 unable to complete your request.

 Please contact the server administrator, [no address given] and inform
 them of the time the error occurred, and anything you might have done
 that may have caused the error.

 More information about this error may be available in the server error log.

 Kenneth


[web2py] Re: cron quest

2010-12-27 Thread mdipierro
how do you start web2py?

On Dec 27, 3:23 am, Manuele Pesenti manuele.pese...@gmail.com wrote:
 Hi *!
 I'm trying to set up a function in crontab, I'd like to run it daily or
 after run web2py so following the doc I write the crontab file as follows:

 #crontab
 @reboot  *  *  *  *  root *cronfun/fetch_all_data
 @daily   *  *  *  *  root *cronfun/fetch_all_data

 now running web2py it seams it has been ignored. There's something more
 to do? Do I have to choose the web2py application to run in some way or
 specify some extension running the web2py server?

 thank you very much

      Manuele


[web2py] Re: Left Join with aliased table and the new DAL

2010-12-27 Thread mdipierro
We'll fix this. Pleas open a ticket on google code. Thanks for
bringing this up.

Massimo

On Dec 27, 3:23 am, HaM yarib...@gmail.com wrote:
 First, Merry Christmas.

 Since I still experiencing problem on left join I have looked more
 deeply and try to find where is the difference between old and new
 DAL.
 I found that my problem only appears on a more complex request:

 Domain = dbPsnol.domain
 Client = dbPsnol.client
 Contact = dbPsnol.contact
 Manager = dbPsnol.contact.with_alias('manager')
 Datacenter = dbPsnol.datacenter
 PsnVersion = dbPsnol.psn_version
 Server = dbPsnol.server

 query = dbPsnol((Domain.id==request.args[0])
         (Client.id==Domain.client_id)
         (Datacenter.id==Domain.dc_id)
         (PsnVersion.id==Domain.psn_version_id))

 sql = query._select(Domain.name, Client.name,
 Manager.name, left=[
 Manager.on(Manager.id==Client.manager_id)])
 print sql

 With the old DAL:
 SELECT domain.name, client.name, manager.name FROM datacenter, domain,
 psn_version, client LEFT JOIN contact AS manager ON
 manager.id=client.manager_id WHERE (((domain.id=211 AND
 psn_version.id=domain.psn_version_id) AND datacenter.id=domain.dc_id)
 AND client.id=domain.client_id);

 With the new DAL:
 SELECT  domain.name, client.name, manager.name FROM datacenter,
 domain, client, psn_version LEFT JOIN contact AS manager ON
 (manager.id = client.manager_id) WHERE domain.id = 211) AND
 (psn_version.id = domain.psn_version_id)) AND (datacenter.id =
 domain.dc_id)) AND (client.id = domain.client_id));

 The difference is almost invisible, but tables client and psn_version
 have swap in the FROM part of the request. It seems that my problem
 come from there since the new DAL syntax isn't correct for PostgreSQL.

 For my second problem (INNER JOIN and alias) I will open a new ticket
 quickly. Many thanks for your work.

 On 24 déc, 02:57, mdipierro mdipie...@cs.depaul.edu wrote:

  I took a second look. The first problem is indeed fixed. The second
  problem is not a new dal issue. It is just that aliased tables in
  INNER JOINs never worked well. I will continue to look into it. This
  may take a while so could you open a ticket on google code? Thanks.

  On Dec 22, 2:52 am, HaM yarib...@gmail.com wrote:

   Ok in order to simplify the problem I have changed my code to this:
   Domain = db.domain
   Client = db.client
   Manager = db.contact.with_alias('manager')

   sql = db((Domain.id==1)(Client.id==Domain.client_id))._select(
                   Domain.name, Client.name, Manager.name,
                   left=[Manager.on(Manager.id==Client.manager_id)])
   print sql

   The result is:
   SELECT  domain.name, client.name, contact.name FROM domain, client,
   contact LEFT JOIN contact AS manager ON (contact.id =
   client.manager_id) WHERE ((domain.id = 1) AND (client.id =
   domain.client_id));

   And this request is not correct for PostgreSQL. I think that it should
   be :
   SELECT  domain.name, client.name, manager.name FROM domain, client
   LEFT JOIN contact as manager ON (manager.id = client.manager_id) WHERE
   ((domain.id = 1) AND (client.id = domain.client_id));

   Which works well.

   In order to push research further I also tried to do only INNER JOIN
   with an aliased table and it partially works:
   Domain = db.domain
   Client = db.client
   Manager = db.contact.with_alias('manager')
   sql = db((Domain.id==1)
           (Client.id==Domain.client_id)
           (Manager.id==Client.manager_id))._select(
           Domain.name, Client.name, Manager.name)
   print sql

   Result:
   SELECT  domain.name, client.name, contact.name FROM domain, client,
   contact WHERE (((domain.id = 1) AND (client.id = domain.client_id))
   AND (contact.id = client.manager_id));

   It works but it doesn't use the alias name for the table contact. Thus
   the resulting dict() doesn't contains the key manager but the key
   contact.

   Thank you for investigating this problem so quickly.

   On Dec 21, 10:57 pm, mdipierro mdipie...@cs.depaul.edu wrote:

hmm...

I am trying your select and it now generates the same sql as the old
dal. please try this:

Domain = db.domain
Client = db.client
Manager = db.contact.with_alias('manager')
sql = db(Domain.id==1)._select(
    Domain.ALL, Client.ALL,Manager.ALL,
    left=[Client.on(Client.id==Domain.client_id),
          Manager.on(Manager.id==Client.manager_id)])
print sql

what do you get?
I get

SELECT  domain.id, domain.name, domain.client_id, client.id,
client.name, client.manager_id, manager.id, manager.name FROM domain
LEFT JOIN client ON (client.id = domain.client_id) LEFT JOIN contact
AS manager ON (manager.id = client.manager_id) WHERE (domain.id = 1);

On Dec 21, 2:55 pm, HaM yarib...@gmail.com wrote:

 I just tried with the last revision (1414:da25156addab) and the
 problem stills the same.




[web2py] Re: Possible bug in SQLFORM.factory in version 1.91.4?

2010-12-27 Thread mdipierro
this has been fixed in trunk. I will post a new version soon.

On Dec 27, 7:03 am, Lisandro rostagnolisan...@gmail.com wrote:
 I've been working with web2py for a while. Lastnight I updated to last
 version, and my webforms collapsed (those constructed with
 SQLFORM.factory).

 More precisely, the problem appeared in the forms where I mix some
 existing fields of the database with other fields defined on the run,
 just like this example:
 --
 form = SQLFORM.factory(
   db.mytable.oneexistingfield,
   Field('nonexistingfield', 'string'),
   db.mytable.anotherexistingfield)
 --

 Anyway. After some minutes searching for the cause of the problem,
 I've decided to start from scratch with an example. I downloaded the
 version 1.91.4 (I'm using Ubuntu 10.04). I created a new application.

 The model (very simple, I took it from web2py examples):
 --
 db.define_table('person',
    Field('name'))
 db.define_table('dog',
    Field('name'),
    Field('owner', db.person))
 --

 Then, I wrote the index function on default.py controller:
 --
 def index():
    form = SQLFORM.factory(db.dog)
    dogs = db(db.dog.id0).select()
    return dict(form=form, dogs=dogs)
 --
 In the view I just added {{=form}} and {{=BEAUTIFY(dogs)}}, just to
 see the result of the function.

 When I try to run the function, I receive the following error:
 --
 Traceback (most recent call last):
  File /home/lisandro/pylicencias/gluon/restricted.py, line 188, in
 restricted
    exec ccode in environment
  File /home/lisandro/pylicencias/applications/prueba/controllers/
 default.py, line 20, in module
  File /home/lisandro/pylicencias/gluon/globals.py, line 95, in
 lambda
    self._caller = lambda f: f()
  File /home/lisandro/pylicencias/applications/prueba/controllers/
 default.py, line 14, in index
    form = SQLFORM.factory(db.dog)
  File /home/lisandro/pylicencias/gluon/sqlhtml.py, line 1182, in
 factory
    return SQLFORM(SQLDB(None).define_table(table_name, *fields),
  File /home/lisandro/pylicencias/gluon/dal.py, line 3314, in
 define_table
    t._create_references()
  File /home/lisandro/pylicencias/gluon/dal.py, line 3607, in
 _create_references
    rtable = self._db[rtablename]
  File /home/lisandro/pylicencias/gluon/dal.py, line 3335, in
 __getitem__
    return dict.__getitem__(self, str(key))
 KeyError: 'person'
 --

 The SAME code, but using SQLFORM(db.dog) instead of
 SQLFORM.factory(db.dog), works just fine.
 The SAME code, but with an older version of web2py, works just fine.
 What happened to SQLFORM.factory? Some bug? Or it's just me that I'm
 doing something wrong?

 Thanks in advance.


[web2py] Re: INNER JOIIN and aliased table

2010-12-27 Thread mdipierro
Did this work with the old dal?

On Dec 27, 9:41 am, HaM yarib...@gmail.com wrote:
 Hi,

 I'm trying to do INNER JOIN with aliased table and I'm experiencing
 problem.
 Here is my example:

 Domain = db.domain
 Client = db.client
 Manager = db.contact.with_alias('manager')
 sql = db((Domain.id==1)
         (Client.id==Domain.client_id)
         (Manager.id==Client.manager_id))._select(
         Domain.name, Client.name, Manager.name)
 print sql

 Result:
 SELECT  domain.name, client.name, contact.name FROM domain, client,
 contact WHERE (((domain.id = 1) AND (client.id = domain.client_id))
 AND (contact.id = client.manager_id));

 It works but it doesn't use the alias name for the table contact. Thus
 the resulting dict() doesn't contains the key manager but the key
 contact.

 Thanks again for your investigations.


[web2py] Re: The stability of web2py releases

2010-12-27 Thread mdipierro
Yarko created it and used to maintain it. That is is the problem with
having too many clones in different places. Venetually they get out of
sync.

Massimo

On Dec 27, 9:50 am, Bruno Rocha rochacbr...@gmail.com wrote:
 Is there a web2py clone in bitbucket (updated 16 months ago)

 https://bitbucket.org/mdipierro/web2py/overview

 https://bitbucket.org/mdipierro/web2py/overviewJust needs to update this
 repository

 2010/12/27 R. Strusberg strusb...@gmail.com



  +1

  2010/12/24 ron_m ron.mco...@gmail.com:
   I for one am happy with the current release cycle. It is a good balance
   between new features and the ultimate stability of release 1.XX.N  where
  N
   is the last version before XX+1 for example. The nightly build is a bit
  of a
   misnomer, many projects (C or C++ mostly) have some automated process
  that
   takes trunk and compiles it to produce a .tar.gz labelled nightly which
   might work. For web2py we should just hg pull; hg update to achieve
  that
   result. The nightly for web2py is more like a beta because Massimo hand
   picks code from trunk that will or will not be in the nightly which could
   really be a weekly.

   I am currently developing the application I am working on and testing is
   easy enough that I test trunk at least daily. The web2py server is quite
   easy to use but the code in some places is complicated and has many
  possible
   use cases. It is only through exposure out to the user base that a large
   number of use cases of the code get tested. I have even seen problems
   reported where something was fixed but used by maybe one person in a way
   that should not have worked resulting in the dreaded bug that worked and
   became a useful feature for someone.

   Once I go to production I will probably move the releases a lot slower
   through the installed base. In fact I have 2 beta production systems up
  now
   and only push a new web2py when I push a new version of the application
  to
   the stakeholders to look at.

   Massimo provides a fantastic service with the web2py project and I would
  not
   like to see him stifled by a load of process. Anyone that has time to
  test
   will definitely help the quality, if you don't have time, that is okay
  too.
   I personally don't mind doing some release management between where
  Massimo
   is burning the midnight oil and what I let out into the production
  systems I
   have/will manage. The product is alive with new features and bug fixes
   sometimes occur in minutes once reported. That is worth a lot.

   Ron

 --

 Bruno Rochahttp://about.me/rochacbruno/bio


[web2py] Re: type 'exceptions.AttributeError'('str' object has no attribute 'update_record')

2010-12-27 Thread mdipierro
What is definition of PSDBrec? What is the exact traceback?

On Dec 27, 10:04 am, reyelts reye...@gmail.com wrote:
 I think I found another issue with upgrading from 1.81.4 to 1.91.4. My
 code that updates table entries craps out with the subject exception.
 I'm just doing the normal update_record as described in the book:

        elif form.accepts(request.vars,session,dbio=False):
          del form.vars['button']
          now = datetime.datetime.now()
          form.vars['PS_timestamp_updated'] = now
          if not PSDBrec:
             form.vars['PS_id'] = auth.user.id
             form.vars.id = db.PSDB.insert(**dict(form.vars))
             session.flash = 'measurement create complete'
          else:
             PSDBrec.update_record(**dict(form.vars))   
 exception flagged here
             session.flash = measurement edit complete
          db.commit()
          redirect(URL(r=request,c='default',f='index'))
       elif form.errors:
          response.flash = 'measurement form has errors'

 The variables section of the error ticket is interesting. It shows
 PSDBrec.update_record as undefined:

    Variables
    PSDBrec      '1'
    form.vars    Storage {'PS_estimated_activity': 0.0,
 'PS_skin...old_triceps': 0.0,    'PS_circumference_hips': 0.0}
    builtindict  type 'dict'
    form gluon.sqlhtml.SQLFORM object at 0xaf8947ec
    PSDBrec.update_record        undefined


[web2py] Re: Call for posting issues on Google Code

2010-12-27 Thread mdipierro
+1

On Dec 27, 10:20 am, Bruno Rocha rochacbr...@gmail.com wrote:
 Many issues have emerged here in the list, I think it
 looks a little messy to manage these issues in this group.

 I think it's very important to post the issue here and report it as
 this can generate a good discussion between other users (and often was not
 even a bug, and sometimes can be solved here)

 But in parallel we need to post a Issue in Google Code Project Page. ( I
 think it will help Massimo and other contributors to manage open issues)

 Please, when a issue is really identified go to 
 -http://code.google.com/p/web2py/issues/listand post it.

 I dont know if Google Code has an API for entering the issues (BitBucket
 has), we can try to include a 'report issue' in admin and in tickets page.

 (BitBucket has a better issue management page IMHO)

 By now, posting issue in GoogleCode will help a lot (I think)

 --

 Bruno Rochahttp://about.me/rochacbruno/bio


[web2py] Re: Logging of impersonation events

2010-12-27 Thread alexandremasbr
Massimo,

I used impersonation in a app, and update to 1.91.4, and it don't work
anymore, using the described in the book.

How it works now?

Alexandre


On 8 dez, 05:16, mdipierro mdipie...@cs.depaul.edu wrote:
 I will add logging.

 Mind that it has pointed out that impersonate/0 presents a mild
 security risk. We have already changed the impersonate action in trunk
 and not you have to submit the user_id via POST to impersonate.

 I am still not 100% happy with this but since it is a security issue
 we are breaking backward compatibility for this action. The change for
 you will be minimal.

 Massimo

 On Dec 8, 1:12 am, Markus Schmitz mschm...@soft-impact.com wrote:



  Hi everybody,

  I am working on a new site, where we also plan to use the
  impersonation feature for support purposes, which is very helpful.
  The impersonation works perfectly, but it looks like there is no log
  in the auth_event table of this happening.

  Is this intended or did I look at the wrong place?

  Also as I can go back to the original user with impersonate/0, where
  does web2py store the original user? We could use this to store on
  each update and create not only the current user, but also the actual
  user (similar to the effective and actual user id in unix systems).

  Regards

  Markus


Re: [web2py] Call for posting issues on Google Code

2010-12-27 Thread Jonathan Lundell
On Dec 27, 2010, at 8:20 AM, Bruno Rocha wrote:
 Many issues have emerged here in the list, I think it looks a little messy to 
 manage these issues in this group.
 
 I think it's very important to post the issue here and report it as this can 
 generate a good discussion between other users (and often was not even a bug, 
 and sometimes can be solved here)
 
 But in parallel we need to post a Issue in Google Code Project Page. ( I 
 think it will help Massimo and other contributors to manage open issues)
  
 Please, when a issue is really identified go to - 
 http://code.google.com/p/web2py/issues/list and post it.
 
 I dont know if Google Code has an API for entering the issues (BitBucket 
 has), we can try to include a 'report issue' in admin and in tickets page.
 
 (BitBucket has a better issue management page IMHO)
 
 By now, posting issue in GoogleCode will help a lot (I think)

Posting issues is useful to the extent that the reports are complete. Joel 
Spolsky's list of good software practices 
http://www.joelonsoftware.com/articles/fog43.html includes 
bug-database item, which reads in part:

Bug databases can be complicated or simple. A minimal useful bug database must 
include the following data for every bug:

complete steps to reproduce the bug
expected behavior
observed (buggy) behavior
who it's assigned to
whether it has been fixed or not

That's a high standard, but I think it's necessary. More detail: 
http://www.joelonsoftware.com/articles/fog29.html



[web2py] About Workflow and Collapsible sections in forms

2010-12-27 Thread António Ramos
Hello, i have an app in Lotus Notes that i designed for my company.
It manages workflows and is a great improvement in my work. I want to create
something similar in web2py but lotus notes has collapsible sections in
forms that are very easily configured and very usefull when restriction
access to some fields in forms during a workflow.

I show you my humble work in 2 videos.

The point is , can collapsible section be an extra in we2py forms? I control
a collapsible section with just a formula that checks a value. if true the
fields are editable, else only readable.

The collapsible section is in the end of part 1
part 1
http://www.youtube.com/watch?v=zMNwqAtiFOw

part 2
http://www.youtube.com/watch?v=aGXa8503Ug8feature=related

Thank you for your time.

António


[web2py] Re: Logging of impersonation events

2010-12-27 Thread alexandremasbr
Massimo,

I find the answer, but there is a bug, anyway.

The id have to be send by POST, but generates a error caused by a typo
in tools.py

if requested_id == DEFAULT and not rquest.post_vars:
NameError: global name 'rquest' is not defined

Please correct it.

Alexandre



On 27 dez, 15:26, alexandremasbr alexandrema...@gmail.com wrote:
 Massimo,

 I used impersonation in a app, and update to 1.91.4, and it don't work
 anymore, using the described in the book.

 How it works now?

 Alexandre

 On 8 dez, 05:16, mdipierro mdipie...@cs.depaul.edu wrote:



  I will add logging.

  Mind that it has pointed out that impersonate/0 presents a mild
  security risk. We have already changed the impersonate action in trunk
  and not you have to submit the user_id via POST to impersonate.

  I am still not 100% happy with this but since it is a security issue
  we are breaking backward compatibility for this action. The change for
  you will be minimal.

  Massimo

  On Dec 8, 1:12 am, Markus Schmitz mschm...@soft-impact.com wrote:

   Hi everybody,

   I am working on a new site, where we also plan to use the
   impersonation feature for support purposes, which is very helpful.
   The impersonation works perfectly, but it looks like there is no log
   in the auth_event table of this happening.

   Is this intended or did I look at the wrong place?

   Also as I can go back to the original user with impersonate/0, where
   does web2py store the original user? We could use this to store on
   each update and create not only the current user, but also the actual
   user (similar to the effective and actual user id in unix systems).

   Regards

   Markus


Re: [web2py] Call for posting issues on Google Code

2010-12-27 Thread Bruno Rocha
Google Code has an API for Issue Tracker
http://code.google.com/p/support/wiki/IssueTrackerAPIPython

http://code.google.com/p/support/wiki/IssueTrackerAPIPythonI imagine a
form in /admin and tickets page where user fill some comment and include the
ticket file (maybe), I just sont know how to deal with the auth.

2010/12/27 Jonathan Lundell jlund...@pobox.com

 On Dec 27, 2010, at 8:20 AM, Bruno Rocha wrote:

 Many issues have emerged here in the list, I think it
 looks a little messy to manage these issues in this group.

 I think it's very important to post the issue here and report it as
 this can generate a good discussion between other users (and often was not
 even a bug, and sometimes can be solved here)

 But in parallel we need to post a Issue in Google Code Project Page. ( I
 think it will help Massimo and other contributors to manage open issues)

 Please, when a issue is really identified go to -
 http://code.google.com/p/web2py/issues/list and post it.

 I dont know if Google Code has an API for entering the issues (BitBucket
 has), we can try to include a 'report issue' in admin and in tickets page.

 (BitBucket has a better issue management page IMHO)

 By now, posting issue in GoogleCode will help a lot (I think)


 Posting issues is useful to the extent that the reports are complete. Joel
 Spolsky's list of good software practices 
 http://www.joelonsoftware.com/articles/fog43.html includes
 bug-database item, which reads in part:

 Bug databases can be complicated or simple. A minimal useful bug database
 must include the following data for every bug:

- complete steps to reproduce the bug
- expected behavior
- observed (buggy) behavior
- who it's assigned to
- whether it has been fixed or not


 That's a high standard, but I think it's necessary. More detail:
 http://www.joelonsoftware.com/articles/fog29.html




-- 

Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] Re: Logging of impersonation events

2010-12-27 Thread mdipierro
fixed in trunk.

On Dec 27, 11:43 am, alexandremasbr alexandrema...@gmail.com wrote:
 Massimo,

 I find the answer, but there is a bug, anyway.

 The id have to be send by POST, but generates a error caused by a typo
 in tools.py

     if requested_id == DEFAULT and not rquest.post_vars:
 NameError: global name 'rquest' is not defined

 Please correct it.

 Alexandre

 On 27 dez, 15:26, alexandremasbr alexandrema...@gmail.com wrote:

  Massimo,

  I used impersonation in a app, and update to 1.91.4, and it don't work
  anymore, using the described in the book.

  How it works now?

  Alexandre

  On 8 dez, 05:16, mdipierro mdipie...@cs.depaul.edu wrote:

   I will add logging.

   Mind that it has pointed out that impersonate/0 presents a mild
   security risk. We have already changed the impersonate action in trunk
   and not you have to submit the user_id via POST to impersonate.

   I am still not 100% happy with this but since it is a security issue
   we are breaking backward compatibility for this action. The change for
   you will be minimal.

   Massimo

   On Dec 8, 1:12 am, Markus Schmitz mschm...@soft-impact.com wrote:

Hi everybody,

I am working on a new site, where we also plan to use the
impersonation feature for support purposes, which is very helpful.
The impersonation works perfectly, but it looks like there is no log
in the auth_event table of this happening.

Is this intended or did I look at the wrong place?

Also as I can go back to the original user with impersonate/0, where
does web2py store the original user? We could use this to store on
each update and create not only the current user, but also the actual
user (similar to the effective and actual user id in unix systems).

Regards

Markus




[web2py] I am new to Web2Py............ hello every body!!

2010-12-27 Thread yosvel
So nice to write to you web2py-users

I am a experienced PHP web developer with frameworks like Symfony and
CodeIgniter..
Now, 3 days reading documentation and I am really impressed on how fun
is web development with Python and the Web2Py framework

but, I have some questions to ask you:
1. how can I drive my views in acording to the user's agent: browser
or mobils
2. how can I optimize + combine + minify + gzip (or any compression in
python) my files CSS, JS, and Images

thank you so much,
yosvel


[web2py] multiple SQLFORM.factory per page

2010-12-27 Thread Pawel Jasinski
hi,

when I try to put multiple forms generated with SQLFORM.factory things
act a bit odd.

#controller
def index():
form1  = SQLFORM.factory(Field('a'))
if form1.accepts(request.vars, session) :
print form1 accepted
form2 = SQLFORM.factory(Field('b'))
if form2.accepts(request.vars, session) :
print form2 accepted
return dict(form1=form1, form2=form2)

#view
{{extend 'layout.html'}}
{{=form1}}
{{=form2}}

first submit button will not produce any positive accept.
Second submit button will trigger accept for the first form (field a)
My understanding: each form has unique _formkey and should prevent
duplicate submits and crossovers like the one above. But when I look
at the code, I got impression that the critical filtering is based on
the _formname which in both cases is no_table_create
Is there anyway to fix it without making modification to the web2py
itself?

Cheers,
Pawel


[web2py] Question on with_alias using Postgres

2010-12-27 Thread betus
Hey:

I just started using web2py a few weeks ago and I love it..
Congratulations for the great work.
I have a question that might've been answered before, although I
searched and found no answer.. I'm having a problem setting an alias
to a field when performing a query.

For example:

db().select(db.auth_user.first_name.with_alias('name'));

When i execute that it throws:

ProgrammingError: syntax error at or near AS
LINE 1: SELECT  (auth_user.first_name AS name) FROM auth_user;

the correct query should be built without the ( ).. Is there any
way to make such a query?

thanks very much!
beto


[web2py] Re: Question on with_alias using Postgres

2010-12-27 Thread mdipierro
with_alias currently is only supported for left joins. In the case
below in particular, it is not functionally useful although I can see
the convenience.

On Dec 27, 10:32 am, betus bet...@gmail.com wrote:
 Hey:

 I just started using web2py a few weeks ago and I love it..
 Congratulations for the great work.
 I have a question that might've been answered before, although I
 searched and found no answer.. I'm having a problem setting an alias
 to a field when performing a query.

 For example:

 db().select(db.auth_user.first_name.with_alias('name'));

 When i execute that it throws:

 ProgrammingError: syntax error at or near AS
 LINE 1: SELECT  (auth_user.first_name AS name) FROM auth_user;

 the correct query should be built without the ( ).. Is there any
 way to make such a query?

 thanks very much!
 beto


[web2py] Re: multiple SQLFORM.factory per page

2010-12-27 Thread mdipierro
The accepts must have fomrnames (different onces)

form1.accepts(request.vars, session, formname='form1')

On Dec 27, 10:18 am, Pawel Jasinski pawel.jasin...@gmail.com wrote:
 hi,

 when I try to put multiple forms generated with SQLFORM.factory things
 act a bit odd.

 #controller
 def index():
     form1  = SQLFORM.factory(Field('a'))
     if form1.accepts(request.vars, session) :
         print form1 accepted
     form2 = SQLFORM.factory(Field('b'))
     if form2.accepts(request.vars, session) :
         print form2 accepted
     return dict(form1=form1, form2=form2)

 #view
 {{extend 'layout.html'}}
 {{=form1}}
 {{=form2}}

 first submit button will not produce any positive accept.
 Second submit button will trigger accept for the first form (field a)
 My understanding: each form has unique _formkey and should prevent
 duplicate submits and crossovers like the one above. But when I look
 at the code, I got impression that the critical filtering is based on
 the _formname which in both cases is no_table_create
 Is there anyway to fix it without making modification to the web2py
 itself?

 Cheers,
 Pawel


[web2py] Re: I am new to Web2Py............ hello every body!!

2010-12-27 Thread mdipierro
I think something like

#in controller or model

if request.env.http_user_agent=='...':
response.layout='layout1.html'
else:
response.layout='layout2.html'

and in views

{{extend response.layout}}

Mind that if you do this will not be able to bytecode apps.

On Dec 27, 11:50 am, yosvel yosvelquint...@gmail.com wrote:
 So nice to write to you web2py-users

 I am a experienced PHP web developer with frameworks like Symfony and
 CodeIgniter..
 Now, 3 days reading documentation and I am really impressed on how fun
 is web development with Python and the Web2Py framework

 but, I have some questions to ask you:
 1. how can I drive my views in acording to the user's agent: browser
 or mobils
 2. how can I optimize + combine + minify + gzip (or any compression in
 python) my files CSS, JS, and Images

 thank you so much,
 yosvel


Re: [web2py] I am new to Web2Py............ hello every body!!

2010-12-27 Thread Bruno Rocha
I found this on code compression:

http://code.activestate.com/recipes/496882-javascript-code-compression/

http://code.activestate.com/recipes/496882-javascript-code-compression/
http://pypi.python.org/pypi/WebDepCompress/0.2

http://pypi.python.org/pypi/WebDepCompress/0.2

2010/12/27 yosvel yosvelquint...@gmail.com

 So nice to write to you web2py-users

 I am a experienced PHP web developer with frameworks like Symfony and
 CodeIgniter..
 Now, 3 days reading documentation and I am really impressed on how fun
 is web development with Python and the Web2Py framework

 but, I have some questions to ask you:
 1. how can I drive my views in acording to the user's agent: browser
 or mobils
 2. how can I optimize + combine + minify + gzip (or any compression in
 python) my files CSS, JS, and Images

 thank you so much,
 yosvel




-- 

Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] validator.py and T()

2010-12-27 Thread Martin Weissenboeck
Hi,

I want to build a website using German. A lot of texts can be translated
using the T() object. But there are some problems:

(1) I have modified default/user.html:

   - a href={{=URL(r=request,args='register')}}{{=T('register')}}/a
   - a href={{=URL(r=request,args='request_reset_password')}}{{=T('lost
   password')}}/a

Works fine. Would be nice to have these lines as standard text.
 (2) There is a lot of English strings in gluon/validators.py, starting
with

   - error_message (e.g. def __init__(self, expression,
   error_message='invalid expression'):),
   - failures.append and
   - format

I was very surprised that I could not find any T() object in the code. Now I
tried to use the T() object for all of these lines, but T() is not known. That
is realy not good - a lot of users would not accept a website with mixed
German and English words. What can I do?

Which kind regards
Martin


Re: [web2py] validator.py and T()

2010-12-27 Thread Bruno Rocha
That is because T() is not in context when validators are defined. you have
to pass error_message to your validators.

db.table.field.requires=IS_NOT_EMPTY(error_message=T('this field cannot be
empty'))

That is the way I am doing woth my Portuguese systems and sites.

2010/12/27 Martin Weissenboeck mweis...@gmail.com

 Hi,

 I want to build a website using German. A lot of texts can be translated
 using the T() object. But there are some problems:

 (1) I have modified default/user.html:

- a href={{=URL(r=request,args='register')}}{{=T('register')}}/a
- a
href={{=URL(r=request,args='request_reset_password')}}{{=T('lost
password')}}/a

 Works fine. Would be nice to have these lines as standard text.
  (2) There is a lot of English strings in gluon/validators.py, starting
 with

- error_message (e.g. def __init__(self, expression,
error_message='invalid expression'):),
- failures.append and
- format

 I was very surprised that I could not find any T() object in the code. Now
 I tried to use the T() object for all of these lines, but T() is not known. 
 That
 is realy not good - a lot of users would not accept a website with mixed
 German and English words. What can I do?

 Which kind regards
 Martin




-- 

Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] Re: Logging of impersonation events

2010-12-27 Thread alexandremasbr
Not working yet. It not recognize the request.post_vars

Please, give me a working example.

Alexandre

On 27 dez, 15:53, mdipierro mdipie...@cs.depaul.edu wrote:
 fixed in trunk.

 On Dec 27, 11:43 am, alexandremasbr alexandrema...@gmail.com wrote:



  Massimo,

  I find the answer, but there is a bug, anyway.

  The id have to be send by POST, but generates a error caused by a typo
  in tools.py

      if requested_id == DEFAULT and not rquest.post_vars:
  NameError: global name 'rquest' is not defined

  Please correct it.

  Alexandre

  On 27 dez, 15:26, alexandremasbr alexandrema...@gmail.com wrote:

   Massimo,

   I used impersonation in a app, and update to 1.91.4, and it don't work
   anymore, using the described in the book.

   How it works now?

   Alexandre

   On 8 dez, 05:16, mdipierro mdipie...@cs.depaul.edu wrote:

I will add logging.

Mind that it has pointed out that impersonate/0 presents a mild
security risk. We have already changed the impersonate action in trunk
and not you have to submit the user_id via POST to impersonate.

I am still not 100% happy with this but since it is a security issue
we are breaking backward compatibility for this action. The change for
you will be minimal.

Massimo

On Dec 8, 1:12 am, Markus Schmitz mschm...@soft-impact.com wrote:

 Hi everybody,

 I am working on a new site, where we also plan to use the
 impersonation feature for support purposes, which is very helpful.
 The impersonation works perfectly, but it looks like there is no log
 in the auth_event table of this happening.

 Is this intended or did I look at the wrong place?

 Also as I can go back to the original user with impersonate/0, where
 does web2py store the original user? We could use this to store on
 each update and create not only the current user, but also the actual
 user (similar to the effective and actual user id in unix systems).

 Regards

 Markus


[web2py] Re: Logging of impersonation events

2010-12-27 Thread alexandremasbr

Not working yet. It not recognize the request.post_vars
Please, give me a working example.

I used the form below
form action=/app/default/user/impersonate enctype=multipart/form-
data method=postSimulate User:input type=submit /div
class=hiddeninput name=user_id type=hidden value=217 //
div/form

Alexandre

On 27 dez, 16:46, alexandremasbr alexandrema...@gmail.com wrote:
 Not working yet. It not recognize the request.post_vars

 Please, give me a working example.

 Alexandre

 On 27 dez, 15:53, mdipierro mdipie...@cs.depaul.edu wrote:



  fixed in trunk.

  On Dec 27, 11:43 am, alexandremasbr alexandrema...@gmail.com wrote:

   Massimo,

   I find the answer, but there is a bug, anyway.

   The id have to be send by POST, but generates a error caused by a typo
   in tools.py

       if requested_id == DEFAULT and not rquest.post_vars:
   NameError: global name 'rquest' is not defined

   Please correct it.

   Alexandre

   On 27 dez, 15:26, alexandremasbr alexandrema...@gmail.com wrote:

Massimo,

I used impersonation in a app, and update to 1.91.4, and it don't work
anymore, using the described in the book.

How it works now?

Alexandre

On 8 dez, 05:16, mdipierro mdipie...@cs.depaul.edu wrote:

 I will add logging.

 Mind that it has pointed out that impersonate/0 presents a mild
 security risk. We have already changed the impersonate action in trunk
 and not you have to submit the user_id via POST to impersonate.

 I am still not 100% happy with this but since it is a security issue
 we are breaking backward compatibility for this action. The change for
 you will be minimal.

 Massimo

 On Dec 8, 1:12 am, Markus Schmitz mschm...@soft-impact.com wrote:

  Hi everybody,

  I am working on a new site, where we also plan to use the
  impersonation feature for support purposes, which is very helpful.
  The impersonation works perfectly, but it looks like there is no log
  in the auth_event table of this happening.

  Is this intended or did I look at the wrong place?

  Also as I can go back to the original user with impersonate/0, where
  does web2py store the original user? We could use this to store on
  each update and create not only the current user, but also the 
  actual
  user (similar to the effective and actual user id in unix systems).

  Regards

  Markus


[web2py] Re: executing code from db

2010-12-27 Thread mattynoce
bump. any thoughts on running code stored in the db through the web2py
interpreter?

On Dec 23, 3:17 pm, mattynoce mattyn...@gmail.com wrote:
 hi all. i know this doesn't sound like a superb idea, but i may have
 to do something like it.

 i have data coming from the db and being displayed to the user as
 instructions. do this, go there, etc.

 i'd like to have that data executed in the environment, so i could say
 do this, {{=user.first_name}}. but when i say
 {{=XML(instruction.step)}} it spits out the raw text but doesn't
 execute it.

 this only happens for db info that we put in, no user data. is there a
 way to run it through the web2py interpreter before displaying it to
 the user?

 thanks, and happy holidays.

 matt


[web2py] Re: Left Join with aliased table and the new DAL

2010-12-27 Thread mdipierro
This should now be fixed in trunk. Please confirm.

On Dec 27, 3:23 am, HaM yarib...@gmail.com wrote:
 First, Merry Christmas.

 Since I still experiencing problem on left join I have looked more
 deeply and try to find where is the difference between old and new
 DAL.
 I found that my problem only appears on a more complex request:

 Domain = dbPsnol.domain
 Client = dbPsnol.client
 Contact = dbPsnol.contact
 Manager = dbPsnol.contact.with_alias('manager')
 Datacenter = dbPsnol.datacenter
 PsnVersion = dbPsnol.psn_version
 Server = dbPsnol.server

 query = dbPsnol((Domain.id==request.args[0])
         (Client.id==Domain.client_id)
         (Datacenter.id==Domain.dc_id)
         (PsnVersion.id==Domain.psn_version_id))

 sql = query._select(Domain.name, Client.name,
 Manager.name, left=[
 Manager.on(Manager.id==Client.manager_id)])
 print sql

 With the old DAL:
 SELECT domain.name, client.name, manager.name FROM datacenter, domain,
 psn_version, client LEFT JOIN contact AS manager ON
 manager.id=client.manager_id WHERE (((domain.id=211 AND
 psn_version.id=domain.psn_version_id) AND datacenter.id=domain.dc_id)
 AND client.id=domain.client_id);

 With the new DAL:
 SELECT  domain.name, client.name, manager.name FROM datacenter,
 domain, client, psn_version LEFT JOIN contact AS manager ON
 (manager.id = client.manager_id) WHERE domain.id = 211) AND
 (psn_version.id = domain.psn_version_id)) AND (datacenter.id =
 domain.dc_id)) AND (client.id = domain.client_id));

 The difference is almost invisible, but tables client and psn_version
 have swap in the FROM part of the request. It seems that my problem
 come from there since the new DAL syntax isn't correct for PostgreSQL.

 For my second problem (INNER JOIN and alias) I will open a new ticket
 quickly. Many thanks for your work.

 On 24 déc, 02:57, mdipierro mdipie...@cs.depaul.edu wrote:

  I took a second look. The first problem is indeed fixed. The second
  problem is not a new dal issue. It is just that aliased tables in
  INNER JOINs never worked well. I will continue to look into it. This
  may take a while so could you open a ticket on google code? Thanks.

  On Dec 22, 2:52 am, HaM yarib...@gmail.com wrote:

   Ok in order to simplify the problem I have changed my code to this:
   Domain = db.domain
   Client = db.client
   Manager = db.contact.with_alias('manager')

   sql = db((Domain.id==1)(Client.id==Domain.client_id))._select(
                   Domain.name, Client.name, Manager.name,
                   left=[Manager.on(Manager.id==Client.manager_id)])
   print sql

   The result is:
   SELECT  domain.name, client.name, contact.name FROM domain, client,
   contact LEFT JOIN contact AS manager ON (contact.id =
   client.manager_id) WHERE ((domain.id = 1) AND (client.id =
   domain.client_id));

   And this request is not correct for PostgreSQL. I think that it should
   be :
   SELECT  domain.name, client.name, manager.name FROM domain, client
   LEFT JOIN contact as manager ON (manager.id = client.manager_id) WHERE
   ((domain.id = 1) AND (client.id = domain.client_id));

   Which works well.

   In order to push research further I also tried to do only INNER JOIN
   with an aliased table and it partially works:
   Domain = db.domain
   Client = db.client
   Manager = db.contact.with_alias('manager')
   sql = db((Domain.id==1)
           (Client.id==Domain.client_id)
           (Manager.id==Client.manager_id))._select(
           Domain.name, Client.name, Manager.name)
   print sql

   Result:
   SELECT  domain.name, client.name, contact.name FROM domain, client,
   contact WHERE (((domain.id = 1) AND (client.id = domain.client_id))
   AND (contact.id = client.manager_id));

   It works but it doesn't use the alias name for the table contact. Thus
   the resulting dict() doesn't contains the key manager but the key
   contact.

   Thank you for investigating this problem so quickly.

   On Dec 21, 10:57 pm, mdipierro mdipie...@cs.depaul.edu wrote:

hmm...

I am trying your select and it now generates the same sql as the old
dal. please try this:

Domain = db.domain
Client = db.client
Manager = db.contact.with_alias('manager')
sql = db(Domain.id==1)._select(
    Domain.ALL, Client.ALL,Manager.ALL,
    left=[Client.on(Client.id==Domain.client_id),
          Manager.on(Manager.id==Client.manager_id)])
print sql

what do you get?
I get

SELECT  domain.id, domain.name, domain.client_id, client.id,
client.name, client.manager_id, manager.id, manager.name FROM domain
LEFT JOIN client ON (client.id = domain.client_id) LEFT JOIN contact
AS manager ON (manager.id = client.manager_id) WHERE (domain.id = 1);

On Dec 21, 2:55 pm, HaM yarib...@gmail.com wrote:

 I just tried with the last revision (1414:da25156addab) and the
 problem stills the same.




[web2py] what's the use of form.custom.*

2010-12-27 Thread Arun K.Rajeevan
I have these tables,

db.define_table('languages',
Field('full', 'string', length=30, notnull=True, 
required=True),
Field('short', 'string', length=10 , notnull=True, 
required=True),
format='%(full)s - %(short)s')

db.define_table('words',
Field('word', 'string', length=128, notnull=True, 
required=True),
Field('lang', db.languages, notnull=True))

index is like this

def index(): 
form = SQLFORM.factory(db.words)
return dict(form=form)

and in view:
(My aim is to replace select box with my own select box which removes one 
option from select box)
(But use case is really, replacing default select box with a select box that 
have OPTGROUPS )

defaultlang = db(db.languages.full =='All Languages').select().first()
lst = db(db.languages.id0).select().sort(lambda a: a.full).exclude(lambda 
a: a.id != defaultlang.id)
options = [OPTION(row['full'] + '  - ' + row['short'], _value=row['id']) for 
row in lst]

Now I tried following, individually of course:
form.custom.inpval['lang']= SELECT(*options)
form.custom.dspval['lang']= SELECT(*options)
form.custom.widget['lang']= SELECT(*options)

If I display form {{=form}} select box is still old one.
If I try {{form.custom}} then corresponding (ie., inpval.lang, dspval.lang, 
widget.lang) displays new select box.
But {{=form}} still displays old select box.

So what's the use of custom.inpval, dspval and widget?

And, How to solve this particular problem? (ie., customizing an element 
(here change an select box with a select box which have optgroups))


[web2py] Re: Logging of impersonation events

2010-12-27 Thread mdipierro
Did you

auth.add_permission(user_group_id,'impresonate','auth_user',217)

?

On Dec 27, 12:51 pm, alexandremasbr alexandrema...@gmail.com wrote:
 Not working yet. It not recognize the request.post_vars
 Please, give me a working example.

 I used the form below
 form action=/app/default/user/impersonate enctype=multipart/form-
 data method=postSimulate User:input type=submit /div
 class=hiddeninput name=user_id type=hidden value=217 //
 div/form

 Alexandre

 On 27 dez, 16:46, alexandremasbr alexandrema...@gmail.com wrote:

  Not working yet. It not recognize the request.post_vars

  Please, give me a working example.

  Alexandre

  On 27 dez, 15:53, mdipierro mdipie...@cs.depaul.edu wrote:

   fixed in trunk.

   On Dec 27, 11:43 am, alexandremasbr alexandrema...@gmail.com wrote:

Massimo,

I find the answer, but there is a bug, anyway.

The id have to be send by POST, but generates a error caused by a typo
in tools.py

    if requested_id == DEFAULT and not rquest.post_vars:
NameError: global name 'rquest' is not defined

Please correct it.

Alexandre

On 27 dez, 15:26, alexandremasbr alexandrema...@gmail.com wrote:

 Massimo,

 I used impersonation in a app, and update to 1.91.4, and it don't work
 anymore, using the described in the book.

 How it works now?

 Alexandre

 On 8 dez, 05:16, mdipierro mdipie...@cs.depaul.edu wrote:

  I will add logging.

  Mind that it has pointed out that impersonate/0 presents a mild
  security risk. We have already changed the impersonate action in 
  trunk
  and not you have to submit the user_id via POST to impersonate.

  I am still not 100% happy with this but since it is a security issue
  we are breaking backward compatibility for this action. The change 
  for
  you will be minimal.

  Massimo

  On Dec 8, 1:12 am, Markus Schmitz mschm...@soft-impact.com wrote:

   Hi everybody,

   I am working on a new site, where we also plan to use the
   impersonation feature for support purposes, which is very helpful.
   The impersonation works perfectly, but it looks like there is no 
   log
   in the auth_event table of this happening.

   Is this intended or did I look at the wrong place?

   Also as I can go back to the original user with impersonate/0, 
   where
   does web2py store the original user? We could use this to store on
   each update and create not only the current user, but also the 
   actual
   user (similar to the effective and actual user id in unix 
   systems).

   Regards

   Markus




[web2py] Re: executing code from db

2010-12-27 Thread mdipierro
cube2py does that.

http://code.google.com/p/cube2py/source/browse/models/plugin_wiki.py?r=1a9307c63a03ff17d70ea57e946cabf3dae4cc57#497

On Dec 27, 12:56 pm, mattynoce mattyn...@gmail.com wrote:
 bump. any thoughts on running code stored in the db through the web2py
 interpreter?

 On Dec 23, 3:17 pm, mattynoce mattyn...@gmail.com wrote:

  hi all. i know this doesn't sound like a superb idea, but i may have
  to do something like it.

  i have data coming from the db and being displayed to the user as
  instructions. do this, go there, etc.

  i'd like to have that data executed in the environment, so i could say
  do this, {{=user.first_name}}. but when i say
  {{=XML(instruction.step)}} it spits out the raw text but doesn't
  execute it.

  this only happens for db info that we put in, no user data. is there a
  way to run it through the web2py interpreter before displaying it to
  the user?

  thanks, and happy holidays.

  matt




[web2py] Re: what's the use of form.custom.*

2010-12-27 Thread mdipierro
Those are not setters. They are getters.

You use them as in {{=form.custom.inpval['fieldname']}} in custom html
forms, not to override settings.

massimo

On Dec 27, 1:13 pm, Arun K.Rajeevan the1.a...@gmail.com wrote:
 I have these tables,

 db.define_table('languages',
                 Field('full', 'string', length=30, notnull=True,
 required=True),
                 Field('short', 'string', length=10 , notnull=True,
 required=True),
                 format='%(full)s - %(short)s')

 db.define_table('words',
                 Field('word', 'string', length=128, notnull=True,
 required=True),
                 Field('lang', db.languages, notnull=True))

 index is like this

 def index():
     form = SQLFORM.factory(db.words)    
     return dict(form=form)

 and in view:
 (My aim is to replace select box with my own select box which removes one
 option from select box)
 (But use case is really, replacing default select box with a select box that
 have OPTGROUPS )

 defaultlang = db(db.languages.full =='All Languages').select().first()
 lst = db(db.languages.id0).select().sort(lambda a: a.full).exclude(lambda
 a: a.id != defaultlang.id)
 options = [OPTION(row['full'] + '  - ' + row['short'], _value=row['id']) for
 row in lst]

 Now I tried following, individually of course:
 form.custom.inpval['lang']= SELECT(*options)
 form.custom.dspval['lang']= SELECT(*options)
 form.custom.widget['lang']= SELECT(*options)

 If I display form {{=form}} select box is still old one.
 If I try {{form.custom}} then corresponding (ie., inpval.lang, dspval.lang,
 widget.lang) displays new select box.
 But {{=form}} still displays old select box.

 So what's the use of custom.inpval, dspval and widget?

 And, How to solve this particular problem? (ie., customizing an element
 (here change an select box with a select box which have optgroups))


[web2py] Re: gql broken in latest version (1.91.4) ?

2010-12-27 Thread jinlin
I added the issue and attached the patch file that is working for me.

http://code.google.com/p/web2py/issues/detail?id=139sort=-id

When testing I noticed if there are two applications using the same
table name, it will create the same table in gae, without namespace on
the table name.

It won't affect me, but I can try fixing it if you tell me where to
look.


On Dec 26, 9:53 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Can you please post a googlecode report and I will fix this asap?
 Thanks

 On Dec 26, 11:08 pm, jinlin wilkin...@gmail.com wrote:

  Thanks for the quick fix, I am pretty new with web2py, but had done
  some python programming on gae before.

  The changes for gql.py has a syntax error.

  from dal
  should be changed to
  from gluon.dal

  There is another problem with GAENoSqlAdapter class. It doesn't handle
  a query like
  db().select(db.category.ALL)

  The method GAENoSqlAdapter.select_raw  assume query is not empty, so
  it will error in self.get_table(query) when it can not get the table.

      def select_raw(self,query,fields=[],attributes={}):
          tablename = self.get_table(query)
          tableobj = self.db[tablename]._tableobj

  Comparing with the old qgl it has code to check like so
          if fields and isinstance(fields[0], SQLALL):
              self._tables.insert(0, fields[0].table._tablename)

  To reproduce the error, it is from the Reddish appliance. I changed
  the db() creation in db.py like you suggested.

  Here is the stack trace
      if len(db().select(db.category.ALL))==0:
    File /Documents/project/appengine/web2py/web2py/gluon/dal.py, line
  4480, in select
      return self.db._adapter.select(self.query,fields,attributes)
    File /Documents/project/appengine/web2py/web2py/gluon/dal.py, line
  2654, in select
      (items, tablename, fields) =
  self.select_raw(query,fields,attributes)
    File /Documents/project/appengine/web2py/web2py/gluon/dal.py, line
  2611, in select_raw
      tablename = self.get_table(query)
    File /Documents/project/appengine/web2py/web2py/gluon/dal.py, line
  894, in get_table
      raise RuntimeError, No table selected
  RuntimeError: No table selected




[web2py] Re: type 'exceptions.AttributeError'('str' object has no attribute 'update_record')

2010-12-27 Thread reyelts
Here's the complete traceback:

Traceback (most recent call last):
  File /media/EZTRAIN/web2py_lin/gluon/restricted.py, line 188, in
restricted
exec ccode in environment
  File /media/EZTRAIN/web2py_lin/applications/canyonezt/controllers/
client.py, line 245, in module
  File /media/EZTRAIN/web2py_lin/gluon/globals.py, line 95, in
lambda
self._caller = lambda f: f()
  File /media/EZTRAIN/web2py_lin/applications/canyonezt/controllers/
client.py, line 234, in measure
PSDBrec.update_record(**dict(form.vars))
AttributeError: 'str' object has no attribute 'update_record'

I figured out how to get around the problem. PSDBrec is a record id
passed in as a result of selecting from a list. Going into the above
code snippet, I simply had:

   PSDBrec = request.args[1]

To get around the problem introduced by the upgrade, I replaced it
with this:

   PSDBrec = db.PSDB(db.PSDB.id==request.args[1])

The bigger problem is that the original implementation *worked* with
1.81.4. Every time we do an upgrade of the web2py structure, it seems
we go through a couple days of hunting down and fixing this kind of
stuff. It's getting very, very old. From the introduction to the book,
we have this statement:

   Another feature of web2py is that we, its developers, commit to
maintain backward
   compatibility in future versions. We have done so since the first
release of web2py
   in October, 2007. New features have been added and bugs have been
fixed, but if a
   program worked with web2py 1.0, that program will still work today.

In the year or so I've been using web2py, I have yet to find a
*single* case where this statement holds true. Granted, I don't pull
every release... mostly only when I know I have a little free time to
do some debugging to find things like this issue and the version file
problem reported earlier.

It is getting to be enough of a problem for me to consider reworking
my code to use different framework. While web2py has it's advantages,
the lack of any true upward compatibility is frustrating beyond
explanation.


[web2py] Re: what's the use of form.custom.*

2010-12-27 Thread Arun K.Rajeevan
I see, 
so if there any similar setters?


[web2py] Re: 1.91.4 error reading version file

2010-12-27 Thread reyelts
I do wget --no-clobber --directory-prefix=blah
http://www.web2py.com/examples/static/web2py_src.zip; followed by
unzip -o -q... to unravel the file. For both web2py_src.zip and
web2py_win.zip, I got version. In both cases, other file names with
uppercase characters were extracted normally (like Makefile in the
src package and NEWINSTALL in the win package). So, files were not
indiscriminately renamed to lower case. I have not tried to repeat
sine the original occurrence... will try that later when I have a
faster connection for the download.

On Dec 27, 9:52 am, Jonathan Lundell jlund...@pobox.com wrote:
 On Dec 27, 2010, at 7:39 AM, reyelts wrote:



  So is this a packaging error when building the source package for
  download from web2py.com?

 I got VERSION just now when I downloaded it. 
 http://www.web2py.com/examples/static/web2py_src.zip

 Is 'version' repeatable for you? What OS and file system, and how are you 
 unpacking it?









  On Dec 25, 5:22 pm, Jonathan Lundell jlund...@pobox.com wrote:
  On Dec 25, 2010, at 1:40 PM, reyelts wrote:

  Either the code should be looking for the name 'version' (since that's
  what is shipped) or the file should be renamed 'VERSION' (since that's
  what's hardcoded in the source). Shipping 'version' and coding
  'VERSION' is just asking for the problem we currently see.

  FWIW, it's 'VERSION' in the Mercurial source repository.


[web2py] Re: executing code from db

2010-12-27 Thread mart
Hi Massimo,

Is cube2py still something you support? Asking because I haven't read
many threads about it lately... And, is the plugin_wiki part of
cube2py up to date (or the same?) with the plugin available for
download on web2py.com?  Meaning, I would love to take that route, is
everything compatible from plugin_wiki to cube2py?

Thanks,
Mart :)

On Dec 27, 2:16 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 cube2py does that.

 http://code.google.com/p/cube2py/source/browse/models/plugin_wiki.py?...

 On Dec 27, 12:56 pm, mattynoce mattyn...@gmail.com wrote:







  bump. any thoughts on running code stored in the db through the web2py
  interpreter?

  On Dec 23, 3:17 pm, mattynoce mattyn...@gmail.com wrote:

   hi all. i know this doesn't sound like a superb idea, but i may have
   to do something like it.

   i have data coming from the db and being displayed to the user as
   instructions. do this, go there, etc.

   i'd like to have that data executed in the environment, so i could say
   do this, {{=user.first_name}}. but when i say
   {{=XML(instruction.step)}} it spits out the raw text but doesn't
   execute it.

   this only happens for db info that we put in, no user data. is there a
   way to run it through the web2py interpreter before displaying it to
   the user?

   thanks, and happy holidays.

   matt


[web2py] Re: type 'exceptions.AttributeError'('str' object has no attribute 'update_record')

2010-12-27 Thread mdipierro
This:


   PSDBrec = request.args[1]
   PSDBrec.update_record(**dict(form.vars))

could never have worked. The ticket is right. PSDrec is a string.
This is the correct thing to do:

   PSDBrec = db.PSDB(request.args(1)) or redirect(URL('error_page'))
   PSDBrec.update_record(**dict(form.vars))

or faster (1 db IO vs 2 db IO)

   db(db.PSDB.id==request.args(1)).update(**dict(form.vars))

On Dec 27, 1:34 pm, reyelts reye...@gmail.com wrote:
 Here's the complete traceback:

 Traceback (most recent call last):
   File /media/EZTRAIN/web2py_lin/gluon/restricted.py, line 188, in
 restricted
     exec ccode in environment
   File /media/EZTRAIN/web2py_lin/applications/canyonezt/controllers/
 client.py, line 245, in module
   File /media/EZTRAIN/web2py_lin/gluon/globals.py, line 95, in
 lambda
     self._caller = lambda f: f()
   File /media/EZTRAIN/web2py_lin/applications/canyonezt/controllers/
 client.py, line 234, in measure
     PSDBrec.update_record(**dict(form.vars))
 AttributeError: 'str' object has no attribute 'update_record'

 I figured out how to get around the problem. PSDBrec is a record id
 passed in as a result of selecting from a list. Going into the above
 code snippet, I simply had:

    PSDBrec = request.args[1]

 To get around the problem introduced by the upgrade, I replaced it
 with this:

    PSDBrec = db.PSDB(db.PSDB.id==request.args[1])

 The bigger problem is that the original implementation *worked* with
 1.81.4. Every time we do an upgrade of the web2py structure, it seems
 we go through a couple days of hunting down and fixing this kind of
 stuff. It's getting very, very old. From the introduction to the book,
 we have this statement:

    Another feature of web2py is that we, its developers, commit to
 maintain backward
    compatibility in future versions. We have done so since the first
 release of web2py
    in October, 2007. New features have been added and bugs have been
 fixed, but if a
    program worked with web2py 1.0, that program will still work today.

 In the year or so I've been using web2py, I have yet to find a
 *single* case where this statement holds true. Granted, I don't pull
 every release... mostly only when I know I have a little free time to
 do some debugging to find things like this issue and the version file
 problem reported earlier.

 It is getting to be enough of a problem for me to consider reworking
 my code to use different framework. While web2py has it's advantages,
 the lack of any true upward compatibility is frustrating beyond
 explanation.


[web2py] Re: what's the use of form.custom.*

2010-12-27 Thread mdipierro
Those values are derived from

db.table.field.label
db.table.field.default
db.table.field.widget

Which you can change.

On Dec 27, 1:39 pm, Arun K.Rajeevan the1.a...@gmail.com wrote:
 I see,
 so if there any similar setters?


[web2py] Re: executing code from db

2010-12-27 Thread mdipierro
cube2py is just a scaffolding app + plugin_wiki. The code is in
question is also in plugin_wiki although people do not seem to use it
(and I am not sure it is in general a good idea to store code in db).

On Dec 27, 2:18 pm, mart msenecal...@gmail.com wrote:
 Hi Massimo,

 Is cube2py still something you support? Asking because I haven't read
 many threads about it lately... And, is the plugin_wiki part of
 cube2py up to date (or the same?) with the plugin available for
 download on web2py.com?  Meaning, I would love to take that route, is
 everything compatible from plugin_wiki to cube2py?

 Thanks,
 Mart :)

 On Dec 27, 2:16 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  cube2py does that.

 http://code.google.com/p/cube2py/source/browse/models/plugin_wiki.py?...

  On Dec 27, 12:56 pm, mattynoce mattyn...@gmail.com wrote:

   bump. any thoughts on running code stored in the db through the web2py
   interpreter?

   On Dec 23, 3:17 pm, mattynoce mattyn...@gmail.com wrote:

hi all. i know this doesn't sound like a superb idea, but i may have
to do something like it.

i have data coming from the db and being displayed to the user as
instructions. do this, go there, etc.

i'd like to have that data executed in the environment, so i could say
do this, {{=user.first_name}}. but when i say
{{=XML(instruction.step)}} it spits out the raw text but doesn't
execute it.

this only happens for db info that we put in, no user data. is there a
way to run it through the web2py interpreter before displaying it to
the user?

thanks, and happy holidays.

matt




Re: [web2py] Re: 1.91.4 error reading version file

2010-12-27 Thread Jonathan Lundell
On Dec 27, 2010, at 12:13 PM, reyelts wrote:
 
 I do wget --no-clobber --directory-prefix=blah
 http://www.web2py.com/examples/static/web2py_src.zip; followed by
 unzip -o -q... to unravel the file. For both web2py_src.zip and
 web2py_win.zip, I got version. In both cases, other file names with
 uppercase characters were extracted normally (like Makefile in the
 src package and NEWINSTALL in the win package). So, files were not
 indiscriminately renamed to lower case. I have not tried to repeat
 sine the original occurrence... will try that later when I have a
 faster connection for the download.

Unfortunately, I can't try this on Windows, so I'm doing it on OS X. Using your 
wget options, I see this:

blah $ unzip -l web2py_src.zip | grep -i version
   37  12-22-10 09:31   web2py/VERSION

blah $ unzip -l web2py_win.zip | grep -i version
   37  12-22-10 09:33   web2py/VERSION

If I create web2py/version first, it gets overwritten with web2py/VERSION when 
I do the unzip (since OS X's default file system, like Windows', is not 
case-senstive). 

Is it possible that you had a 'version' there to begin with? If so, perhaps 
it's a Windows unzip peculiarity.


 
 On Dec 27, 9:52 am, Jonathan Lundell jlund...@pobox.com wrote:
 On Dec 27, 2010, at 7:39 AM, reyelts wrote:
 
 
 
 So is this a packaging error when building the source package for
 download from web2py.com?
 
 I got VERSION just now when I downloaded it. 
 http://www.web2py.com/examples/static/web2py_src.zip
 
 Is 'version' repeatable for you? What OS and file system, and how are you 
 unpacking it?
 
 
 
 
 
 
 
 
 
 On Dec 25, 5:22 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Dec 25, 2010, at 1:40 PM, reyelts wrote:
 
 Either the code should be looking for the name 'version' (since that's
 what is shipped) or the file should be renamed 'VERSION' (since that's
 what's hardcoded in the source). Shipping 'version' and coding
 'VERSION' is just asking for the problem we currently see.
 
 FWIW, it's 'VERSION' in the Mercurial source repository.




[web2py] patch notes

2010-12-27 Thread Jonathan Lundell
By way of explanation...

My parse_url patch today is strictly refactoring, with no functional 
change--another in a series of patches to make URL rewriting more modular.

The Rocket patch is slightly more than cosmetic, in a development context. New 
worker threads, beyond the first default thread pool, did not have setDaemon 
set to True. This ordinarily is of no consequence. However, if you had a 
request running in one of those threads, and the request got stuck in a loop 
(hung), then sending SIGTERM to web2py would fail to terminate that thread, and 
you'd have to use SIGKILL (kill -9) to get web2py to quit.

setDaemon tells the thread logic that the thread in question can be terminated 
without waiting for it to stop itself, which is what we want in this case. 

This is only likely to happen in testing, I imagine, and even then only if 
Rocket needed to create additional worker threads, and even then only if the 
hung process was running in one of the newer threads. So not a big deal

[web2py] Re: executing code from db

2010-12-27 Thread mattynoce
hm. this is true, but what i'm looking to do is a little different.

basically i want to do templating like you do in the views. so my view
would look like this:

__
hello, {{=user.first_name}},

{{=instruction.step}}
__

and instruction.step might have text like your last name is
{{=user.last_name}} -- is there a way to run code back through the
templating software? so that instruction.step could be parsed and pull
out {{=user.last_name}}?

i know this doesn't seem like a great idea, and i'm working to find
ways around it. but being able to use the db to do some templating
would be helpful for now.

thanks,

matt

On Dec 27, 11:16 am, mdipierro mdipie...@cs.depaul.edu wrote:
 cube2py does that.

 http://code.google.com/p/cube2py/source/browse/models/plugin_wiki.py?...

 On Dec 27, 12:56 pm, mattynoce mattyn...@gmail.com wrote:

  bump. any thoughts on running code stored in the db through the web2py
  interpreter?

  On Dec 23, 3:17 pm, mattynoce mattyn...@gmail.com wrote:

   hi all. i know this doesn't sound like a superb idea, but i may have
   to do something like it.

   i have data coming from the db and being displayed to the user as
   instructions. do this, go there, etc.

   i'd like to have that data executed in the environment, so i could say
   do this, {{=user.first_name}}. but when i say
   {{=XML(instruction.step)}} it spits out the raw text but doesn't
   execute it.

   this only happens for db info that we put in, no user data. is there a
   way to run it through the web2py interpreter before displaying it to
   the user?

   thanks, and happy holidays.

   matt




[web2py] css handling at custom form

2010-12-27 Thread pk
hi together,
i need very important help:

i have this code example:

 {{=foto_edit.custom.begin}}
   Image file: div{{=XML(%s%s %
(str(foto_edit.custom.widget.image).split([)[0], '/div'))}}/div
   Click here to upload: {{=foto_edit.custom.submit}}
  {{=foto_edit.custom.end}}

how can i handle the css for the buttons the labels and the filename?

thanks peter


[web2py] Re: 1.91.4 error reading version file

2010-12-27 Thread mart
this works for me on ac os x:

import string
from urllib2 import Request, urlopen, URLError, HTTPError
url = 'http://www.web2py.com/examples/static/web2py_src.zip'
req = Request(url)
try:
oFile = urlopen(req)
latestVersion =
string.strip(string.split(string.split(string.split(oFile.read(),
 
'web2py/VERSION')[1],
 ' (')[0],
'Version ')[1])
except HTTPError as httpErr:
print('HTTPError: {0}\t{1}'.format(httpErr.code,
   url))
except URLError as urlErr:
print('URLError: {0}\t{1}'.format(urlErr.reason,
  url))


mart


On Dec 27, 3:32 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Dec 27, 2010, at 12:13 PM, reyelts wrote:



  I do wget --no-clobber --directory-prefix=blah
 http://www.web2py.com/examples/static/web2py_src.zip; followed by
  unzip -o -q... to unravel the file. For both web2py_src.zip and
  web2py_win.zip, I got version. In both cases, other file names with
  uppercase characters were extracted normally (like Makefile in the
  src package and NEWINSTALL in the win package). So, files were not
  indiscriminately renamed to lower case. I have not tried to repeat
  sine the original occurrence... will try that later when I have a
  faster connection for the download.

 Unfortunately, I can't try this on Windows, so I'm doing it on OS X. Using 
 your wget options, I see this:

 blah $ unzip -l web2py_src.zip | grep -i version
        37  12-22-10 09:31   web2py/VERSION

 blah $ unzip -l web2py_win.zip | grep -i version
        37  12-22-10 09:33   web2py/VERSION

 If I create web2py/version first, it gets overwritten with web2py/VERSION 
 when I do the unzip (since OS X's default file system, like Windows', is not 
 case-senstive).

 Is it possible that you had a 'version' there to begin with? If so, perhaps 
 it's a Windows unzip peculiarity.









  On Dec 27, 9:52 am, Jonathan Lundell jlund...@pobox.com wrote:
  On Dec 27, 2010, at 7:39 AM, reyelts wrote:

  So is this a packaging error when building the source package for
  download from web2py.com?

  I got VERSION just now when I downloaded it. 
  http://www.web2py.com/examples/static/web2py_src.zip

  Is 'version' repeatable for you? What OS and file system, and how are you 
  unpacking it?

  On Dec 25, 5:22 pm, Jonathan Lundell jlund...@pobox.com wrote:
  On Dec 25, 2010, at 1:40 PM, reyelts wrote:

  Either the code should be looking for the name 'version' (since that's
  what is shipped) or the file should be renamed 'VERSION' (since that's
  what's hardcoded in the source). Shipping 'version' and coding
  'VERSION' is just asking for the problem we currently see.

  FWIW, it's 'VERSION' in the Mercurial source repository.


[web2py] Re: patch notes

2010-12-27 Thread mdipierro
Thank you for the clarification Jonathan.

On Dec 27, 2:51 pm, Jonathan Lundell jlund...@pobox.com wrote:
 By way of explanation...

 My parse_url patch today is strictly refactoring, with no functional 
 change--another in a series of patches to make URL rewriting more modular.

 The Rocket patch is slightly more than cosmetic, in a development context. 
 New worker threads, beyond the first default thread pool, did not have 
 setDaemon set to True. This ordinarily is of no consequence. However, if you 
 had a request running in one of those threads, and the request got stuck in a 
 loop (hung), then sending SIGTERM to web2py would fail to terminate that 
 thread, and you'd have to use SIGKILL (kill -9) to get web2py to quit.

 setDaemon tells the thread logic that the thread in question can be 
 terminated without waiting for it to stop itself, which is what we want in 
 this case.

 This is only likely to happen in testing, I imagine, and even then only if 
 Rocket needed to create additional worker threads, and even then only if the 
 hung process was running in one of the newer threads. So not a big deal


[web2py] Re: SimpleGeo - free tools for creating location aware apps with Python Client and SDK

2010-12-27 Thread Felipe Pedrini
Do you know if simplegeo Storage will become a paid service? It looks
exactly what I need.

Thanks for sharing!

On Dec 27, 9:10 am, Tom Atkins minkto...@gmail.com wrote:
 Just for interest if you're building a location aware app:

 http://simplegeo.com


Re: [web2py] Re: The stability of web2py releases

2010-12-27 Thread Thadeus Burgess
Also an issue when only one person has access to said clones.

--
Thadeus




On Mon, Dec 27, 2010 at 11:04 AM, mdipierro mdipie...@cs.depaul.edu wrote:

 Yarko created it and used to maintain it. That is is the problem with
 having too many clones in different places. Venetually they get out of
 sync.

 Massimo

 On Dec 27, 9:50 am, Bruno Rocha rochacbr...@gmail.com wrote:
  Is there a web2py clone in bitbucket (updated 16 months ago)
 
  https://bitbucket.org/mdipierro/web2py/overview
 
  https://bitbucket.org/mdipierro/web2py/overviewJust needs to update
 this
  repository
 
  2010/12/27 R. Strusberg strusb...@gmail.com
 
 
 
   +1
 
   2010/12/24 ron_m ron.mco...@gmail.com:
I for one am happy with the current release cycle. It is a good
 balance
between new features and the ultimate stability of release 1.XX.N
  where
   N
is the last version before XX+1 for example. The nightly build is a
 bit
   of a
misnomer, many projects (C or C++ mostly) have some automated process
   that
takes trunk and compiles it to produce a .tar.gz labelled nightly
 which
might work. For web2py we should just hg pull; hg update to achieve
   that
result. The nightly for web2py is more like a beta because Massimo
 hand
picks code from trunk that will or will not be in the nightly which
 could
really be a weekly.
 
I am currently developing the application I am working on and testing
 is
easy enough that I test trunk at least daily. The web2py server is
 quite
easy to use but the code in some places is complicated and has many
   possible
use cases. It is only through exposure out to the user base that a
 large
number of use cases of the code get tested. I have even seen problems
reported where something was fixed but used by maybe one person in a
 way
that should not have worked resulting in the dreaded bug that worked
 and
became a useful feature for someone.
 
Once I go to production I will probably move the releases a lot
 slower
through the installed base. In fact I have 2 beta production systems
 up
   now
and only push a new web2py when I push a new version of the
 application
   to
the stakeholders to look at.
 
Massimo provides a fantastic service with the web2py project and I
 would
   not
like to see him stifled by a load of process. Anyone that has time to
   test
will definitely help the quality, if you don't have time, that is
 okay
   too.
I personally don't mind doing some release management between where
   Massimo
is burning the midnight oil and what I let out into the production
   systems I
have/will manage. The product is alive with new features and bug
 fixes
sometimes occur in minutes once reported. That is worth a lot.
 
Ron
 
  --
 
  Bruno Rochahttp://about.me/rochacbruno/bio



[web2py] Re: 1.91.4 error reading version file

2010-12-27 Thread mart
and this to download ad extract to unique location:

from time import strftime,
localtime
import string
from urllib2 import Request, urlopen, URLError, HTTPError
from zipfile import ZipFile,ZipExtFile, ZIP_STORED, ZipInfo

dateTimeStamp = '{0}'.format(strftime('%y%m%d%H%M%S',
 localtime()))

latestVersion = returned version number from previous bit above

downloads = some_path

uniqueName = '{0}_{1}'.format(dateTimeStamp,
  latestVersion)

uniqueFolderPath = '{0}/{1}'.format(downloads,
uniqueName) # version returned
from above function

w2pZip = '{0}/{1}_web2py_src.zip'.format(downloads,
 uniqueName,
 fileName)
def extractw2p():
z = zipfile.ZipFile(w2pZip,'r',
ZIP_STORED,
True)
z.extractall('{0}/{1}'.format())

def downloadw2p():
try:
oFile = urlopen(url)
iFile = open(w2pZip, 'wb')
iFile.write(oFile.read())
iFile.close()
except HTTPError as httpErr:
print('HTTPError: {0}\t{1}'.format(httpErr.code,
   url))
except URLError as urlErr:
print('URLError: {0}\t{1}'.format(urlErr.reason,
  url))

On Dec 27, 5:07 pm, mart msenecal...@gmail.com wrote:
 this works for me on ac os x:

 import string
 from urllib2 import Request, urlopen, URLError, HTTPError
 url = 'http://www.web2py.com/examples/static/web2py_src.zip'
 req = Request(url)
 try:
     oFile = urlopen(req)
     latestVersion =
 string.strip(string.split(string.split(string.split(oFile.read(),

 'web2py/VERSION')[1],
                                                              ' (')[0],
                                                 'Version ')[1])
 except HTTPError as httpErr:
     print('HTTPError: {0}\t{1}'.format(httpErr.code,
                                        url))
 except URLError as urlErr:
     print('URLError: {0}\t{1}'.format(urlErr.reason,
                                       url))

 mart

 On Dec 27, 3:32 pm, Jonathan Lundell jlund...@pobox.com wrote:







  On Dec 27, 2010, at 12:13 PM, reyelts wrote:

   I do wget --no-clobber --directory-prefix=blah
  http://www.web2py.com/examples/static/web2py_src.zip; followed by
   unzip -o -q... to unravel the file. For both web2py_src.zip and
   web2py_win.zip, I got version. In both cases, other file names with
   uppercase characters were extracted normally (like Makefile in the
   src package and NEWINSTALL in the win package). So, files were not
   indiscriminately renamed to lower case. I have not tried to repeat
   sine the original occurrence... will try that later when I have a
   faster connection for the download.

  Unfortunately, I can't try this on Windows, so I'm doing it on OS X. Using 
  your wget options, I see this:

  blah $ unzip -l web2py_src.zip | grep -i version
         37  12-22-10 09:31   web2py/VERSION

  blah $ unzip -l web2py_win.zip | grep -i version
         37  12-22-10 09:33   web2py/VERSION

  If I create web2py/version first, it gets overwritten with web2py/VERSION 
  when I do the unzip (since OS X's default file system, like Windows', is 
  not case-senstive).

  Is it possible that you had a 'version' there to begin with? If so, perhaps 
  it's a Windows unzip peculiarity.

   On Dec 27, 9:52 am, Jonathan Lundell jlund...@pobox.com wrote:
   On Dec 27, 2010, at 7:39 AM, reyelts wrote:

   So is this a packaging error when building the source package for
   download from web2py.com?

   I got VERSION just now when I downloaded it. 
   http://www.web2py.com/examples/static/web2py_src.zip

   Is 'version' repeatable for you? What OS and file system, and how are 
   you unpacking it?

   On Dec 25, 5:22 pm, Jonathan Lundell jlund...@pobox.com wrote:
   On Dec 25, 2010, at 1:40 PM, reyelts wrote:

   Either the code should be looking for the name 'version' (since that's
   what is shipped) or the file should be renamed 'VERSION' (since that's
   what's hardcoded in the source). Shipping 'version' and coding
   'VERSION' is just asking for the problem we currently see.

   FWIW, it's 'VERSION' in the Mercurial source repository.


Re: [web2py] Ajax pattern with Web2py

2010-12-27 Thread David J.

Hey Markus;

I am questioning the same thing; I am also trying to dig up this 
information.


maybe someone on this list has dealt with similar problems and wouldn't 
mind sharing?


If I find something I will be sure to post.

Thanks.



On 12/27/10 10:54 AM, Markus Schmitz wrote:

Good afternoon everybody,

I am trying my hand at a web2py based application and as long as I
stay with the good old postback pattern, everything works brilliantly
and coding is very efficient. In this style I programmed in the new
application the account management, a database logging feature, a FAQ
section, a feedback section, some import and export functionality.

Also the core functionality (with BI like functionality) works ok in a
post back manner, but is reaching performance and usability limits. I
would like to ajaxify the application and could obviously do so with
a corresponding amount of javascript+jquery. But suddenly the
efficiency gains of web2py are evaporating. I am aware of the ajax and
load functions in web2py, but they somehow do not fit my needs. So I
get the feeling, I either do not understand the ajax concept of web2py
or I am designing my app wrongly.

Here is an example, what I would like to do (one of many examples):

- display some data retrieved in a structured table like manner (easy
to be done with web2py).
- By clicking on an entry a modal popup window shall open and display
the data to be edited
- After editing and pressing 'save' the modal window closes and the
original table updates.

All of this without a postback. The wiki plugin works with a modal
window (the widget builder), but the result is taken with copy and
paste to the wiki text instead of being inserted automatically. So it
does not help me much.

Another example would be:

- I have on a page a tree, a form to search/filter data and a chart.
- When a node in the tree is clicked, than the filter selection
changes and the chart needs to reload accordingly
- When a node in the chart is selected, then again the filter changes
and the tree needs to reload
- Naturally if the filter form changes, both tree and chart needs to
reload.

I implemented this with javascript events on the tree and chart and
old fashioned postback, but which ajax pattern would you suggest for
this? Naturally I would like to minimize the javascript hacking on the
page as much as possible.

I am not looking for concrete coding tips here, more for the general
patterns of how to do ajax with web2py with minimal effort.

Regards

Markus





[web2py] writable=False, default=False ... problem (v1.91.4)

2010-12-27 Thread VP
I just upgraded to 1.91.4 (probably should have waited).  I don't know
if this is related to 1.91.4 but I don't recall having this problem
with 1.90.x

Anyway, I have a table with a boolean field.  In the model definition
(db.define.), it is set with  default=False and writable=False.

With these, it seems that web2py will set it as neither True nor False
(None???).   This doesn't seem to be a problem when I have
writable=True (it will be set correctly to be False, as specified).

Btw, I'm using sqlite.





[web2py] Re: The stability of web2py releases

2010-12-27 Thread mdipierro
I have no interest and not time for this. If somebody wants to take
over the cloning and ask Yarko, I am sure he will not mind. Email me
for his address.

massimo

On Dec 27, 4:15 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 Also an issue when only one person has access to said clones.

 --
 Thadeus

 On Mon, Dec 27, 2010 at 11:04 AM, mdipierro mdipie...@cs.depaul.edu wrote:
  Yarko created it and used to maintain it. That is is the problem with
  having too many clones in different places. Venetually they get out of
  sync.

  Massimo

  On Dec 27, 9:50 am, Bruno Rocha rochacbr...@gmail.com wrote:
   Is there a web2py clone in bitbucket (updated 16 months ago)

  https://bitbucket.org/mdipierro/web2py/overview

   https://bitbucket.org/mdipierro/web2py/overviewJust needs to update
  this
   repository

   2010/12/27 R. Strusberg strusb...@gmail.com

+1

2010/12/24 ron_m ron.mco...@gmail.com:
 I for one am happy with the current release cycle. It is a good
  balance
 between new features and the ultimate stability of release 1.XX.N
   where
N
 is the last version before XX+1 for example. The nightly build is a
  bit
of a
 misnomer, many projects (C or C++ mostly) have some automated process
that
 takes trunk and compiles it to produce a .tar.gz labelled nightly
  which
 might work. For web2py we should just hg pull; hg update to achieve
that
 result. The nightly for web2py is more like a beta because Massimo
  hand
 picks code from trunk that will or will not be in the nightly which
  could
 really be a weekly.

 I am currently developing the application I am working on and testing
  is
 easy enough that I test trunk at least daily. The web2py server is
  quite
 easy to use but the code in some places is complicated and has many
possible
 use cases. It is only through exposure out to the user base that a
  large
 number of use cases of the code get tested. I have even seen problems
 reported where something was fixed but used by maybe one person in a
  way
 that should not have worked resulting in the dreaded bug that worked
  and
 became a useful feature for someone.

 Once I go to production I will probably move the releases a lot
  slower
 through the installed base. In fact I have 2 beta production systems
  up
now
 and only push a new web2py when I push a new version of the
  application
to
 the stakeholders to look at.

 Massimo provides a fantastic service with the web2py project and I
  would
not
 like to see him stifled by a load of process. Anyone that has time to
test
 will definitely help the quality, if you don't have time, that is
  okay
too.
 I personally don't mind doing some release management between where
Massimo
 is burning the midnight oil and what I let out into the production
systems I
 have/will manage. The product is alive with new features and bug
  fixes
 sometimes occur in minutes once reported. That is worth a lot.

 Ron

   --

   Bruno Rochahttp://about.me/rochacbruno/bio




[web2py] Re: The stability of web2py releases

2010-12-27 Thread weheh
@Branko: my point is that python has many stable releases. I have some
ancient code that's still on python 2.3 and absolutely, positively
can't be upgraded to the latest stable 2.5.X or later. The point being
that if I were ever going to have to migrate that code to a new
machine, I would have to install python 2.3.x.

On Dec 25, 12:57 pm, Branko Vukelić stu...@brankovukelic.com wrote:
 On Sat, Dec 25, 2010 at 4:08 PM, weheh richard_gor...@verizon.net wrote:
  I'm not keen on the 2 button approach -- can you imagine a 2 button
  release for python? Nevertheless, it does potentially simplify the

 Yes, I can certainly imagine a 2 button Python release[1]:

 --

 For the MD5 checksums and OpenPGP signatures, look at the detailed
 Python 2.7.1 page:

     * Python 2.7.1 Windows installer (Windows binary -- does not include 
 source)
     * Python 2.7.1 Windows X86-64 installer (Windows AMD64 / Intel 64
 / X86-64 binary [1] -- does not include source)

     * Python 2.7.1 compressed source tarball (for Linux, Unix or OS X)
     * Python 2.7.1 bzipped source tarball (for Linux, Unix or OS X,
 more compressed)

 Also look at the detailed Python 3.1.3 page:

     * Python 3.1.3 Windows x86 MSI Installer (Windows binary -- does
 not include source)
     * Python 3.1.3 Windows X86-64 MSI Installer (Windows AMD64 / Intel
 64 / X86-64 binary [1] -- does not include source)

     * Python 3.1.3 compressed source tarball (for Linux, Unix or OS X)
     * Python 3.1.3 bzipped source tarball (for Linux, Unix or OS X,
 more compressed)

 --

 [1]http://python.org/download/

 --
 Branko Vukelic

 stu...@brankovukelic.comhttp://www.brankovukelic.com/


Re: [web2py] Re: The stability of web2py releases

2010-12-27 Thread Branko Vukelić
In other words, you want commit access to the master repository?

On Mon, Dec 27, 2010 at 11:15 PM, Thadeus Burgess thade...@thadeusb.com wrote:
 Also an issue when only one person has access to said clones.

 --
 Thadeus




 On Mon, Dec 27, 2010 at 11:04 AM, mdipierro mdipie...@cs.depaul.edu wrote:

 Yarko created it and used to maintain it. That is is the problem with
 having too many clones in different places. Venetually they get out of
 sync.

 Massimo

 On Dec 27, 9:50 am, Bruno Rocha rochacbr...@gmail.com wrote:
  Is there a web2py clone in bitbucket (updated 16 months ago)
 
  https://bitbucket.org/mdipierro/web2py/overview
 
  https://bitbucket.org/mdipierro/web2py/overviewJust needs to update
  this
  repository
 
  2010/12/27 R. Strusberg strusb...@gmail.com
 
 
 
   +1
 
   2010/12/24 ron_m ron.mco...@gmail.com:
I for one am happy with the current release cycle. It is a good
balance
between new features and the ultimate stability of release 1.XX.N
 where
   N
is the last version before XX+1 for example. The nightly build is a
bit
   of a
misnomer, many projects (C or C++ mostly) have some automated
process
   that
takes trunk and compiles it to produce a .tar.gz labelled nightly
which
might work. For web2py we should just hg pull; hg update to
achieve
   that
result. The nightly for web2py is more like a beta because Massimo
hand
picks code from trunk that will or will not be in the nightly which
could
really be a weekly.
 
I am currently developing the application I am working on and
testing is
easy enough that I test trunk at least daily. The web2py server is
quite
easy to use but the code in some places is complicated and has many
   possible
use cases. It is only through exposure out to the user base that a
large
number of use cases of the code get tested. I have even seen
problems
reported where something was fixed but used by maybe one person in a
way
that should not have worked resulting in the dreaded bug that worked
and
became a useful feature for someone.
 
Once I go to production I will probably move the releases a lot
slower
through the installed base. In fact I have 2 beta production systems
up
   now
and only push a new web2py when I push a new version of the
application
   to
the stakeholders to look at.
 
Massimo provides a fantastic service with the web2py project and I
would
   not
like to see him stifled by a load of process. Anyone that has time
to
   test
will definitely help the quality, if you don't have time, that is
okay
   too.
I personally don't mind doing some release management between where
   Massimo
is burning the midnight oil and what I let out into the production
   systems I
have/will manage. The product is alive with new features and bug
fixes
sometimes occur in minutes once reported. That is worth a lot.
 
Ron
 
  --
 
  Bruno Rochahttp://about.me/rochacbruno/bio





-- 
Branko Vukelic

stu...@brankovukelic.com
http://www.brankovukelic.com/


[web2py] Re: Ajax pattern with Web2py

2010-12-27 Thread weheh
If you haven't read the sections on ajax (don't recall the chapter)
and components (ch 13), then you must read them first. Then,
experiment with something really trivial in order to get your feet
wet, like this:

#controller
def index():
  return dict()
def callback():
  return 'hello world'

#view
{{extend 'layout.html'}}
div id='target'/div
a href='#' id='test' _onclick='ajax({{=URL('callback'}},
[test],targetclick me/a

Couldn't be simpler. (Caveat: I haven't tried the above code per se,
but it looks like it should work.)

Anyway, keep your chin up. At first, my web2py productivity suffered
when I started to ajax stuff. After wrapping my head around the ajax
way and components, productivity is back up again ... way up.

On Dec 27, 5:37 pm, David J. da...@styleflare.com wrote:
 Hey Markus;

 I am questioning the same thing; I am also trying to dig up this
 information.

 maybe someone on this list has dealt with similar problems and wouldn't
 mind sharing?

 If I find something I will be sure to post.

 Thanks.

 On 12/27/10 10:54 AM, Markus Schmitz wrote:

  Good afternoon everybody,

  I am trying my hand at a web2py based application and as long as I
  stay with the good old postback pattern, everything works brilliantly
  and coding is very efficient. In this style I programmed in the new
  application the account management, a database logging feature, a FAQ
  section, a feedback section, some import and export functionality.

  Also the core functionality (with BI like functionality) works ok in a
  post back manner, but is reaching performance and usability limits. I
  would like to ajaxify the application and could obviously do so with
  a corresponding amount of javascript+jquery. But suddenly the
  efficiency gains of web2py are evaporating. I am aware of the ajax and
  load functions in web2py, but they somehow do not fit my needs. So I
  get the feeling, I either do not understand the ajax concept of web2py
  or I am designing my app wrongly.

  Here is an example, what I would like to do (one of many examples):

  - display some data retrieved in a structured table like manner (easy
  to be done with web2py).
  - By clicking on an entry a modal popup window shall open and display
  the data to be edited
  - After editing and pressing 'save' the modal window closes and the
  original table updates.

  All of this without a postback. The wiki plugin works with a modal
  window (the widget builder), but the result is taken with copy and
  paste to the wiki text instead of being inserted automatically. So it
  does not help me much.

  Another example would be:

  - I have on a page a tree, a form to search/filter data and a chart.
  - When a node in the tree is clicked, than the filter selection
  changes and the chart needs to reload accordingly
  - When a node in the chart is selected, then again the filter changes
  and the tree needs to reload
  - Naturally if the filter form changes, both tree and chart needs to
  reload.

  I implemented this with javascript events on the tree and chart and
  old fashioned postback, but which ajax pattern would you suggest for
  this? Naturally I would like to minimize the javascript hacking on the
  page as much as possible.

  I am not looking for concrete coding tips here, more for the general
  patterns of how to do ajax with web2py with minimal effort.

  Regards

  Markus




[web2py] Re: writable=False, default=False ... problem (v1.91.4)

2010-12-27 Thread mdipierro
fixed in trunk

On Dec 27, 4:58 pm, VP vtp2...@gmail.com wrote:
 I just upgraded to 1.91.4 (probably should have waited).  I don't know
 if this is related to 1.91.4 but I don't recall having this problem
 with 1.90.x

 Anyway, I have a table with a boolean field.  In the model definition
 (db.define.), it is set with  default=False and writable=False.

 With these, it seems that web2py will set it as neither True nor False
 (None???).   This doesn't seem to be a problem when I have
 writable=True (it will be set correctly to be False, as specified).

 Btw, I'm using sqlite.


[web2py] Re: executing code from db

2010-12-27 Thread mattynoce
on second thought (or third, or fourth), don't worry about this. i'm
going to redo my setup so i don't have to pull code from the db or try
to template templates.

thanks,

matt

On Dec 27, 1:02 pm, mattynoce mattyn...@gmail.com wrote:
 hm. this is true, but what i'm looking to do is a little different.

 basically i want to do templating like you do in the views. so my view
 would look like this:

 __
 hello, {{=user.first_name}},

 {{=instruction.step}}
 __

 and instruction.step might have text like your last name is
 {{=user.last_name}} -- is there a way to run code back through the
 templating software? so that instruction.step could be parsed and pull
 out {{=user.last_name}}?

 i know this doesn't seem like a great idea, and i'm working to find
 ways around it. but being able to use the db to do some templating
 would be helpful for now.

 thanks,

 matt

 On Dec 27, 11:16 am, mdipierro mdipie...@cs.depaul.edu wrote:

  cube2py does that.

 http://code.google.com/p/cube2py/source/browse/models/plugin_wiki.py?...

  On Dec 27, 12:56 pm, mattynoce mattyn...@gmail.com wrote:

   bump. any thoughts on running code stored in the db through the web2py
   interpreter?

   On Dec 23, 3:17 pm, mattynoce mattyn...@gmail.com wrote:

hi all. i know this doesn't sound like a superb idea, but i may have
to do something like it.

i have data coming from the db and being displayed to the user as
instructions. do this, go there, etc.

i'd like to have that data executed in the environment, so i could say
do this, {{=user.first_name}}. but when i say
{{=XML(instruction.step)}} it spits out the raw text but doesn't
execute it.

this only happens for db info that we put in, no user data. is there a
way to run it through the web2py interpreter before displaying it to
the user?

thanks, and happy holidays.

matt




Re: [web2py] Re: executing code from db

2010-12-27 Thread Stef Mientki
On 27-12-2010 21:23, mdipierro wrote:
 cube2py is just a scaffolding app + plugin_wiki. The code is in
 question is also in plugin_wiki although people do not seem to use it
 (and I am not sure it is in general a good idea to store code in db).

I wonder why not ?
it might be unconventional,
and the advantage is that the code can not be so easily changed (by accident).
And isn't a file system not just a crappy ( almost not relational) database ?

And if you look at e.g. Sage, code is even stored in between text files ;-)

cheers,
Stef




Re: [web2py] try web2py with cherrypy, diesel, eventlet, fapws,flup, gnuicorn, paste, rocket, tornado, twisted, wsgiref

2010-12-27 Thread Bruno Rocha
I am giving a first try on this:

*cherrypy*
rochacbr...@macubuntu:~/projects/web2py$ python anyserver.py -s cherrypy -p
8080
starting cherrypy on 127.0.0.1:8080...
/usr/lib/pymodules/python2.6/cherrypy/lib/cptools.py:3: DeprecationWarning:
the md5 module is deprecated; use hashlib instead
  import md5
/usr/lib/pymodules/python2.6/cherrypy/filters/sessionfilter.py:33:
DeprecationWarning: the sha module is deprecated; use the hashlib module
instead
  import sha
Traceback (most recent call last):
  File anyserver.py, line 171, in module
main()
  File anyserver.py, line 168, in main

 
run(options.server,options.ip,options.port,logging=options.logging,profiler=options.profiler)
  File anyserver.py, line 129, in run
getattr(Servers,servername)(application,(ip,int(port)))
  File anyserver.py, line 40, in cherrypy
from cherrypy import wsgiserver
ImportError: cannot import name wsgiserver
rochacbr...@macubuntu:~/projects/web2py$
/*cherrypy*


*tornado*
rochacbr...@macubuntu:~/projects/web2py$ python anyserver.py -s tornado -p
8081
starting tornado on 127.0.0.1:8081...
Traceback (most recent call last):
  File anyserver.py, line 171, in module
main()
  File anyserver.py, line 168, in main

 
run(options.server,options.ip,options.port,logging=options.logging,profiler=options.profiler)
  File anyserver.py, line 129, in run
getattr(Servers,servername)(application,(ip,int(port)))
  File anyserver.py, line 87, in tornado
server.listen(address=address[0], port=address[1])
TypeError: listen() got an unexpected keyword argument 'address'
/*tornado*

*paste VERY FAST*
rochacbr...@macubuntu:~/projects/web2py$ python anyserver.py -s paste -p
8081
starting paste on 127.0.0.1:8081...
serving on http://127.0.0.1:8081
/*paste*

*twisted*
rochacbr...@macubuntu:~/projects/web2py$ python anyserver.py -s twisted -p
8081
starting twisted on 127.0.0.1:8081...
/*twisted*




2010/12/22 mdipierro mdipie...@cs.depaul.edu

 we made this easy. There is a new file in trunk

 web2py/anyserver.py

 so just do

 easy_install cherrypy
 python anyserver.py -s cherrypy -p 8080

 easy_install tornado
 python anyserver.py -s tornado -p 8081

 ...
 you get the idea. -h for help -i and -p to specify ip and port, -l for
 logging and -P for profiler.

 The code is very much inspired by code in the bottle microframework.

 I am not sure if this will stay in its current form or if it will
 incorporated into web2py.py (my preference).

 Anybody wants to run some benchmarks tomorrow?

 Anybody wants to help move it to gluon/ and add the -s option to gluon/
 widget.py?

 Massimo




-- 

Bruno Rocha
http://about.me/rochacbruno/bio


Re: [web2py] try web2py with cherrypy, diesel, eventlet, fapws,flup, gnuicorn, paste, rocket, tornado, twisted, wsgiref

2010-12-27 Thread Bruno Rocha
Just tried Cyclone - https://github.com/fiorix/cyclone - It is based on
 twisted then I thought that would run

*cyclone*
rochacbr...@macubuntu:~/projects/web2py$ python anyserver.py -s cyclone -p
8081
starting cyclone on 127.0.0.1:8081...
Traceback (most recent call last):
  File anyserver.py, line 171, in module
main()
  File anyserver.py, line 168, in main

 
run(options.server,options.ip,options.port,logging=options.logging,profiler=options.profiler)
  File anyserver.py, line 129, in run
getattr(Servers,servername)(application,(ip,int(port)))
AttributeError: class Servers has no attribute 'cyclone'
/*cyclone*


-- 

Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] Re: Web2Py Foundation?

2010-12-27 Thread Pepe Araya
Hi,

some news about this topic?

I think 2 things are going in favor of creating a foundation or [whatever]:
1. the community has grown a lot.
2. in all the reviews I read about web2py, always, always, ALWAYS!!! say it 
is a single-person framework and that takes away the future security of 
their development.

kind regards

Pepe


[web2py] Re: Web2Py Foundation?

2010-12-27 Thread Vincent


On Dec 27, 8:46 pm, Pepe Araya pepea...@gmail.com wrote:
 Hi,

 some news about this topic?

 I think 2 things are going in favor of creating a foundation or [whatever]:
 1. the community has grown a lot.
 2. in all the reviews I read about web2py, always, always, ALWAYS!!! say it
 is a single-person framework and that takes away the future security of
 their development.


I strongly agree with the last point. I think the recent license
change is good but making web2py community frame work would help. This
is honestly the biggest fear I have in using web2py in my upcoming
project as allowed to django which I like less but I am more confidant
in it's continued development. This is my perception of this right or
wrong.

Vincent

 kind regards

 Pepe


[web2py] Re: Web2Py Foundation?

2010-12-27 Thread weheh
Non-for-profits take a lot to setup and administer ... more so than
corporations. I've set up all different types of corps: Schedule S,
Schedule C, LLCs, but never a 501c3 (non-profit). I have 2 family
members who have extensive experience setting up and administering
501c3's and from talking with them about it over the years, it's much
more work to administer than any other type of corp. Nevertheless, as
comments in this thread point out, there is a body of users who will
not consider web2py unless it has some sort of foundation status/
ownership. I'm not an attorney, so take what I say with a heavy dose
of salt -- I think it's OK to discuss not-for-profit status at this
time, but probably too early to execute on going all the way. I say
that because I think web2py functionality is still where the bulk of
effort should go. We're still in the early-adopter stage of web2py,
and the people you're going to lose by not being a 501c3 are probably
in the early- or late-majority category. Demonstrating an intention to
move in this direction is probably good enough for the early adopters
and maybe some early majority types. I know that under the current
structure, I'm not the least bit concerned about moving my apps to
web2py. But then again, I have full control and don't report to a
pointy-haired boss somewhere who has a herd mentality.


[web2py] Re: css handling at custom form

2010-12-27 Thread weheh
Use firebug to see the class name of your submit button. Then create a
custom css that changes the class. Or ditch the submit button and make
your own INPUT(_type=submit, _name= ..., _class='myclass').

On Dec 27, 4:11 pm, pk peter.kirch...@youngdesigners.de wrote:
 hi together,
 i need very important help:

 i have this code example:

  {{=foto_edit.custom.begin}}
    Image file: div{{=XML(%s%s %
 (str(foto_edit.custom.widget.image).split([)[0], '/div'))}}/div
    Click here to upload: {{=foto_edit.custom.submit}}
   {{=foto_edit.custom.end}}

 how can i handle the css for the buttons the labels and the filename?

 thanks peter


[web2py] Re: try web2py with cherrypy, diesel, eventlet, fapws,flup, gnuicorn, paste, rocket, tornado, twisted, wsgiref

2010-12-27 Thread mdipierro
Look at the code. It is trivial to add it.

On Dec 27, 8:00 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 Just tried Cyclone -https://github.com/fiorix/cyclone- It is based on
  twisted then I thought that would run

 *cyclone*
 rochacbr...@macubuntu:~/projects/web2py$ python anyserver.py -s cyclone -p
 8081
 starting cyclone on 127.0.0.1:8081...
 Traceback (most recent call last):
   File anyserver.py, line 171, in module
     main()
   File anyserver.py, line 168, in main

  run(options.server,options.ip,options.port,logging=options.logging,profiler=options.profiler)
   File anyserver.py, line 129, in run
     getattr(Servers,servername)(application,(ip,int(port)))
 AttributeError: class Servers has no attribute 'cyclone'
 /*cyclone*

 --

 Bruno Rochahttp://about.me/rochacbruno/bio


[web2py] Re: A bug or am I doing something wrong

2010-12-27 Thread Kenneth Lundström

Any thoughts about this one?


Kenneth


Aapche 2, wsgi, MySQL 5.0, web2py 1.91.4, python 2.6.5

I have defined in my model:
Field('f_total_sum_all', type='decimal',
label=T('Total Sum')),

Even float gives the same error. Only integer works.



Version
web2py™ Version 1.91.4 (2010-12-22 17:31:23)
Python Python 2.6.5: /usr/bin/python

Traceback (most recent call last):
File /web2py/gluon/restricted.py, line 188, in restricted
exec ccode in environment
File /web2py/applications/kenneths/models/db_wizard.py, line 70, in 
module

migrate=settings.migrate)
File /web2py/gluon/dal.py, line 3321, in define_table
polymodel=polymodel)
File /web2py/gluon/dal.py, line 444, in create_table
precision, scale = [int(x) for x in field.type[8:-1].split(',')]
ValueError: invalid literal for int() with base 10: ''

Error snapshot help Detailed traceback description

type 'exceptions.ValueError'(invalid literal for int() with base 10: 
'')


inspect attributes
Exception instance attributes
__setattr__ method-wrapper '__setattr__' of exceptions.ValueError 
object
__reduce_ex__ built-in method __reduce_ex__ of exceptions.ValueError 
object
__getslice__ method-wrapper '__getslice__' of exceptions.ValueError 
object
__getitem__ method-wrapper '__getitem__' of exceptions.ValueError 
object
__setstate__ built-in method __setstate__ of exceptions.ValueError 
object
__getattribute__ method-wrapper '__getattribute__' of 
exceptions.ValueError object

__str__ method-wrapper '__str__' of exceptions.ValueError object
args (invalid literal for int() with base 10: '',)
__reduce__ built-in method __reduce__ of exceptions.ValueError object
__format__ built-in method __format__ of exceptions.ValueError object
__class__ type 'exceptions.ValueError'
__dict__ {}
__delattr__ method-wrapper '__delattr__' of exceptions.ValueError 
object

__subclasshook__ built-in method __subclasshook__ of type object
__repr__ method-wrapper '__repr__' of exceptions.ValueError object
__init__ method-wrapper '__init__' of exceptions.ValueError object
__hash__ method-wrapper '__hash__' of exceptions.ValueError object
__sizeof__ built-in method __sizeof__ of exceptions.ValueError object
__doc__ 'Inappropriate argument value (of correct type).'
__unicode__ built-in method __unicode__ of exceptions.ValueError object
__new__ built-in method __new__ of type object
Frames

File /web2py/gluon/restricted.py in restricted at line 188 code 
arguments variables

Function argument list

(code=### we prepend t_ to tablenames and f_ to 
fieldn...Field('current_record','reference t_bill_item'))\n, 
environment={'A': class 'gluon.html.A', 'Auth': class 
'gluon.tools.Auth', 'B': class 'gluon.html.B', 'BEAUTIFY': class 
'gluon.html.BEAUTIFY', 'BODY': class 'gluon.html.BODY', 'BR': 
class 'gluon.html.BR', 'CENTER': class 'gluon.html.CENTER', 
'CLEANUP': class 'gluon.validators.CLEANUP', 'CODE': class 
'gluon.html.CODE', 'CRYPT': class 'gluon.validators.CRYPT', ...}, 
layer='/web2py/applications/kenneths/models/db_wizard.py')

Code listing

if type(code) == types.CodeType:
ccode = code
else:
ccode = compile2(code,layer)

exec ccode in environment

except HTTP:
raise
except Exception:
# XXX Show exception in Wing IDE if running in debugger

Variables
environment {'A': class 'gluon.html.A', 'Auth': class 
'gluon.tools.Auth', 'B': class 'gluon.html.B', 'BEAUTIFY': class 
'gluon.html.BEAUTIFY', 'BODY': class 'gluon.html.BODY', 'BR': 
class 'gluon.html.BR', 'CENTER': class 'gluon.html.CENTER', 
'CLEANUP': class 'gluon.validators.CLEANUP', 'CODE': class 
'gluon.html.CODE', 'CRYPT': class 'gluon.validators.CRYPT', ...}
ccode code object module at 0x2aaab001f6c0, file 
/...plications/kenneths/models/db_wizard.py, line 5

*

File /web2py/applications/kenneths/models/db_wizard.py in module at 
line 70 code arguments variables

Function argument list

()
Code listing


label=T('Created By'),writable=False,readable=False),
Field('modified_by',db.auth_user,default=auth.user_id,
label=T('Modified By'),writable=False,readable=False,
update=auth.user_id),
format='%(f_name)s',
migrate=settings.migrate)


db.define_table('t_receipt_archive',db.t_receipt,Field('current_record','reference 
t_receipt'))




Variables
migrate undefined
settings.migrate True
settings Storage {'layout_theme': 'Clicker', 'subtitle':...l_server': 
'localhost', 'login_method': 'local'}

*

File /web2py/gluon/dal.py in define_table at line 3321 code arguments 
variables

Function argument list

(self=DAL {'auth_permission': Table {'ALL': gluon.d...ab0014c90}, 
'_migrate': True, '_pool_size': 0}, tablename='t_receipt', 
*fields=(gluon.dal.Field object, gluon.dal.Field object, 
gluon.dal.Field object, gluon.dal.Field object, gluon.dal.Field 
object, gluon.dal.Field object, gluon.dal.Field object, 
gluon.dal.Field object, gluon.dal.Field object, gluon.dal.Field 
object, gluon.dal.Field object, gluon.dal.Field object), 
**args={'format': '%(f_name)s', 'migrate': True})

Code listing


if 

Re: [web2py] SQLFORM into a pop window

2010-12-27 Thread Kenneth Lundström

Thank you Bruno,

my first thought when I tested it was that this doesn´t work at all, but 
now I see that it works quite nice.



Kenneth


Attached is an app which opens a form in a modal box.

2010/12/27 Kenneth Lundström kenneth.t.lundst...@gmail.com 
mailto:kenneth.t.lundst...@gmail.com


Does anybody have a example of how to make a sqlform open up in a
popup window?


Kenneth




--

Bruno Rocha
http://about.me/rochacbruno/bio




[web2py] Re: Web2Py Foundation?

2010-12-27 Thread mdipierro
Not sure what a single person framework means. This framework counts
almost 100 contributors and at least 50 people very skilled here. If I
get hit by a track any of them can take over by forking my branch as
allowed by the license.

The purpose of the foundation is to collect money for development and
advertising. Other organization like Rails have chose to create a
company instead of a foundation.

We have created a company (experts4solutions.com) whose purpose is to
promote skilled web2py professionals (and you can joins), foster
web2py projects, sell consulting and long term support contracts.

This was advertised here a few months ago. Some users have joined.

Massimo



On Dec 27, 9:46 pm, Pepe Araya pepea...@gmail.com wrote:
 Hi,

 some news about this topic?

 I think 2 things are going in favor of creating a foundation or [whatever]:
 1. the community has grown a lot.
 2. in all the reviews I read about web2py, always, always, ALWAYS!!! say it
 is a single-person framework and that takes away the future security of
 their development.

 kind regards

 Pepe


[web2py] Re: try web2py with cherrypy, diesel, eventlet, fapws,flup, gnuicorn, paste, rocket, tornado, twisted, wsgiref

2010-12-27 Thread mdipierro
Anyway... I have now try a few of these servers, specifically for
comet via HTML5 WebSocket. I am impressed by Tornado for both the ease
of use and performance.

http://thomas.pelletier.im/2010/08/websocket-tornado-redis/

Massimo



On Dec 28, 12:31 am, mdipierro mdipie...@cs.depaul.edu wrote:
 Look at the code. It is trivial to add it.

 On Dec 27, 8:00 pm, Bruno Rocha rochacbr...@gmail.com wrote:

  Just tried Cyclone -https://github.com/fiorix/cyclone-It is based on
   twisted then I thought that would run

  *cyclone*
  rochacbr...@macubuntu:~/projects/web2py$ python anyserver.py -s cyclone -p
  8081
  starting cyclone on 127.0.0.1:8081...
  Traceback (most recent call last):
    File anyserver.py, line 171, in module
      main()
    File anyserver.py, line 168, in main

   run(options.server,options.ip,options.port,logging=options.logging,profiler=options.profiler)
    File anyserver.py, line 129, in run
      getattr(Servers,servername)(application,(ip,int(port)))
  AttributeError: class Servers has no attribute 'cyclone'
  /*cyclone*

  --

  Bruno Rochahttp://about.me/rochacbruno/bio




[web2py] Not open source yet... but

2010-12-27 Thread mdipierro
http://vimeo.com/18232653


Re: [web2py] Re: cron quest

2010-12-27 Thread Manuele Pesenti

Il 27/12/2010 17:58, mdipierro ha scritto:

how do you start web2py?
that was my doubt... I just run web2py from it's path where I downloaded 
it. Is it correct?


thank you
bye
Manuele


[web2py] Re: cron quest

2010-12-27 Thread mdipierro
that is fine. Window, Mac, Linux? Which version? Which Python version?
What command do you use

python web2py.py

?

On Dec 28, 1:02 am, Manuele Pesenti manuele.pese...@gmail.com wrote:
 Il 27/12/2010 17:58, mdipierro ha scritto: how do you start web2py?

 that was my doubt... I just run web2py from it's path where I downloaded
 it. Is it correct?

 thank you
 bye
      Manuele


  1   2   >