Re: [web2py] Re: Discussion: Why is web2py bad for large deployments?

2010-11-15 Thread Johann Spies
On 15 November 2010 01:38, Thadeus Burgess thade...@thadeusb.com wrote:

 Doesn't work with code completion, and will be a maintenance nightmare!

 I spent weeks trying different code organisation patterns with web2py
 including what you mentioned, everything I attempted just caused more
 problems and made the code less maintainable.

 Like I keep saying, it all comes down to programmers preference. I started
 programming with Java, therefore I like object oriented programming that
 Flask+SQLAlchemy uses.


Do you use SQLAlchemy with web2py?  How?

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


Re: [web2py] Re: postgresql error ... class 'psycopg2.ProgrammingError'(relation auth_user already exists)

2010-11-15 Thread Johann Spies
On 13 November 2010 20:44, Carlos carlosgali...@gmail.com wrote:

 Hi Massimo,

 I did not delete anything when this problem appeared, I just switched
 from sqlite to postresql in the DAL.

 Should I worry about this problem appearing again (in my local machine
 or in a production environment)?.


I have seen this several times when I change definitions of tables using
Postgresql as backend.  What I normally do in such sitations is  to export
the database table to a csv-file through Web2py or if that is not possible
using either the commandline or PGAdminIII, drop the table and remove the
table's entry in web2py/applications/myapp/databases.

Web2py will then recreate the table and you can import the csv-file.  If the
latter was created with outside web2py, you will have to edit the column
headers before importing it.

I am not sure whether this is good practice but this has saved me some
frustrations.

Regards
Johann

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


Re: [web2py] Re: Discussion: Why is web2py bad for large deployments?

2010-11-15 Thread Branko Vukelic
On Mon, Nov 15, 2010 at 9:13 AM, Johann Spies johann.sp...@gmail.com wrote:
 Do you use SQLAlchemy with web2py?  How?

I think he meant Flask[1] + SQLAlchemy, not web2py + SQLAlchemy.

[1] http://flask.pocoo.org/


-- 
Branko Vukelić

bg.bra...@gmail.com
stu...@brankovukelic.com

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group


[web2py] Any WSGI experts on this list

2010-11-15 Thread Kenneth Lundström
I have a Centos server running web2py with mod_wsgi, apache, MySQL, 
MySQL-Python, python 2.6

As Centos uses python 2.4 I have installed 2.6 parallell with 2.4.

Then I have a new server where I´m trying to get everything to work but 
no luck sofar. First I thought everything was OK until I noticed I (or 
the server) was using Python 2.4, I installed mod_wsgi again to get it 
to use python 2.6.


Now I´m getting RuntimeError: global name 'MySQLdb' is not defined 
(tried 5 times)


If I try import MySQLdb in terminal it works both for python2.4 and 2.6.

I have read everything I could find about the subject on mailing lists 
archive, I tried everything listed in this discussion

http://groups.google.com/group/web2py/browse_thread/thread/344248aa2a8acc2b/dceda24846958053?lnk=gstq=+MySQLdb+is+not+defined+#dceda24846958053

Last thing I tested was to remove mod_wsgi that I had install via yum 
and tried to install it from source, no luck.



Kenneth




Re: [web2py] Re: Manipulate Rows Object and/or SQLTABLE

2010-11-15 Thread Ivan Matveev
The patch is in the text of this message:

patch to make Rows.setvirtualfields work with SQLTABLE

http://groups.google.com/group/web2py/browse_thread/thread/826a37f56c26d689/210036457d278cdc?lnk=gstq=patch+to+make+Rows.setvirtualfields+work+with+SQLTABLE#210036457d278cdc

or e-mailing patched sqlhtml.py to you is the right way?


[web2py] Re: web2py 1.89.1 is OUT

2010-11-15 Thread villas
@Massimo

Yes that is what I expected too.  This is how I tested it:

In the Welcome app, add this to the bottom of db.py

db.define_table('mytable',
Field('myfield1','string'),
Field('myfield2','string'),
Field('mytime','time'),
Field('myfield3','string'),
)

Now go to insert a record in Appadmin.  Use the tab key to navigate
the fields.  I cannot exit the time field with the tab key.  Maybe I'm
missing something?

-D

On Nov 15, 5:26 am, mdipierro mdipie...@cs.depaul.edu wrote:
 I modified this... not sure if this is what you asked or not.

 In my version [tab] moves you to the next INPUT and [shift]+[tab]
 moves you back. To move across HH:MM:SS fields you have to use arrow
 keys.

 Massimo

 On Nov 14, 7:59 pm, villas villa...@gmail.com wrote:

  Hi Massimo

  Thanks for addressing this.

  Interesting that you removed the spinner altogether, I got a feeling
  from this thread that many users wanted to use the mouse almost
  exclusively for picking the time. Anyway that decision is fine with
  me.

  I only have one issue so far, that is tabbing out of the field. For
  usability, it is very important we can tab through the whole form.

  -D




[web2py] French Speakers Group

2010-11-15 Thread lannick
Hi,

Is it possible to create a French Speakers group ?

The main purpose of this group will be to work on the translation of
Web2py.

Regards,
Lannick


[web2py] Re: French Speakers Group

2010-11-15 Thread DenesL

Of course!, you can create the group and tell the world about it.
Remember to add Massimo as a manager.


On Nov 15, 7:47 am, lannick abou...@gmail.com wrote:
 Hi,

 Is it possible to create a French Speakers group ?

 The main purpose of this group will be to work on the translation of
 Web2py.

 Regards,
 Lannick


[web2py] Re: Manipulate Rows Object and/or SQLTABLE

2010-11-15 Thread Martin.Mulone
If it's for small things you can use:

http://groups.google.com/group/web2py/browse_thread/thread/1a1d52d29611564d/3ef8ca27ecfcea58?lnk=gstq=table+div#3ef8ca27ecfcea58



On Nov 9, 2:36 pm, villas villa...@gmail.com wrote:
 I want to customize the result of SQLTABLE so that it can make me a
 nice table without lines and lines of code in my view file.  To
 achieve that,  I need for example to:

 1) Add columns to hold icons and links and extra stuff.
 2) Customize the rows, e.g.  links which depend on content,  different
 icons etc

 After giving it some thought,  I think I should leave SQLTABLE alone
 and concentrate on 'improving' the rows object so that it contains
 everything I want before passing it to SQLTABLE.

 To do 1) I can simply add a column to the rows object. How can I best
 do that?
 To do 2) I could iterate the rows object and make changes.

 Or  maybe there is another way.
 I appreciate that if I want to style the HTML table,  I'll have to
 write my code in the form (which I am trying to avoid).

 Thanks,
 -D


Re: [web2py] French Speakers Group

2010-11-15 Thread rochacbruno
Groups are created voluntary by the community. 

If somebody create a new group wherever. Just have to report the link to 
Massimo to be included in /usergroups page. 

Is it important to create a google group  because the mainsite just has the 
ability to fetch rss on google. 

Or, somebody have to patch feeds_reader.py on examples app. Including the 
reader for Yahoo or another kind of group. 

Are you french? So if the group does not exists yet. Create this and send the 
link. 

The idea is to translate the main website too. 


Enviado via iPhone

Em 15/11/2010, às 10:47, lannick abou...@gmail.com escreveu:

 Hi,
 
 Is it possible to create a French Speakers group ?
 
 The main purpose of this group will be to work on the translation of
 Web2py.
 
 Regards,
 Lannick


[web2py] Re: postgresql error ... class 'psycopg2.ProgrammingError'(relation auth_user already exists)

2010-11-15 Thread Carlos
Thanks Johann for confirming this problem.

Massimo, is there another easier/faster/better way to solve this in a
production environment?.

Thanks,

   Carlos


On Nov 15, 2:57 am, Johann Spies johann.sp...@gmail.com wrote:
 On 13 November 2010 20:44, Carlos carlosgali...@gmail.com wrote:

  Hi Massimo,

  I did not delete anything when this problem appeared, I just switched
  from sqlite to postresql in the DAL.

  Should I worry about this problem appearing again (in my local machine
  or in a production environment)?.

 I have seen this several times when I change definitions of tables using
 Postgresql as backend.  What I normally do in such sitations is  to export
 the database table to a csv-file through Web2py or if that is not possible
 using either the commandline or PGAdminIII, drop the table and remove the
 table's entry in web2py/applications/myapp/databases.

 Web2py will then recreate the table and you can import the csv-file.  If the
 latter was created with outside web2py, you will have to edit the column
 headers before importing it.

 I am not sure whether this is good practice but this has saved me some
 frustrations.

 Regards
 Johann

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


[web2py] Re: databases folder not created in shell

2010-11-15 Thread DenesL

I believe that patch should go in shell.py too.



On Nov 15, 12:32 am, mdipierro mdipie...@cs.depaul.edu wrote:
 fixed in trunk

 On Nov 14, 8:13 pm, DenesL denes1...@yahoo.ca wrote:

  ^bump^




[web2py] Re: Manipulate Rows Object and/or SQLTABLE

2010-11-15 Thread villas
@Martin - I like that!

I think the ability to add rows and columns in an obvious way is
something that has been missing.  SQLTABLE needs this feature for
quick 'views'.

However, for DB rows, I think Mr Freeze's Webgrid might be the right
vehicle for further development mainly because we really need the
pagination and set-up options.

I like the idea of using jqGrid,  but it just seems a bit too
complex.  We need things which 'just work' as part of the framework.

Thanks,
-D


On Nov 15, 1:23 pm, Martin.Mulone mulone.mar...@gmail.com wrote:
 If it's for small things you can use:

 http://groups.google.com/group/web2py/browse_thread/thread/1a1d52d296...

 On Nov 9, 2:36 pm, villas villa...@gmail.com wrote:

  I want to customize the result of SQLTABLE so that it can make me a
  nice table without lines and lines of code in my view file.  To
  achieve that,  I need for example to:

  1) Add columns to hold icons and links and extra stuff.
  2) Customize the rows, e.g.  links which depend on content,  different
  icons etc

  After giving it some thought,  I think I should leave SQLTABLE alone
  and concentrate on 'improving' the rows object so that it contains
  everything I want before passing it to SQLTABLE.

  To do 1) I can simply add a column to the rows object. How can I best
  do that?
  To do 2) I could iterate the rows object and make changes.

  Or  maybe there is another way.
  I appreciate that if I want to style the HTML table,  I'll have to
  write my code in the form (which I am trying to avoid).

  Thanks,
  -D




[web2py] Re: db.export_to_csv_file(file) failing on Windows?

2010-11-15 Thread mdipierro
This is the correct syntax.

db.export_to_csv_file(open('somefile.csv', 'wb'))

the problem is that db.does not see the models. Are you using?

python -S app -M -N -R yourscript.py

On Nov 15, 12:39 am, mart msenecal...@gmail.com wrote:
 Hi,

 Since connecting remotely is an issue for now, I went to the server
 hosting the MSSQL DB.

 I am cinnecting fine (to localhost), but this cmd :

 db.export_to_csv_file('quickbuild.csv')

 is getting this error:

   File C:\Documents and Settings\buildmonkey\Desktop\blue_framework
 copy\src\mssql_test.py, line 33, in main
     db.export_to_csv_file('quickbuild.csv')
 ...
 dal.py, line 2193, in export_to_csv_file
     ofile.write('END')
 AttributeError: 'str' object has no attribute 'write'

 I did not get an error when doing verbatim what the book says:

 db.export_to_csv_file(open('somefile.csv', 'wb'))

 but this only yielded one word in the target file, 'END'

 Any idea what I should be looking at?

 Thanks,
 Mart :)


[web2py] Re: web2py 1.89.1 is OUT

2010-11-15 Thread mdipierro
which browser? this works for me with FF on Mac.

On Nov 15, 6:26 am, villas villa...@gmail.com wrote:
 @Massimo

 Yes that is what I expected too.  This is how I tested it:

 In the Welcome app, add this to the bottom of db.py

 db.define_table('mytable',
     Field('myfield1','string'),
     Field('myfield2','string'),
     Field('mytime','time'),
     Field('myfield3','string'),
     )

 Now go to insert a record in Appadmin.  Use the tab key to navigate
 the fields.  I cannot exit the time field with the tab key.  Maybe I'm
 missing something?

 -D

 On Nov 15, 5:26 am, mdipierro mdipie...@cs.depaul.edu wrote:

  I modified this... not sure if this is what you asked or not.

  In my version [tab] moves you to the next INPUT and [shift]+[tab]
  moves you back. To move across HH:MM:SS fields you have to use arrow
  keys.

  Massimo

  On Nov 14, 7:59 pm, villas villa...@gmail.com wrote:

   Hi Massimo

   Thanks for addressing this.

   Interesting that you removed the spinner altogether, I got a feeling
   from this thread that many users wanted to use the mouse almost
   exclusively for picking the time. Anyway that decision is fine with
   me.

   I only have one issue so far, that is tabbing out of the field. For
   usability, it is very important we can tab through the whole form.

   -D




[web2py] Re: postgresql error ... class 'psycopg2.ProgrammingError'(relation auth_user already exists)

2010-11-15 Thread mdipierro
 I have seen this several times when I change definitions of tables using
 Postgresql as backend.

this very much confuses web2py which keeps its own metadata about what
is in the db.

On Nov 15, 2:57 am, Johann Spies johann.sp...@gmail.com wrote:
 On 13 November 2010 20:44, Carlos carlosgali...@gmail.com wrote:

  Hi Massimo,

  I did not delete anything when this problem appeared, I just switched
  from sqlite to postresql in the DAL.

  Should I worry about this problem appearing again (in my local machine
  or in a production environment)?.

 I have seen this several times when I change definitions of tables using
 Postgresql as backend.  What I normally do in such sitations is  to export
 the database table to a csv-file through Web2py or if that is not possible
 using either the commandline or PGAdminIII, drop the table and remove the
 table's entry in web2py/applications/myapp/databases.

 Web2py will then recreate the table and you can import the csv-file.  If the
 latter was created with outside web2py, you will have to edit the column
 headers before importing it.

 I am not sure whether this is good practice but this has saved me some
 frustrations.

 Regards
 Johann

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


[web2py] Re: databases folder not created in shell

2010-11-15 Thread mdipierro
shell calls app_create which not has the problem fixed. Is it not? Can
you provide a test case?

On Nov 15, 9:05 am, DenesL denes1...@yahoo.ca wrote:
 I believe that patch should go in shell.py too.

 On Nov 15, 12:32 am, mdipierro mdipie...@cs.depaul.edu wrote:

  fixed in trunk

  On Nov 14, 8:13 pm, DenesL denes1...@yahoo.ca wrote:

   ^bump^




[web2py] Re: web2py 1.89.1 is OUT

2010-11-15 Thread villas
FF 3.6.12 on Windows


On Nov 15, 3:16 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 which browser? this works for me with FF on Mac.

 On Nov 15, 6:26 am, villas villa...@gmail.com wrote:

  @Massimo

  Yes that is what I expected too.  This is how I tested it:

  In the Welcome app, add this to the bottom of db.py

  db.define_table('mytable',
      Field('myfield1','string'),
      Field('myfield2','string'),
      Field('mytime','time'),
      Field('myfield3','string'),
      )

  Now go to insert a record in Appadmin.  Use the tab key to navigate
  the fields.  I cannot exit the time field with the tab key.  Maybe I'm
  missing something?

  -D

  On Nov 15, 5:26 am, mdipierro mdipie...@cs.depaul.edu wrote:

   I modified this... not sure if this is what you asked or not.

   In my version [tab] moves you to the next INPUT and [shift]+[tab]
   moves you back. To move across HH:MM:SS fields you have to use arrow
   keys.

   Massimo

   On Nov 14, 7:59 pm, villas villa...@gmail.com wrote:

Hi Massimo

Thanks for addressing this.

Interesting that you removed the spinner altogether, I got a feeling
from this thread that many users wanted to use the mouse almost
exclusively for picking the time. Anyway that decision is fine with
me.

I only have one issue so far, that is tabbing out of the field. For
usability, it is very important we can tab through the whole form.

-D




[web2py] Create TRs dinamically in a FORM

2010-11-15 Thread CesarBustios
Hi! I want to create a FORM using TABLE but i need to create TR's
depending of the number of Rows in a query, for example if the query
returned 3 rows i need something like:

FORM(TABLE(
 TR(..)
 TR(..)
 TR(..)
))

I want to do this dinamically... Any thoughts?

Thanks!


Re: [web2py] Re: The primary key constraint on legacy tables

2010-11-15 Thread Ivan Matveev
Perhaps my statement is wrong.
DAL works fine with keyed tables.
When I started to make web2py interface to a legacy database I tried
keyed tables because many tables in the db have composite primary
keys. I kept bumping in documentation examples that describe how to do
things with normal id tables which will not work with keyed ones.
Don't  remember exactly what were the problems. Its been a while since
I realized I don't have to use all fields that are defined as a
primary key in a legacy db SQL schema. If there is a unique int field
I can

db.define_table('mytable', Field('unique_int_column', 'id', migrate=False)

and have all the web2py magic.

If there is no unique int field it can be added to a table with SQL
and this will not affect legacy software that uses the db.


Re: [web2py] Create TRs dinamically in a FORM

2010-11-15 Thread Kenneth Lundström

Doesn´t SQLFORM do this automatically?

One other way to do this would be like this.

In controller:
rows = db(db.data_table.id  0).select()
return dict(rows=rows)

In view:
form
table
{{for row in rows:}}
trtdrow.id/tdtdrow.data/td/tr
{{pass}}
/table
/form


Kenneth


Hi! I want to create a FORM using TABLE but i need to create TR's

depending of the number of Rows in a query, for example if the query
returned 3 rows i need something like:

FORM(TABLE(
  TR(..)
  TR(..)
  TR(..)
))

I want to do this dinamically... Any thoughts?

Thanks!




[web2py] Re: web2py 1.89.1 is OUT

2010-11-15 Thread mdipierro
I think I fixed it in trunk. Can you try?

On Nov 15, 9:16 am, mdipierro mdipie...@cs.depaul.edu wrote:
 which browser? this works for me with FF on Mac.

 On Nov 15, 6:26 am, villas villa...@gmail.com wrote:

  @Massimo

  Yes that is what I expected too.  This is how I tested it:

  In the Welcome app, add this to the bottom of db.py

  db.define_table('mytable',
      Field('myfield1','string'),
      Field('myfield2','string'),
      Field('mytime','time'),
      Field('myfield3','string'),
      )

  Now go to insert a record in Appadmin.  Use the tab key to navigate
  the fields.  I cannot exit the time field with the tab key.  Maybe I'm
  missing something?

  -D

  On Nov 15, 5:26 am, mdipierro mdipie...@cs.depaul.edu wrote:

   I modified this... not sure if this is what you asked or not.

   In my version [tab] moves you to the next INPUT and [shift]+[tab]
   moves you back. To move across HH:MM:SS fields you have to use arrow
   keys.

   Massimo

   On Nov 14, 7:59 pm, villas villa...@gmail.com wrote:

Hi Massimo

Thanks for addressing this.

Interesting that you removed the spinner altogether, I got a feeling
from this thread that many users wanted to use the mouse almost
exclusively for picking the time. Anyway that decision is fine with
me.

I only have one issue so far, that is tabbing out of the field. For
usability, it is very important we can tab through the whole form.

-D




[web2py] Re: databases folder not created in shell

2010-11-15 Thread DenesL

When the app is being created from the shell.
See shell.py line 159.

The patch would be almost identical to the admin.py one except for
subpath =  os.path.join(path,subfolder)

which in shell.py should read
subpath =  os.path.join(adir,subfolder)



On Nov 15, 10:19 am, mdipierro mdipie...@cs.depaul.edu wrote:
 shell calls app_create which not has the problem fixed. Is it not? Can
 you provide a test case?

 On Nov 15, 9:05 am, DenesL denes1...@yahoo.ca wrote:

  I believe that patch should go in shell.py too.

  On Nov 15, 12:32 am, mdipierro mdipie...@cs.depaul.edu wrote:

   fixed in trunk

   On Nov 14, 8:13 pm, DenesL denes1...@yahoo.ca wrote:

^bump^




[web2py] Re: web2py 1.89.1 is OUT

2010-11-15 Thread villas
BTW  I prefer the normal TimeEntry behaviour:

Tab into time field with hours selected
Tab again into mins
Tab again into secs
Tab again to exit field

This is very accessible and logical - no one needs extra training to
use the Tab key.




On Nov 15, 3:42 pm, villas villa...@gmail.com wrote:
 FF 3.6.12 on Windows

 On Nov 15, 3:16 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  which browser? this works for me with FF on Mac.

  On Nov 15, 6:26 am, villas villa...@gmail.com wrote:

   @Massimo

   Yes that is what I expected too.  This is how I tested it:

   In the Welcome app, add this to the bottom of db.py

   db.define_table('mytable',
       Field('myfield1','string'),
       Field('myfield2','string'),
       Field('mytime','time'),
       Field('myfield3','string'),
       )

   Now go to insert a record in Appadmin.  Use the tab key to navigate
   the fields.  I cannot exit the time field with the tab key.  Maybe I'm
   missing something?

   -D

   On Nov 15, 5:26 am, mdipierro mdipie...@cs.depaul.edu wrote:

I modified this... not sure if this is what you asked or not.

In my version [tab] moves you to the next INPUT and [shift]+[tab]
moves you back. To move across HH:MM:SS fields you have to use arrow
keys.

Massimo

On Nov 14, 7:59 pm, villas villa...@gmail.com wrote:

 Hi Massimo

 Thanks for addressing this.

 Interesting that you removed the spinner altogether, I got a feeling
 from this thread that many users wanted to use the mouse almost
 exclusively for picking the time. Anyway that decision is fine with
 me.

 I only have one issue so far, that is tabbing out of the field. For
 usability, it is very important we can tab through the whole form.

 -D




[web2py] gluon/contrib/login_methods/linkedin_account.py - anyone deployed this?

2010-11-15 Thread Carl
Has anyone got gluon/contrib/login_methods/linked_account.py working?

I've built directly upon /gluon/contrib/login_methods/
oauth10a_account.py with my own specific LinkedIn code but having
found http://code.google.com/p/python-linkedin/ I wanted to use this
to avoid reinventing the wheel (Özgür Vatansever's linkedin.py looks
clean and has broad support for LinkedIn's API).

But, linkedin.py doesn't look finished; for example:
(from web2py 1.89.1)

Line 43.
result = self.request.vars.verifier

The vars variable sets 'oauth_verifier' on returning from the LinkedIn
website but not 'verifier'.

Anyone tread this path?





[web2py] Re: databases folder not created in shell

2010-11-15 Thread mdipierro
done, although it would be better if shell were to call app_create
from admin.py

On Nov 15, 10:21 am, DenesL denes1...@yahoo.ca wrote:
 When the app is being created from the shell.
 See shell.py line 159.

 The patch would be almost identical to the admin.py one except for
 subpath =  os.path.join(path,subfolder)

 which in shell.py should read
 subpath =  os.path.join(adir,subfolder)

 On Nov 15, 10:19 am, mdipierro mdipie...@cs.depaul.edu wrote:

  shell calls app_create which not has the problem fixed. Is it not? Can
  you provide a test case?

  On Nov 15, 9:05 am, DenesL denes1...@yahoo.ca wrote:

   I believe that patch should go in shell.py too.

   On Nov 15, 12:32 am, mdipierro mdipie...@cs.depaul.edu wrote:

fixed in trunk

On Nov 14, 8:13 pm, DenesL denes1...@yahoo.ca wrote:

 ^bump^




[web2py] Re: web2py 1.89.1 is OUT

2010-11-15 Thread villas
 I think I fixed it in trunk. Can you try?

Yep, that's it!

Thks,  D


[web2py] Re: Create TRs dinamically in a FORM

2010-11-15 Thread villas
I believe you need 'list comprehensions'.
I am not good at this myself, but you might like to try something like
this to get you going...

TABLE(*[TR(row.as_dict().values()) for row in rows])

This may not be the best way!
Please let me know whether it works or if you find a better idea.

-D


Re: [web2py] Re: Manipulate Rows Object and/or SQLTABLE

2010-11-15 Thread Ivan Matveev
Sorry for posting what I'v already posted, but it looks like my post
on the patch to make SQLTABLE work with Rows object with added virtual
fields was lost.

I think the easiest solution to add a column to select result and view
the result in SQLTABLE wold be something like:

class ExtraFields:
def new_column(self):
if self.some_field_in_select==' something':
return A('some_action_link', _href=URL(
f=some_action_controller_function,
args=[self.id]))
else:
return A('great thing', _href='http://www.web2py.com')

rows=db(db.some_table).select()
rows.setvirtualfields(some_table=ExtraFields())
rows.colnames.append('some_table.new_column')
table=SQLTABLE(rows)

This will give an exception telling that

sqlhtml.py:SQLTABLE.__init__

can't do

field = sqlrows.db[tablename][fieldname]

because there is no 'new_column' in the database.
It wants to get the field from the db model to know how to render it.
This doesn't matter when we add a new field to select result
because the new field shell(and will by a view) be cast to string.

The patch:
change
  sqlhtml.py:SQLTABLE.__init__
field = sqlrows.db[tablename][fieldname]
to
try:
 field = sqlrows.db[tablename][fieldname]
except:
 field = None

change
  sqlhtml.py:SQLTABLE.__init__
   if field.represent:
   r = field.represent(r)
to
  if not field:
  pass
  elif field.represent:
  r = field.represent(r)

---Now we are able to include a new field in SQLTABLE
containing anything(text,  link, image, button, form, whatever)
depending on row contents(in ExtraFields.new_column(self): 'self' is a single
  Row in Rows object returned by select) ,
by adding the field to db().select() result.

---Limitation:
in

rows.colnames.append('some_table.new_column')
rows.setvirtualfields(some_table=ExtraField())

'some_table' shell be a table mentioned in select and present in
the db,
 otherwise
'some_table' will be added as a sub dict to Row objects
and you will not see it in SQLTABLE.


[web2py] Re: Create TRs dinamically in a FORM

2010-11-15 Thread Ivan Matveev
Maybe WebGrid(http://web2pyslices.com/main/slices/take_slice/39) can
help you? I didn't use it but it says that it lets you build a table
that supports paging, sorting, editing and totals easily.

Or you can put forms in a SQLTABLE column. How to add columns to
SQLTABLE is being discussed in tread:

Manipulate Rows Object and/or SQLTABLE

http://groups.google.com/group/web2py/browse_thread/thread/87596d39a4e46c1b/01e764e9db39455b?lnk=gstq=row+object#01e764e9db39455b



[web2py] Re: Create TRs dinamically in a FORM

2010-11-15 Thread CesarBustios
Wow thanks guys, iĺl try and let you know :)

On 15 nov, 12:39, Ivan Matveev imatvee...@gmail.com wrote:
 Maybe WebGrid(http://web2pyslices.com/main/slices/take_slice/39) can
 help you? I didn't use it but it says that it lets you build a table
 that supports paging, sorting, editing and totals easily.

 Or you can put forms in a SQLTABLE column. How to add columns to
 SQLTABLE is being discussed in tread:

 Manipulate Rows Object and/or SQLTABLE

 http://groups.google.com/group/web2py/browse_thread/thread/87596d39a4...


[web2py] Re: Create TRs dinamically in a FORM

2010-11-15 Thread mdipierro
You can also do

def index():
fields=['a','b','c']
form=SQLFORM.factory(*[Field(name) for name in fields]))
if form.accepts(request):
response.flash=str([form.vars[name] for name in fields])
return dict(form=form)


On Nov 15, 11:46 am, CesarBustios cesarbust...@gmail.com wrote:
 Wow thanks guys, iĺl try and let you know :)

 On 15 nov, 12:39, Ivan Matveev imatvee...@gmail.com wrote:

  Maybe WebGrid(http://web2pyslices.com/main/slices/take_slice/39) can
  help you? I didn't use it but it says that it lets you build a table
  that supports paging, sorting, editing and totals easily.

  Or you can put forms in a SQLTABLE column. How to add columns to
  SQLTABLE is being discussed in tread:

  Manipulate Rows Object and/or SQLTABLE

 http://groups.google.com/group/web2py/browse_thread/thread/87596d39a4...




[web2py] 1.89.1 layout

2010-11-15 Thread ron_m
In the application I am writing there are IP video cameras displayed
in a grid for one part of the application. In non-IE browsers this is
realized as an IMG tag connected to the MJPEG video stream of the
camera using the src= attribute.

In the 1.88.2 version I used a padding: 1px; style to put a fine line
between images letting the background show through which was perfect
to get some separation.

In 1.89.1 there is a 4 to 6 pixel vertical separation between rows of
images. If I adjust the padding or the margin the spacing grows by
that amount. The same 1px padding still works fine for the space
between horizontally adjacent images. To try to identify the source of
the change I renamed all the style sheets in the application including
the web2py ones and then cleared the browser cache and I still get the
spacing between rows. If I load in the 1.88.2 version I don't get the
spacing.

Maybe it is something in layout.html? If anyone has a quick, I know
what that is, please let me know, I have looked at this for quite a
while and can't find it but will push onwards. I hope my slowness in
discovery is not an indication of my ability with CSS. :-)

I could stay with the old layout but since it is still under
development I would rather keep moving with the new version and all
the good things that come with them.

Thanks

Ron


[web2py] Re: Create TRs dinamically in a FORM

2010-11-15 Thread CesarBustios
Ok, i did this (Kennnet way):

form enctype=multipart/form-data action=activar method=post
  table style=text-align: center; width: 100%; border=0
cellpadding=0 cellspacing=0
{{for imagen in imagenes:}}
tr 
td width=10%input type=radio name=
value={{=imagen.id}}/td
td align=left
img src={{=URL(request.application,
f='download', args=imagen.archivo)}} width=40%/
/td
/tr
{{pass}}
tr
td/td
td align=centerbr/input value=Empezar a
enviar type=submit //td
/tr
  /table
/form

So what should i use in my controller instead of form.accepts?


On 15 nov, 12:51, mdipierro mdipie...@cs.depaul.edu wrote:
 You can also do

 def index():
     fields=['a','b','c']
     form=SQLFORM.factory(*[Field(name) for name in fields]))
     if form.accepts(request):
         response.flash=str([form.vars[name] for name in fields])
     return dict(form=form)

 On Nov 15, 11:46 am, CesarBustios cesarbust...@gmail.com wrote:







  Wow thanks guys, iĺl try and let you know :)

  On 15 nov, 12:39, Ivan Matveev imatvee...@gmail.com wrote:

   Maybe WebGrid(http://web2pyslices.com/main/slices/take_slice/39) can
   help you? I didn't use it but it says that it lets you build a table
   that supports paging, sorting, editing and totals easily.

   Or you can put forms in a SQLTABLE column. How to add columns to
   SQLTABLE is being discussed in tread:

   Manipulate Rows Object and/or SQLTABLE

  http://groups.google.com/group/web2py/browse_thread/thread/87596d39a4...


[web2py] Validate dynamically generated select SQLFORM.factory

2010-11-15 Thread Lorin Rivers
Thanks for all the help so far. I have made tons of progress on my app, and now 
I'm trying to add a little polish.

I have this code:

  # Loops through the MAC Addresses and puts them in a list
  # MAC Addresses is from a prior query
  options=[str(my_macaddr[i].MacAddr) for i in range(len(my_macaddr))]
  
  #creates the form for choosing which Optimizers, from which time frame
  
form=SQLFORM.factory(Field('Optimizers',requires=IS_IN_SET(options,multiple='multiple')))
  
My app throws an error if you click the submit button without selecting an item 
from the list in the form.

I have tried adding 'zero=T('Choose one')', both with and without adding the 
string 'Choose one' to the list 'options'. What would the best way to validate 
this be?



-- 
Lorin Rivers
Mosasaur: Killer Technical Marketing http://www.mosasaur.com
mailto:lriv...@mosasaur.com
512/203.3198 (m)




[web2py] Re: Unable to edit language files

2010-11-15 Thread pierreth
On Nov 15, 12:19 am, mdipierro mdipie...@cs.depaul.edu wrote:
 On Nov 14, 7:00 pm, pierreth pierre.thibau...@gmail.com wrote:

  Hello,

  I've tried to edit my language files but my changes are all the time
  overwritten.

 Do you use windows? If so, do you Mark hammond win32 extesions


No. OpenSuse 11.3.



  When I use the web interface of web2py to edit these files, some
  fields are in yellow. What is the meaning of this?

 It means the translation is the same as the original so probably they
 were not translated.

  How should I edit these files to have permanent changes?

 There is a button at the end. When you save them they should be
 permanent. Can you help isolate what causes them to be overwritten. I
 cannot reproduce it.

May it is my code. Here I have some code manipulating the translator:

def translate(word, language, T):

Force the translation of word in language.
Restore the state of T before returning.
@param word: Word or text translate.
@param language: The language used by the translator.
@param T: The usual T translator.
@return: The text translated in the requested language.

accepted_language = T.accepted_language
language_file = T.language_file
lazy = T.lazy
try:
if language == None:
language = en
T.force(language)
T.lazy = False
return T(word)
finally:
T.accepted_language = accepted_language
T.language_file = language_file
T.lazy = lazy

def translate_fallback(word, T, fallback=None):

Try to do a translation like T(word) and fall back on a fall back
language if it does not work.
Restore the state of T before returning.
@param word: Word or text translate.
@param T: The usual T translator.
@param fallback: The fall back language to used if the translation
fail.
If None, T.current_languages will be used.
@return: The text translated.

current_languages = T.current_languages
try:
T.set_current_languages(None)
result = str(T(word))
if result == word:
T.force(fallback or current_languages)
result = str(T(word))
return result
finally:
T.set_current_languages(current_languages)

Could this be the problem?


Re: [web2py] problem whith admin

2010-11-15 Thread Emanuel Woiski
Hello
I had the same problem, same message, when trying Instant Press (I have
filled issue 12 there)!
regards
woiski

2010/11/10 Jose jjac...@gmail.com


 I have to edit some applications problems with the new admin. With
 some works without problems. In other gives the following error:

 Traceback (most recent call last):
  File /usr/home/jose/web2py/gluon/restricted.py, line 188, in
 restricted
exec ccode in environment
  File /usr/home/jose/web2py/applications/admin/views/default/
 design.html, line 290, in module
/div
 IndexError: list index out of range

 Jose


[web2py] Re: problem whith admin

2010-11-15 Thread mdipierro
where is the offending line in design.html?

On Nov 15, 1:47 pm, Branko Vukelic bg.bra...@gmail.com wrote:
 Probably a missing {{if something}} somewhere. Maybe {{for}} in
 templates could be wrapped in an implicit if block. Like when you say:

 {{ for something in other}}
    blah blah
 {{pass}}

 could translate to:

 if other:
     for something in other:
         blah blah

 Would that be too much work, Massimo?



 On Mon, Nov 15, 2010 at 7:52 PM, Emanuel Woiski woi...@gmail.com wrote:
  Hello
  I had the same problem, same message, when trying Instant Press (I have
  filled issue 12 there)!
  regards
  woiski

  2010/11/10 Jose jjac...@gmail.com

  I have to edit some applications problems with the new admin. With
  some works without problems. In other gives the following error:

  Traceback (most recent call last):
   File /usr/home/jose/web2py/gluon/restricted.py, line 188, in
  restricted
     exec ccode in environment
   File /usr/home/jose/web2py/applications/admin/views/default/
  design.html, line 290, in module
     /div
  IndexError: list index out of range

  Jose

 --
 Branko Vukelić

 bg.bra...@gmail.com
 stu...@brankovukelic.com

 Check out my blog:http://www.brankovukelic.com/
 Check out my portfolio:http://www.flickr.com/photos/foxbunny/
 Registered Linux user #438078 (http://counter.li.org/)
 I hang out on identi.ca:http://identi.ca/foxbunny

 Gimp Brushmakers Guildhttp://bit.ly/gbg-group


Re: [web2py] Re: problem whith admin

2010-11-15 Thread Branko Vukelic
On Mon, Nov 15, 2010 at 8:59 PM, mdipierro mdipie...@cs.depaul.edu wrote:
 where is the offending line in design.html?

I think it's in this block:

h3 id=plugins onclick=collapse('plugins_inner'); class=component
  {{=T(Plugins)}}
  span class=tooltip{{=helpicon()}} span{{=T(To create a
plugin, name a file/folder plugin_[name])}}/span/span
/h3
div id=plugins_inner class=component_contents
  div class=controls comptools
{{=button(PLUGINS_APP, T('download plugins'))}}
  /div
  div class=controls
  /div
  {{if plugins:}}
  ul
  {{for plugin in plugins:}}
  li
  {{=A('plugin_%s' % plugin, _class='file', _href=URL('plugin',
args=[app, plugin]))}}
  /li
  {{pass}}
  /ul
  {{else:}}
  pstrong{{=T('There are no plugins')}}/strong/p
  {{pass}}
  div class=controls formfield{{=upload_plugin_form(app)}}/div
/div-- line 290

-- 
Branko Vukelić

bg.bra...@gmail.com
stu...@brankovukelic.com

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group


[web2py] Re: Create TRs dinamically in a FORM

2010-11-15 Thread CesarBustios
Nevermind, list comprehensions worked for me!!!

Thank you all :)

On 15 nov, 13:23, CesarBustios cesarbust...@gmail.com wrote:
 Ok, i did this (Kennnet way):

 form enctype=multipart/form-data action=activar method=post
           table style=text-align: center; width: 100%; border=0
 cellpadding=0 cellspacing=0
             {{for imagen in imagenes:}}
                 tr 
                     td width=10%input type=radio name=
 value={{=imagen.id}}/td
                     td align=left
                         img src={{=URL(request.application,
 f='download', args=imagen.archivo)}} width=40%/
                     /td
                 /tr
             {{pass}}
             tr
                 td/td
                 td align=centerbr/input value=Empezar a
 enviar type=submit //td
             /tr
           /table
         /form

 So what should i use in my controller instead of form.accepts?

 On 15 nov, 12:51, mdipierro mdipie...@cs.depaul.edu wrote:







  You can also do

  def index():
      fields=['a','b','c']
      form=SQLFORM.factory(*[Field(name) for name in fields]))
      if form.accepts(request):
          response.flash=str([form.vars[name] for name in fields])
      return dict(form=form)

  On Nov 15, 11:46 am, CesarBustios cesarbust...@gmail.com wrote:

   Wow thanks guys, iĺl try and let you know :)

   On 15 nov, 12:39, Ivan Matveev imatvee...@gmail.com wrote:

Maybe WebGrid(http://web2pyslices.com/main/slices/take_slice/39) can
help you? I didn't use it but it says that it lets you build a table
that supports paging, sorting, editing and totals easily.

Or you can put forms in a SQLTABLE column. How to add columns to
SQLTABLE is being discussed in tread:

Manipulate Rows Object and/or SQLTABLE

   http://groups.google.com/group/web2py/browse_thread/thread/87596d39a4...


Re: [web2py] Re: Stick web2py to one CPU?

2010-11-15 Thread David Zejda
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



mdipierro wrote:
 yes.
 
 On Nov 14, 5:50 pm, David Zejda d...@atlas.cz wrote:
 What do you think, would it be good idea to attach web2py process to one
 CPU core to avoid overhead related to switching between cores?
 
 Ryan Kelly writes: I just halved the running time of one of my test
 
 suites.
 
 http://www.rfk.id.au/blog/entry/a-gil-adventure-threading2
 
 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

iEYEARECAAYFAkzhlrgACgkQ3oCkkciamVHogwCgq0hAyEYfUZo+xCO3fmuyNY/g
MVgAn0/E7Y4DzMBWg/Bt0QSNbsryCUtB
=QoR3
-END PGP SIGNATURE-


Re: [web2py] Re: Stick web2py to one CPU?

2010-11-15 Thread David Zejda
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Well.. thanks for a very straightforward answer :)

Will you apply this in a next web2py version? Or is it better to leave
it on each web2py user?

David

mdipierro wrote:
 yes.
 
 On Nov 14, 5:50 pm, David Zejda d...@atlas.cz wrote:
 What do you think, would it be good idea to attach web2py process to one
 CPU core to avoid overhead related to switching between cores?
 
 Ryan Kelly writes: I just halved the running time of one of my test
 
 suites.
 
 http://www.rfk.id.au/blog/entry/a-gil-adventure-threading2
 
 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

iEYEARECAAYFAkzhl5IACgkQ3oCkkciamVH7hgCfXQPeQpbsP912HC4t9txpvo4j
4ZMAn3aouJoMV/sE0+Jg51Ddavlfd03Q
=FEdt
-END PGP SIGNATURE-


[web2py] ajax push

2010-11-15 Thread Michele Comitini
Does anyone use this with web2py?

http://www.ape-project.org/ajax-push.html

seems interesting!

mic


[web2py] Re: 1.89.1 layout

2010-11-15 Thread villas
Hi Ron

I hate tracking down CSS problems too.  It is good to use some tools
for this.

I often find Firebug on Firefox is good because you can alter the
settings at the same time as viewing the form.

Maybe if others use good tools for CSS,  they could also recommend
them to you.

-D

On Nov 15, 6:11 pm, ron_m ron.mco...@gmail.com wrote:
 In the application I am writing there are IP video cameras displayed
 in a grid for one part of the application. In non-IE browsers this is
 realized as an IMG tag connected to the MJPEG video stream of the
 camera using the src= attribute.

 In the 1.88.2 version I used a padding: 1px; style to put a fine line
 between images letting the background show through which was perfect
 to get some separation.

 In 1.89.1 there is a 4 to 6 pixel vertical separation between rows of
 images. If I adjust the padding or the margin the spacing grows by
 that amount. The same 1px padding still works fine for the space
 between horizontally adjacent images. To try to identify the source of
 the change I renamed all the style sheets in the application including
 the web2py ones and then cleared the browser cache and I still get the
 spacing between rows. If I load in the 1.88.2 version I don't get the
 spacing.

 Maybe it is something in layout.html? If anyone has a quick, I know
 what that is, please let me know, I have looked at this for quite a
 while and can't find it but will push onwards. I hope my slowness in
 discovery is not an indication of my ability with CSS. :-)

 I could stay with the old layout but since it is still under
 development I would rather keep moving with the new version and all
 the good things that come with them.

 Thanks

 Ron


[web2py] Re: problem whith admin

2010-11-15 Thread Nico de Groot
I think the offending line is in design.html, see the ticket below.
(The 'real' line number is 207, because the python code is generated
by {{=...}}.)

289.if '/'.join(file_path).startswith('/'.join(path)):


At that point

   path:  ['js', 'ckeditor', 'plugins', 'table']
and
   file_path: ['js', 'ckeditor', 'plugins', 'tableresize']

the joins in de code result in

  js/ckeditor/plugins/tableresize
and
  js/ckeditor/plugins/table


I think line 289 intents to check if the  'path' is a 'path-prefix'
of  'file_path'. In this case the check resolves to True, but this
incorrect, because it is NOT a path-prefix causing line 290 to fail.

line 289 should probably be something like:

if ('/'.join(file_path)+'/').startswith('/'.join(path)+'/') or
path==[]:

This seems to resolve at least my problem. Please test and confirm.

Nico
-
Excerpt from my error-ticket:

type 'exceptions.IndexError'(list index out of range)

File C:\web2py\applications\admin\views\default\design.html in
module at line 290
code

Code listing
282. response.write('\n  ul\n', escape=False)
283. path=[]
284. for file in statics+['']:
285.items=file.split('/')
286.file_path=items[:-1]
287.filename=items[-1]
288.while path!=file_path:
289.if '/'.join(file_path).startswith('/'.join(path)):
290.   path.append(file_path[len(path)])


On 15 nov, 20:10, Branko Vukelic bg.bra...@gmail.com wrote:
 On Mon, Nov 15, 2010 at 8:59 PM, mdipierro mdipie...@cs.depaul.edu wrote:
  where is the offending line in design.html?

 I think it's in this block:

 h3 id=plugins onclick=collapse('plugins_inner'); class=component
   {{=T(Plugins)}}
   span class=tooltip{{=helpicon()}} span{{=T(To create a
 plugin, name a file/folder plugin_[name])}}/span/span
 /h3
 div id=plugins_inner class=component_contents
   div class=controls comptools
     {{=button(PLUGINS_APP, T('download plugins'))}}
   /div
   div class=controls
   /div
   {{if plugins:}}
   ul
       {{for plugin in plugins:}}
       li
       {{=A('plugin_%s' % plugin, _class='file', _href=URL('plugin',
 args=[app, plugin]))}}
       /li
       {{pass}}
   /ul
   {{else:}}
   pstrong{{=T('There are no plugins')}}/strong/p
   {{pass}}
   div class=controls formfield{{=upload_plugin_form(app)}}/div
 /div    -- line 290

 --
 Branko Vukelić

 bg.bra...@gmail.com
 stu...@brankovukelic.com

 Check out my blog:http://www.brankovukelic.com/
 Check out my portfolio:http://www.flickr.com/photos/foxbunny/
 Registered Linux user #438078 (http://counter.li.org/)
 I hang out on identi.ca:http://identi.ca/foxbunny

 Gimp Brushmakers Guildhttp://bit.ly/gbg-group


Re: [web2py] gluon/contrib/login_methods/linkedin_account.py - anyone deployed this?

2010-11-15 Thread Michele Comitini
Never tested, just a suggestion write something similar in your model
(see: 
http://code.google.com/r/michelecomitini-facebookaccess/source/browse/applications/linkedInOauth/models/db.py):

class LinkedinTest(OAuthAccount):
def get_user(self):
if self.accessToken() is not None:
client = oauth.Client(self.consumer, self.accessToken())
resp, content =
client.request('https://api.linkedin.com/v1/people/~:(id,first-name,last-name)')
if resp['status'] != '200':
# cannot get user info. should check status
return None
x = dom.parseString(content)
firstname = x.getElementsByTagName('first-name')[0].firstChild.data
username = firstname + ' '
+x.getElementsByTagName('last-name')[0].firstChild.data
uid = x.getElementsByTagName('id')[0].firstChild.data
return dict(username=username, name=firstname, registration_id=uid)

auth.settings.login_form=LinkedinTest(globals(),CLIENT_ID,CLIENT_SECRET,
AUTH_URL, TOKEN_URL, ACCESS_TOKEN_URL)


api = LinkedIn(api_key, api_secret, callback_url)

api.access_token=auth.settings.login_form.accessToken()

now you should be able to use the linkedin api, skipping the OAuth
code embedded into it.


2010/11/15 Carl carl.ro...@gmail.com:
 Has anyone got gluon/contrib/login_methods/linked_account.py working?

 I've built directly upon /gluon/contrib/login_methods/
 oauth10a_account.py with my own specific LinkedIn code but having
 found http://code.google.com/p/python-linkedin/ I wanted to use this
 to avoid reinventing the wheel (Özgür Vatansever's linkedin.py looks
 clean and has broad support for LinkedIn's API).

 But, linkedin.py doesn't look finished; for example:
 (from web2py 1.89.1)

 Line 43.
 result = self.request.vars.verifier

 The vars variable sets 'oauth_verifier' on returning from the LinkedIn
 website but not 'verifier'.

 Anyone tread this path?






Re: [web2py] Re: problem whith admin

2010-11-15 Thread Daniel Gonzalez
Hi, i had the same problem.

To fix this while a new version is launched, you can edit the file

applications/admin/views/default/design.html

And go to line 207 where youl find

if '/'.join(file_path).startswith('/'.join(path)):

Try to chage it with

if len(file_path)= len(path) and all([ v==file_path[k] for k,v in
enumerate(path)]):

It worked for me.

El lun, 15-11-2010 a las 13:43 -0800, Nico de Groot escribió:
 I think the offending line is in design.html, see the ticket below.
 (The 'real' line number is 207, because the python code is generated
 by {{=...}}.)
 
 289.if '/'.join(file_path).startswith('/'.join(path)):
 
 
 At that point
 
path:  ['js', 'ckeditor', 'plugins', 'table']
 and
file_path: ['js', 'ckeditor', 'plugins', 'tableresize']
 
 the joins in de code result in
 
   js/ckeditor/plugins/tableresize
 and
   js/ckeditor/plugins/table
 
 
 I think line 289 intents to check if the  'path' is a 'path-prefix'
 of  'file_path'. In this case the check resolves to True, but this
 incorrect, because it is NOT a path-prefix causing line 290 to fail.
 
 line 289 should probably be something like:
 
 if ('/'.join(file_path)+'/').startswith('/'.join(path)+'/') or
 path==[]:
 
 This seems to resolve at least my problem. Please test and confirm.
 
 Nico
 -
 Excerpt from my error-ticket:
 
 type 'exceptions.IndexError'(list index out of range)
 
 File C:\web2py\applications\admin\views\default\design.html in
 module at line 290
 code
 
 Code listing
 282. response.write('\n  ul\n', escape=False)
 283. path=[]
 284. for file in statics+['']:
 285.items=file.split('/')
 286.file_path=items[:-1]
 287.filename=items[-1]
 288.while path!=file_path:
 289.if '/'.join(file_path).startswith('/'.join(path)):
 290.   path.append(file_path[len(path)])
 
 
 On 15 nov, 20:10, Branko Vukelic bg.bra...@gmail.com wrote:
  On Mon, Nov 15, 2010 at 8:59 PM, mdipierro mdipie...@cs.depaul.edu wrote:
   where is the offending line in design.html?
 
  I think it's in this block:
 
  h3 id=plugins onclick=collapse('plugins_inner'); class=component
{{=T(Plugins)}}
span class=tooltip{{=helpicon()}} span{{=T(To create a
  plugin, name a file/folder plugin_[name])}}/span/span
  /h3
  div id=plugins_inner class=component_contents
div class=controls comptools
  {{=button(PLUGINS_APP, T('download plugins'))}}
/div
div class=controls
/div
{{if plugins:}}
ul
{{for plugin in plugins:}}
li
{{=A('plugin_%s' % plugin, _class='file', _href=URL('plugin',
  args=[app, plugin]))}}
/li
{{pass}}
/ul
{{else:}}
pstrong{{=T('There are no plugins')}}/strong/p
{{pass}}
div class=controls formfield{{=upload_plugin_form(app)}}/div
  /div-- line 290
 
  --
  Branko Vukelić
 
  bg.bra...@gmail.com
  stu...@brankovukelic.com
 
  Check out my blog:http://www.brankovukelic.com/
  Check out my portfolio:http://www.flickr.com/photos/foxbunny/
  Registered Linux user #438078 (http://counter.li.org/)
  I hang out on identi.ca:http://identi.ca/foxbunny
 
  Gimp Brushmakers Guildhttp://bit.ly/gbg-group




[web2py] Re: problem whith admin

2010-11-15 Thread JmiXIII
Hello ,
I had the same pb :
Traceback (most recent call last):
  File /home/sylvain/web2py/gluon/restricted.py, line 188, in
restricted
exec ccode in environment
  File /home/sylvain/web2py/applications/admin/views/default/
design.html, line 290, in module
/div
IndexError: list index out of range


What I can say :
I had Jqueryui folder in my /static and /plugin_wiki also
When I remove jqueryui from /static it works fine...
Don't know if it can helps, I wonder if it is a redondant file pb...

On 15 nov, 22:43, Nico de Groot ndegr...@chello.nl wrote:
 I think the offending line is in design.html, see the ticket below.
 (The 'real' line number is 207, because the python code is generated
 by {{=...}}.)

 289.    if '/'.join(file_path).startswith('/'.join(path)):

 At that point

    path:  ['js', 'ckeditor', 'plugins', 'table']
 and
    file_path: ['js', 'ckeditor', 'plugins', 'tableresize']

 the joins in de code result in

   js/ckeditor/plugins/tableresize
 and
   js/ckeditor/plugins/table

 I think line 289 intents to check if the  'path' is a 'path-prefix'
 of  'file_path'. In this case the check resolves to True, but this
 incorrect, because it is NOT a path-prefix causing line 290 to fail.

 line 289 should probably be something like:

     if ('/'.join(file_path)+'/').startswith('/'.join(path)+'/') or
 path==[]:

 This seems to resolve at least my problem. Please test and confirm.

 Nico
 -
 Excerpt from my error-ticket:

 type 'exceptions.IndexError'(list index out of range)

 File C:\web2py\applications\admin\views\default\design.html in
 module at line 290
 code

 Code listing
 282. response.write('\n  ul\n    ', escape=False)
 283. path=[]
 284. for file in statics+['']:
 285.    items=file.split('/')
 286.    file_path=items[:-1]
 287.    filename=items[-1]
 288.    while path!=file_path:
 289.    if '/'.join(file_path).startswith('/'.join(path)):
 290.       path.append(file_path[len(path)])

 
 On 15 nov, 20:10, Branko Vukelic bg.bra...@gmail.com wrote:

  On Mon, Nov 15, 2010 at 8:59 PM, mdipierro mdipie...@cs.depaul.edu wrote:
   where is the offending line in design.html?

  I think it's in this block:

  h3 id=plugins onclick=collapse('plugins_inner'); class=component
    {{=T(Plugins)}}
    span class=tooltip{{=helpicon()}} span{{=T(To create a
  plugin, name a file/folder plugin_[name])}}/span/span
  /h3
  div id=plugins_inner class=component_contents
    div class=controls comptools
      {{=button(PLUGINS_APP, T('download plugins'))}}
    /div
    div class=controls
    /div
    {{if plugins:}}
    ul
        {{for plugin in plugins:}}
        li
        {{=A('plugin_%s' % plugin, _class='file', _href=URL('plugin',
  args=[app, plugin]))}}
        /li
        {{pass}}
    /ul
    {{else:}}
    pstrong{{=T('There are no plugins')}}/strong/p
    {{pass}}
    div class=controls formfield{{=upload_plugin_form(app)}}/div
  /div    -- line 290

  --
  Branko Vukelić

  bg.bra...@gmail.com
  stu...@brankovukelic.com

  Check out my blog:http://www.brankovukelic.com/
  Check out my portfolio:http://www.flickr.com/photos/foxbunny/
  Registered Linux user #438078 (http://counter.li.org/)
  I hang out on identi.ca:http://identi.ca/foxbunny

  Gimp Brushmakers Guildhttp://bit.ly/gbg-group




[web2py]

2010-11-15 Thread Napoleon Moreno
Good afternoon

I am trying to use webgrid in a master- detail form.

But i can't find the way to link the crud with the master form.

any body knows how to do it?

Thansk


[web2py] webgrid in a master -detail form

2010-11-15 Thread Napoleon Moreno
On Mon, Nov 15, 2010 at 5:15 PM, Napoleon Moreno napoleo...@gmail.comwrote:

 Good afternoon

 I am trying to use webgrid in a master- detail form.

 But i can't find the way to link the crud with the master form.

 any body knows how to do it?

 Thansk



[web2py] Re:

2010-11-15 Thread mr.freeze
You need to expose crud through a controller. In default.py, put this:

def data():
return dict(form=crud())

Then set the grid accordingly:
grid.crud_function = 'data'

On Nov 15, 4:15 pm, Napoleon Moreno napoleo...@gmail.com wrote:
 Good afternoon

 I am trying to use webgrid in a master- detail form.

 But i can't find the way to link the crud with the master form.

 any body knows how to do it?

 Thansk


[web2py] Re: provide a development flag for applications II

2010-11-15 Thread Christopher Steel
On Nov 14, 4:40 pm, pierreth pierre.thibau...@gmail.com wrote:
 On Nov 13, 11:33 pm, Christopher Steel chris.st...@gmail.com wrote:

  Works fine for me from the web2py shell:

  1) install plugin

  2) run the web2py 
  shell:http://web2py.com/book/default/chapter/04?search=shell
  OR

  3) run shell from browser:

 http://127.0.0.1:8000/admin/shell/index/yourapp

  3) set the variable:

  _debug_on=True

 This does not seems easier than setting the variable somewhere in the
 model.

 What is the plug-in offering?

It is in effect the same thing, only setup using the Web2py plugin
feature so you can remove it and any testing code (that is place in
the plugin) when you are ready to deploy...

http://code.google.com/p/uc-debug/source/browse/#hg/models/plugin_debug

C.


[web2py] Re: 1.89.1 layout

2010-11-15 Thread ron_m
I have Firebug on Firefox and the mystery is I could not find the
contributor of the extra space. I finally took a copy of the old
layout.html and put it in place to run the application after fixing
the obvious things like css and js files moving. This gave me the
original style sheet driven separation of images. Next I moved pieces
of the new layout to the old layout until the extra spacing came back.
I found if I use the new layout.html DOCTYPE line I get the extra
spacing between rows of images but if I use the old DOCYPE it works as
expected with spacing as defined by CSS.

New DOCTYPE
!DOCTYPE html

Old DOCTYPE
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd

This is Firefox 3.6.12. I tried Google Chrome 8.0.552.200 beta and got
the same results. All is on Linux but Firefox on Mac is the same, I
have not tried IE yet.

Maybe the HTML5 DOCTYPE in the new layout brings something else into
play so I am looking at a symptom not a cause. I wouldn't want to
believe it is a browser bug given Firefox is Mozilla based and Chrome
is Webkit with both yielding identical visual results.

Thanks,
Ron


On Nov 15, 1:31 pm, villas villa...@gmail.com wrote:
 Hi Ron

 I hate tracking down CSS problems too.  It is good to use some tools
 for this.

 I often find Firebug on Firefox is good because you can alter the
 settings at the same time as viewing the form.

 Maybe if others use good tools for CSS,  they could also recommend
 them to you.

 -D

 On Nov 15, 6:11 pm, ron_m ron.mco...@gmail.com wrote:

  In the application I am writing there are IP video cameras displayed
  in a grid for one part of the application. In non-IE browsers this is
  realized as an IMG tag connected to the MJPEG video stream of the
  camera using the src= attribute.

  In the 1.88.2 version I used a padding: 1px; style to put a fine line
  between images letting the background show through which was perfect
  to get some separation.

  In 1.89.1 there is a 4 to 6 pixel vertical separation between rows of
  images. If I adjust the padding or the margin the spacing grows by
  that amount. The same 1px padding still works fine for the space
  between horizontally adjacent images. To try to identify the source of
  the change I renamed all the style sheets in the application including
  the web2py ones and then cleared the browser cache and I still get the
  spacing between rows. If I load in the 1.88.2 version I don't get the
  spacing.

  Maybe it is something in layout.html? If anyone has a quick, I know
  what that is, please let me know, I have looked at this for quite a
  while and can't find it but will push onwards. I hope my slowness in
  discovery is not an indication of my ability with CSS. :-)

  I could stay with the old layout but since it is still under
  development I would rather keep moving with the new version and all
  the good things that come with them.

  Thanks

  Ron




[web2py] got exception again while updating to 1.89.1

2010-11-15 Thread mart
Hi,

Could not  let it go ;)  So, here is that exception I got while
attempting to update to latest release (1.89.1). This time, on windows
with python 2.65 (as opposed to last time on Mac OS X 10.6 with python
2,7).



Traceback

Traceback (most recent call last):
  File C:\web2py\gluon\restricted.py, line 188, in restricted
exec ccode in environment
  File C:\web2py\applications\admin/views\default/site.html, line
182, in module
AttributeError: 'translator' object has no attribute
'get_possible_languages'

Error snapshot help Detailed traceback description

type 'exceptions.AttributeError'('translator' object has no
attribute 'get_possible_languages')


Re: [web2py] Re:

2010-11-15 Thread Napoleon Moreno
Thansk for your answer

I am doing that. but  the crud form does not the key value from the master
table. ( or master page )

This is my code

db.define_table('referencia',
Field('fecha_remision','datetime')
)

db.define_table('diagnostico_referencia',
Field('diagnostico',db.diagnostico),
Field('referencia',db.referencia)
)

in the controler
   

grid = webgrid.WebGrid(crud)
grid.enabled_rows = ['add_links']
grid.action_links = ['delete']
grid.action_headers = []
grid.crud_function = 'diagnostico_referencia'

   crud.settings.controller = 'default'
   grid.datasource =
db(db.diagnostico_referencia.referencia==referencia_id).select()
return dict(form=form, grid=grid(),referencia=referencia_id)


def diagnostico_referencia():
crud.settings[request.args(0)+'_next'] = URL(r=request,f='referencia')
return dict(form=crud())

Is it posible that the form in diagnostico_referencia  the
referencia.idvalue from the controler in the addition form?

On Mon, Nov 15, 2010 at 5:26 PM, mr.freeze nat...@freezable.com wrote:

 You need to expose crud through a controller. In default.py, put this:

 def data():
return dict(form=crud())

 Then set the grid accordingly:
 grid.crud_function = 'data'

 On Nov 15, 4:15 pm, Napoleon Moreno napoleo...@gmail.com wrote:
  Good afternoon
 
  I am trying to use webgrid in a master- detail form.
 
  But i can't find the way to link the crud with the master form.
 
  any body knows how to do it?
 
  Thansk



Re: [web2py] Re:

2010-11-15 Thread Napoleon Moreno
I am doing that. but  the crud form does not the key value from the master
table. ( or master page ). The user has to input the referencia value in the
crud page.

db.define_table('referencia',
Field('fecha_remision','

 datetime')
 )

 db.define_table('diagnostico_referencia',
 Field('diagnostico',db.diagnostico),
 Field('referencia',db.referencia)
 )

 in the controler


 grid = webgrid.WebGrid(crud)
 grid.enabled_rows = ['add_links']
 grid.action_links = ['delete']
 grid.action_headers = []
 grid.crud_function = 'diagnostico_referencia'

crud.settings.controller = 'default'
grid.datasource =
 db(db.diagnostico_referencia.referencia==referencia_id).select()
 return dict(form=form, grid=grid(),referencia=referencia_id)


 def diagnostico_referencia():
 crud.settings[request.args(0)+'_next'] = URL(r=request,f='referencia')
 return dict(form=crud())

 Is it posible that the form in diagnostico_referencia  get the
 referencia.id value from the controler in the addition form?



On Mon, Nov 15, 2010 at 5:59 PM, Napoleon Moreno napoleo...@gmail.comwrote:

 Thansk for your answer

 I am doing that. but  the crud form does not the key value from the master
 table. ( or master page )

 This is my code

 db.define_table('referencia',
 Field('fecha_remision','datetime')
 )

 db.define_table('diagnostico_referencia',
 Field('diagnostico',db.diagnostico),
 Field('referencia',db.referencia)
 )

 in the controler


 grid = webgrid.WebGrid(crud)
 grid.enabled_rows = ['add_links']
 grid.action_links = ['delete']
 grid.action_headers = []
 grid.crud_function = 'diagnostico_referencia'

crud.settings.controller = 'default'
grid.datasource =
 db(db.diagnostico_referencia.referencia==referencia_id).select()
 return dict(form=form, grid=grid(),referencia=referencia_id)


 def diagnostico_referencia():
 crud.settings[request.args(0)+'_next'] = URL(r=request,f='referencia')
 return dict(form=crud())

 Is it posible that the form in diagnostico_referencia  the  
 referencia.idvalue from the controler in the addition form?


 On Mon, Nov 15, 2010 at 5:26 PM, mr.freeze nat...@freezable.com wrote:

 You need to expose crud through a controller. In default.py, put this:

 def data():
return dict(form=crud())

 Then set the grid accordingly:
 grid.crud_function = 'data'

 On Nov 15, 4:15 pm, Napoleon Moreno napoleo...@gmail.com wrote:
  Good afternoon
 
  I am trying to use webgrid in a master- detail form.
 
  But i can't find the way to link the crud with the master form.
 
  any body knows how to do it?
 
  Thansk





Re: [web2py] Re:

2010-11-15 Thread Napoleon Moreno
Good afternoon

I am not sure if i am expressing  well. I need that the crud page inheritance
the foreing key from the master page.  In order that the user has not to
write the referencia.id value in the crud page

Thanks

On Mon, Nov 15, 2010 at 6:02 PM, Napoleon Moreno napoleo...@gmail.comwrote:

 I am doing that. but  the crud form does not the key value from the master
 table. ( or master page ). The user has to input the referencia value in the
 crud page.


 db.define_table('referencia',
 Field('fecha_remision','

 datetime')
 )

 db.define_table('diagnostico_referencia',
 Field('diagnostico',db.diagnostico),
 Field('referencia',db.referencia)
 )

 in the controler


 grid = webgrid.WebGrid(crud)
 grid.enabled_rows = ['add_links']
 grid.action_links = ['delete']
 grid.action_headers = []
 grid.crud_function = 'diagnostico_referencia'

crud.settings.controller = 'default'
grid.datasource =
 db(db.diagnostico_referencia.referencia==referencia_id).select()
 return dict(form=form, grid=grid(),referencia=referencia_id)


 def diagnostico_referencia():
 crud.settings[request.args(0)+'_next'] = URL(r=request,f='referencia')
 return dict(form=crud())

 Is it posible that the form in diagnostico_referencia  get the
 referencia.id value from the controler in the addition form?



 On Mon, Nov 15, 2010 at 5:59 PM, Napoleon Moreno napoleo...@gmail.comwrote:

 Thansk for your answer

 I am doing that. but  the crud form does not the key value from the master
 table. ( or master page )

 This is my code

 db.define_table('referencia',
 Field('fecha_remision','datetime')
 )

 db.define_table('diagnostico_referencia',
 Field('diagnostico',db.diagnostico),
 Field('referencia',db.referencia)
 )

 in the controler


 grid = webgrid.WebGrid(crud)
 grid.enabled_rows = ['add_links']
 grid.action_links = ['delete']
 grid.action_headers = []
 grid.crud_function = 'diagnostico_referencia'

crud.settings.controller = 'default'
grid.datasource =
 db(db.diagnostico_referencia.referencia==referencia_id).select()
 return dict(form=form, grid=grid(),referencia=referencia_id)


 def diagnostico_referencia():
 crud.settings[request.args(0)+'_next'] = URL(r=request,f='referencia')
 return dict(form=crud())

 Is it posible that the form in diagnostico_referencia  the  
 referencia.idvalue from the controler in the addition form?


 On Mon, Nov 15, 2010 at 5:26 PM, mr.freeze nat...@freezable.com wrote:

 You need to expose crud through a controller. In default.py, put this:

 def data():
return dict(form=crud())

 Then set the grid accordingly:
 grid.crud_function = 'data'

 On Nov 15, 4:15 pm, Napoleon Moreno napoleo...@gmail.com wrote:
  Good afternoon
 
  I am trying to use webgrid in a master- detail form.
 
  But i can't find the way to link the crud with the master form.
 
  any body knows how to do it?
 
  Thansk






[web2py] Re: db.export_to_csv_file(file) failing on Windows?

2010-11-15 Thread mart
ah, no, I was not using that, but will give it a go now :) thanks
for that :)

Here is something that I would like to understand and possibly fix
(and maybe those cmd switches will fix it
?) While I was able to connect to the mssql db locally, doing
db.tables returned an empty list... But, i could see the tables, etc,
using something like razor...  Could it be because of the state of the
DB? its sitting on SQL server 2005, and I can almost guarantee that it
was never maintained (at least  don't see any evidence of that)... or
maybe, that should not matter?

Thanks

Mart :)




On Nov 15, 10:14 am, mdipierro mdipie...@cs.depaul.edu wrote:
 This is the correct syntax.

 db.export_to_csv_file(open('somefile.csv', 'wb'))

 the problem is that db.does not see the models. Are you using?

 python -S app -M -N -R yourscript.py

 On Nov 15, 12:39 am, mart msenecal...@gmail.com wrote:

  Hi,

  Since connecting remotely is an issue for now, I went to the server
  hosting the MSSQL DB.

  I am cinnecting fine (to localhost), but this cmd :

  db.export_to_csv_file('quickbuild.csv')

  is getting this error:

    File C:\Documents and Settings\buildmonkey\Desktop\blue_framework
  copy\src\mssql_test.py, line 33, in main
      db.export_to_csv_file('quickbuild.csv')
  ...
  dal.py, line 2193, in export_to_csv_file
      ofile.write('END')
  AttributeError: 'str' object has no attribute 'write'

  I did not get an error when doing verbatim what the book says:

  db.export_to_csv_file(open('somefile.csv', 'wb'))

  but this only yielded one word in the target file, 'END'

  Any idea what I should be looking at?

  Thanks,
  Mart :)




Re: [web2py] Re: problem whith admin

2010-11-15 Thread Emanuel Woiski
I've applied your patch and it works, at least for i2p...
thanks
regards
woiski

2010/11/15 Nico de Groot ndegr...@chello.nl

 I think the offending line is in design.html, see the ticket below.
 (The 'real' line number is 207, because the python code is generated
 by {{=...}}.)

 289.if '/'.join(file_path).startswith('/'.join(path)):


 At that point

   path:  ['js', 'ckeditor', 'plugins', 'table']
 and
   file_path: ['js', 'ckeditor', 'plugins', 'tableresize']

 the joins in de code result in

  js/ckeditor/plugins/tableresize
 and
  js/ckeditor/plugins/table


 I think line 289 intents to check if the  'path' is a 'path-prefix'
 of  'file_path'. In this case the check resolves to True, but this
 incorrect, because it is NOT a path-prefix causing line 290 to fail.

 line 289 should probably be something like:

if ('/'.join(file_path)+'/').startswith('/'.join(path)+'/') or
 path==[]:

 This seems to resolve at least my problem. Please test and confirm.

 Nico
 -
 Excerpt from my error-ticket:

 type 'exceptions.IndexError'(list index out of range)

 File C:\web2py\applications\admin\views\default\design.html in
 module at line 290
 code

 Code listing
 282. response.write('\n  ul\n', escape=False)
 283. path=[]
 284. for file in statics+['']:
 285.items=file.split('/')
 286.file_path=items[:-1]
 287.filename=items[-1]
 288.while path!=file_path:
 289.if '/'.join(file_path).startswith('/'.join(path)):
 290.   path.append(file_path[len(path)])

 
 On 15 nov, 20:10, Branko Vukelic bg.bra...@gmail.com wrote:
  On Mon, Nov 15, 2010 at 8:59 PM, mdipierro mdipie...@cs.depaul.edu
 wrote:
   where is the offending line in design.html?
 
  I think it's in this block:
 
  h3 id=plugins onclick=collapse('plugins_inner'); class=component
{{=T(Plugins)}}
span class=tooltip{{=helpicon()}} span{{=T(To create a
  plugin, name a file/folder plugin_[name])}}/span/span
  /h3
  div id=plugins_inner class=component_contents
div class=controls comptools
  {{=button(PLUGINS_APP, T('download plugins'))}}
/div
div class=controls
/div
{{if plugins:}}
ul
{{for plugin in plugins:}}
li
{{=A('plugin_%s' % plugin, _class='file', _href=URL('plugin',
  args=[app, plugin]))}}
/li
{{pass}}
/ul
{{else:}}
pstrong{{=T('There are no plugins')}}/strong/p
{{pass}}
div class=controls formfield{{=upload_plugin_form(app)}}/div
  /div-- line 290
 
  --
  Branko Vukelić
 
  bg.bra...@gmail.com
  stu...@brankovukelic.com
 
  Check out my blog:http://www.brankovukelic.com/
  Check out my portfolio:http://www.flickr.com/photos/foxbunny/
  Registered Linux user #438078 (http://counter.li.org/)
  I hang out on identi.ca:http://identi.ca/foxbunny
 
  Gimp Brushmakers Guildhttp://bit.ly/gbg-group



[web2py] Re:

2010-11-15 Thread mr.freeze
Sorry, I don't fully understand. You can email your app (with any
personal data removed) and I will take a closer look.

On Nov 15, 5:02 pm, Napoleon Moreno napoleo...@gmail.com wrote:
 I am doing that. but  the crud form does not the key value from the master
 table. ( or master page ). The user has to input the referencia value in the
 crud page.

 db.define_table('referencia',
     Field('fecha_remision','





  datetime')
  )

  db.define_table('diagnostico_referencia',
      Field('diagnostico',db.diagnostico),
      Field('referencia',db.referencia)
      )

  in the controler
     

      grid = webgrid.WebGrid(crud)
      grid.enabled_rows = ['add_links']
      grid.action_links = ['delete']
      grid.action_headers = []
      grid.crud_function = 'diagnostico_referencia'

     crud.settings.controller = 'default'
     grid.datasource =
  db(db.diagnostico_referencia.referencia==referencia_id).select()
      return dict(form=form, grid=grid(),referencia=referencia_id)

  def diagnostico_referencia():
      crud.settings[request.args(0)+'_next'] = URL(r=request,f='referencia')
      return dict(form=crud())

  Is it posible that the form in diagnostico_referencia  get the
  referencia.id value from the controler in the addition form?

 On Mon, Nov 15, 2010 at 5:59 PM, Napoleon Moreno napoleo...@gmail.comwrote:

  Thansk for your answer

  I am doing that. but  the crud form does not the key value from the master
  table. ( or master page )

  This is my code

  db.define_table('referencia',
      Field('fecha_remision','datetime')
  )

  db.define_table('diagnostico_referencia',
      Field('diagnostico',db.diagnostico),
      Field('referencia',db.referencia)
      )

  in the controler
     

      grid = webgrid.WebGrid(crud)
      grid.enabled_rows = ['add_links']
      grid.action_links = ['delete']
      grid.action_headers = []
      grid.crud_function = 'diagnostico_referencia'

     crud.settings.controller = 'default'
     grid.datasource =
  db(db.diagnostico_referencia.referencia==referencia_id).select()
      return dict(form=form, grid=grid(),referencia=referencia_id)

  def diagnostico_referencia():
      crud.settings[request.args(0)+'_next'] = URL(r=request,f='referencia')
      return dict(form=crud())

  Is it posible that the form in diagnostico_referencia  the  
  referencia.idvalue from the controler in the addition form?

  On Mon, Nov 15, 2010 at 5:26 PM, mr.freeze nat...@freezable.com wrote:

  You need to expose crud through a controller. In default.py, put this:

  def data():
     return dict(form=crud())

  Then set the grid accordingly:
  grid.crud_function = 'data'

  On Nov 15, 4:15 pm, Napoleon Moreno napoleo...@gmail.com wrote:
   Good afternoon

   I am trying to use webgrid in a master- detail form.

   But i can't find the way to link the crud with the master form.

   any body knows how to do it?

   Thansk




Re: [web2py] Re:

2010-11-15 Thread Napoleon Moreno
Good night

1) Another problem that i have is that the webgrid show me the id's of the
diagnostico_referencia table. I need that it shows the name of the
'diagnostico' table.  It could be done with a join, but it is intended to be
deploy in GAE. I understand that GAE does not work with joins.

2) I am not sure if i am expressing  well. I need that the crud page
inheritance
the foreing key from the master page.  In order that the user has not to
write the referencia.id value in the crud page


Thansk for any advice.
Napoleon

db.define_table('diagnostico',
Field('name','string')

 )

db.define_table('referencia',
Field('fecha_remision',' datetime')
.
  )

db.define_table('diagnostico_referencia',
Field('diagnostico',db.diagnostico),
Field('referencia',db.referencia)
 )


# The controler show the fields of 'referencia' . I use the referencia.id to
filter to grid.datasource

   form = sqlform(db.referencia.id = = referencia_id).select()
   

grid = webgrid.WebGrid(crud)
grid.enabled_rows = ['add_links']
grid.action_links = ['delete']
grid.action_headers = []
grid.crud_function = 'diagnostico_referencia'

crud.settings.controller = 'default'
grid.datasource =
db(db.diagnostico_referencia.referencia==referencia_id).select()
return dict(form=form, grid=grid())




On Mon, Nov 15, 2010 at 6:15 PM, Napoleon Moreno napoleo...@gmail.comwrote:

 Good afternoon

 I am not sure if i am expressing  well. I need that the crud page inheritance
 the foreing key from the master page.  In order that the user has not to
 write the referencia.id value in the crud page

 Thanks


 On Mon, Nov 15, 2010 at 6:02 PM, Napoleon Moreno napoleo...@gmail.comwrote:

 I am doing that. but  the crud form does not the key value from the master
 table. ( or master page ). The user has to input the referencia value in the
 crud page.


 db.define_table('referencia',
 Field('fecha_remision','

 datetime')
 )

 db.define_table('diagnostico_referencia',
 Field('diagnostico',db.diagnostico),
 Field('referencia',db.referencia)
 )

 in the controler


 grid = webgrid.WebGrid(crud)
 grid.enabled_rows = ['add_links']
 grid.action_links = ['delete']
 grid.action_headers = []
 grid.crud_function = 'diagnostico_referencia'

crud.settings.controller = 'default'
grid.datasource =
 db(db.diagnostico_referencia.referencia==referencia_id).select()
 return dict(form=form, grid=grid(),referencia=referencia_id)


 def diagnostico_referencia():
 crud.settings[request.args(0)+'_next'] =
 URL(r=request,f='referencia')
 return dict(form=crud())

 Is it posible that the form in diagnostico_referencia  get the
 referencia.id value from the controler in the addition form?



 On Mon, Nov 15, 2010 at 5:59 PM, Napoleon Moreno napoleo...@gmail.comwrote:

 Thansk for your answer

 I am doing that. but  the crud form does not the key value from the
 master table. ( or master page )

 This is my code

 db.define_table('referencia',
 Field('fecha_remision','datetime')
 )

 db.define_table('diagnostico_referencia',
 Field('diagnostico',db.diagnostico),
 Field('referencia',db.referencia)
 )

 in the controler


 grid = webgrid.WebGrid(crud)
 grid.enabled_rows = ['add_links']
 grid.action_links = ['delete']
 grid.action_headers = []
 grid.crud_function = 'diagnostico_referencia'

crud.settings.controller = 'default'
grid.datasource =
 db(db.diagnostico_referencia.referencia==referencia_id).select()
 return dict(form=form, grid=grid(),referencia=referencia_id)


 def diagnostico_referencia():
 crud.settings[request.args(0)+'_next'] =
 URL(r=request,f='referencia')
 return dict(form=crud())

 Is it posible that the form in diagnostico_referencia  the
 referencia.id value from the controler in the addition form?


 On Mon, Nov 15, 2010 at 5:26 PM, mr.freeze nat...@freezable.com wrote:

 You need to expose crud through a controller. In default.py, put this:

 def data():
return dict(form=crud())

 Then set the grid accordingly:
 grid.crud_function = 'data'

 On Nov 15, 4:15 pm, Napoleon Moreno napoleo...@gmail.com wrote:
  Good afternoon
 
  I am trying to use webgrid in a master- detail form.
 
  But i can't find the way to link the crud with the master form.
 
  any body knows how to do it?
 
  Thansk







Re: [web2py] Re: Discussion: Why is web2py bad for large deployments?

2010-11-15 Thread Mariano Reingart
Django is not faster than web2py for real world applications, this
is my benchmark that proves it (in this particular case, YMMV):

django: Pycon Argentina 2009 site:
(based on pycon-tech, pycon 2010 us talk propossal/ site)
ab -n 100 http://pycon.sistemasagiles.com.ar/2009/about/
Requests per second:23.13 [#/sec] (mean)
(it is the original server, then it has been moved to ar.pycon.org)

web2py: PyDay Buenos Aires 2010
(based on web2conf, pycon 2010 us registration site)
ab -n 100 http://www.pyday.com.ar/buenosbench/default/index
Requests per second:24.53 [#/sec] (mean)

web2py app it is a striped down version to include only pycon-tech
about page exposed features (wiki, with menu and sponsor logos).
web2py app doesn't uses cache and is not optimized (django one is, and
it is very very very very too much complicated than the web2py app)

exec vs import is not the most important issue (and I think it isn't
relevant at all in a full cost vs performance analysis, ROI as you say
in english).

The biggest performance penality of web2py I've found is the
filesystem access (looking for multiples .py files slow downs
requests/sec).
In this case (in my tests), each new db_*.py model has a performance
lost of ~ 5% to 10% .
Each directory scan has a 1% of performance loss.

I'm working in some optimizations for compiled apps (avoiding
directory scanning and saving codeobjects in memory improves a lot,
but has some drawbacks as all cache systems).
Maybe when we compile the app can make a sort of dispatcher that
already knows where the files are, so having to list directories is
not needed.

Anyway, we shouldn't have this kind of discussions on web2py-developers list?

When I have some time I'll fully publish this benchmark, just to
demythologize this issue ;-)
(the same for the table definition order, that is not really needed
-there are easy workarounds-)

Best regards,

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com


[web2py] tools to manage users / groups / permissions?

2010-11-15 Thread Carlos
Hi,

Are there any web tools to easily manage users / groups /
permissions?.

For reference, have a list of users with simple checkboxes to assign /
revoke groups / permissions, or something like that.

Thanks,

   Carlos


[web2py] crud operations for joins?

2010-11-15 Thread Carlos
Hi,

What should I do in order to support crud operations with joined
tables?.

For reference, I have a 'central' table in my design called 'entity'
which contains lots of data (including names, company, emails, phones,
address, etc.) and I want many other tables to point to ONE entity
instance, i.e. 'entity' as an _extension_ of records in many different
tables.

My background is with object databases, and this kind of design makes
sense, although I'm not sure if it makes sense with relation
databases?.

Thanks,

   Carlos


[web2py] create auth_user programatically?

2010-11-15 Thread Carlos
Hi,

What's the best way to create an auth_user programatically?.

If I do db.auth_user.insert(...), then the password is not encrypted
and the validations are not executed, as far as I can tell.

In order to accomplish this, is it possible to execute a
crud.create(...) as if the form data was already posted, such that the
insert is done automatically (but without any web requests)?.

Thanks,

   Carlos


[web2py] Re:

2010-11-15 Thread villas
Hi,
I'm not sure,  but I think Napoleon wants to save the id key of the
'master table' into the master_id field of the 'detail' table.
I'm not sure how it works with crud.  I would suggest that you use
SQLFORM and set the field after form.accepts.  Take a look at this
link:

http://www.web2pyslices.com/main/slices/take_slice/102

This is a short-cut way of linking tables, but notice how the id is
set.
Hope this helps.
-D

On Nov 15, 11:49 pm, mr.freeze nat...@freezable.com wrote:
 Sorry, I don't fully understand. You can email your app (with any
 personal data removed) and I will take a closer look.

 On Nov 15, 5:02 pm, Napoleon Moreno napoleo...@gmail.com wrote:

  I am doing that. but  the crud form does not the key value from the master
  table. ( or master page ). The user has to input the referencia value in the
  crud page.

  db.define_table('referencia',
      Field('fecha_remision','

   datetime')
   )

   db.define_table('diagnostico_referencia',
       Field('diagnostico',db.diagnostico),
       Field('referencia',db.referencia)
       )

   in the controler
      

       grid = webgrid.WebGrid(crud)
       grid.enabled_rows = ['add_links']
       grid.action_links = ['delete']
       grid.action_headers = []
       grid.crud_function = 'diagnostico_referencia'

      crud.settings.controller = 'default'
      grid.datasource =
   db(db.diagnostico_referencia.referencia==referencia_id).select()
       return dict(form=form, grid=grid(),referencia=referencia_id)

   def diagnostico_referencia():
       crud.settings[request.args(0)+'_next'] = URL(r=request,f='referencia')
       return dict(form=crud())

   Is it posible that the form in diagnostico_referencia  get the
   referencia.id value from the controler in the addition form?

  On Mon, Nov 15, 2010 at 5:59 PM, Napoleon Moreno 
  napoleo...@gmail.comwrote:

   Thansk for your answer

   I am doing that. but  the crud form does not the key value from the master
   table. ( or master page )

   This is my code

   db.define_table('referencia',
       Field('fecha_remision','datetime')
   )

   db.define_table('diagnostico_referencia',
       Field('diagnostico',db.diagnostico),
       Field('referencia',db.referencia)
       )

   in the controler
      

       grid = webgrid.WebGrid(crud)
       grid.enabled_rows = ['add_links']
       grid.action_links = ['delete']
       grid.action_headers = []
       grid.crud_function = 'diagnostico_referencia'

      crud.settings.controller = 'default'
      grid.datasource =
   db(db.diagnostico_referencia.referencia==referencia_id).select()
       return dict(form=form, grid=grid(),referencia=referencia_id)

   def diagnostico_referencia():
       crud.settings[request.args(0)+'_next'] = URL(r=request,f='referencia')
       return dict(form=crud())

   Is it posible that the form in diagnostico_referencia  the  
   referencia.idvalue from the controler in the addition form?

   On Mon, Nov 15, 2010 at 5:26 PM, mr.freeze nat...@freezable.com wrote:

   You need to expose crud through a controller. In default.py, put this:

   def data():
      return dict(form=crud())

   Then set the grid accordingly:
   grid.crud_function = 'data'

   On Nov 15, 4:15 pm, Napoleon Moreno napoleo...@gmail.com wrote:
Good afternoon

I am trying to use webgrid in a master- detail form.

But i can't find the way to link the crud with the master form.

any body knows how to do it?

Thansk




[web2py] extend previously defined tables?

2010-11-15 Thread Carlos
Hi,

Is it possible to extend previously defined tables with new fields?.

For reference, I want to add a new field in the auth_membership table,
but without having to copy  paste the table definition (which is
not a good practice).

Or what would you recommend?.

Thanks,

   Carlos


[web2py] web2py converts the data to thml chars from controller to view

2010-11-15 Thread demetrio
Hi everyone!

When I try to send html code to a view web2py automatically converts
it to html characters (i.e.: the character  is converted to lt;)

There is any way to make the unescape the data?

Thanks in advance.

demetrio


[web2py] Re: got exception again while updating to 1.89.1

2010-11-15 Thread mdipierro
If you are getting this exception the upgrade was successfull. You
must restart web2py.
This is a problem an oversight in this particular upgrade and we will
make sure it does not happen again.


On Nov 15, 4:57 pm, mart msenecal...@gmail.com wrote:
 Hi,

 Could not  let it go ;)  So, here is that exception I got while
 attempting to update to latest release (1.89.1). This time, on windows
 with python 2.65 (as opposed to last time on Mac OS X 10.6 with python
 2,7).

 Traceback

 Traceback (most recent call last):
   File C:\web2py\gluon\restricted.py, line 188, in restricted
     exec ccode in environment
   File C:\web2py\applications\admin/views\default/site.html, line
 182, in module
 AttributeError: 'translator' object has no attribute
 'get_possible_languages'

 Error snapshot help Detailed traceback description

 type 'exceptions.AttributeError'('translator' object has no
 attribute 'get_possible_languages')


[web2py] Re: got exception again while updating to 1.89.1

2010-11-15 Thread mart
Personally, for me, its a none issue (since I always install to unique
directories) I was just looking to reproduce the problem (I actually
thouht I was the only one that got the exception).

thanks

Mart :)



On Nov 15, 9:31 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 If you are getting this exception the upgrade was successfull. You
 must restart web2py.
 This is a problem an oversight in this particular upgrade and we will
 make sure it does not happen again.

 On Nov 15, 4:57 pm, mart msenecal...@gmail.com wrote:

  Hi,

  Could not  let it go ;)  So, here is that exception I got while
  attempting to update to latest release (1.89.1). This time, on windows
  with python 2.65 (as opposed to last time on Mac OS X 10.6 with python
  2,7).

  Traceback

  Traceback (most recent call last):
    File C:\web2py\gluon\restricted.py, line 188, in restricted
      exec ccode in environment
    File C:\web2py\applications\admin/views\default/site.html, line
  182, in module
  AttributeError: 'translator' object has no attribute
  'get_possible_languages'

  Error snapshot help Detailed traceback description

  type 'exceptions.AttributeError'('translator' object has no
  attribute 'get_possible_languages')




[web2py] Re: db.export_to_csv_file(file) failing on Windows?

2010-11-15 Thread mart
quick question... I think i would like to run this script (export
mssql db to cvs) with dal stand alone... since this ia production
server I would want to run it as simple scheduled executable - just
the script sitting on the gluon folder. Am I still able to force the
script to look at the the module with the -M ?

Thanks,

Mart :)

On Nov 15, 6:17 pm, mart msenecal...@gmail.com wrote:
 ah, no, I was not using that, but will give it a go now :) thanks
 for that :)

 Here is something that I would like to understand and possibly fix
 (and maybe those cmd switches will fix it
 ?) While I was able to connect to the mssql db locally, doing
 db.tables returned an empty list... But, i could see the tables, etc,
 using something like razor...  Could it be because of the state of the
 DB? its sitting on SQL server 2005, and I can almost guarantee that it
 was never maintained (at least  don't see any evidence of that)... or
 maybe, that should not matter?

 Thanks

 Mart :)

 On Nov 15, 10:14 am, mdipierro mdipie...@cs.depaul.edu wrote:

  This is the correct syntax.

  db.export_to_csv_file(open('somefile.csv', 'wb'))

  the problem is that db.does not see the models. Are you using?

  python -S app -M -N -R yourscript.py

  On Nov 15, 12:39 am, mart msenecal...@gmail.com wrote:

   Hi,

   Since connecting remotely is an issue for now, I went to the server
   hosting the MSSQL DB.

   I am cinnecting fine (to localhost), but this cmd :

   db.export_to_csv_file('quickbuild.csv')

   is getting this error:

     File C:\Documents and Settings\buildmonkey\Desktop\blue_framework
   copy\src\mssql_test.py, line 33, in main
       db.export_to_csv_file('quickbuild.csv')
   ...
   dal.py, line 2193, in export_to_csv_file
       ofile.write('END')
   AttributeError: 'str' object has no attribute 'write'

   I did not get an error when doing verbatim what the book says:

   db.export_to_csv_file(open('somefile.csv', 'wb'))

   but this only yielded one word in the target file, 'END'

   Any idea what I should be looking at?

   Thanks,
   Mart :)




[web2py] [off] Senha touch is now free!

2010-11-15 Thread Bruno Rocha
Senha touch is now free!

http://www.sencha.com/blog/2010/11/15/sencha-touch-1-0-ships-now-free/?utm_source=feedburnerutm_medium=feedutm_campaign=Feed:+extblog+(Ext+JS+Blog)

-- 

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


Re: [web2py] Re: postgresql error ... class 'psycopg2.ProgrammingError'(relation auth_user already exists)

2010-11-15 Thread Johann Spies
On 15 November 2010 18:17, Carlos carlosgali...@gmail.com wrote:

 From what Johann said, I understood the table definitions were changed
 in web2py (using postgresql as the backend), not in postgresql
 directly ... or did I misunderstand it?.


Yes, that is what I meant.

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


[web2py] Re: create auth_user programatically?

2010-11-15 Thread ron_m
Look in gluon/tools.py at the Auth class, function register to see how
it is done with the code behind the register form. Some of this
function builds the form for initial posting, then on submit the
function is revisited and the real work of adding the user is done in
the if form.accepts(): area of the function.

On Nov 15, 4:42 pm, Carlos carlosgali...@gmail.com wrote:
 Hi,

 What's the best way to create an auth_user programatically?.

 If I do db.auth_user.insert(...), then the password is not encrypted
 and the validations are not executed, as far as I can tell.

 In order to accomplish this, is it possible to execute a
 crud.create(...) as if the form data was already posted, such that the
 insert is done automatically (but without any web requests)?.

 Thanks,

    Carlos


[web2py] Re: tools to manage users / groups / permissions?

2010-11-15 Thread Richard
I copy+paste a chunk of code to do this in a few of my apps, so would
be interested in a good solution for this.



On Nov 16, 11:44 am, Carlos carlosgali...@gmail.com wrote:
 Hi,

 Are there any web tools to easily manage users / groups /
 permissions?.

 For reference, have a list of users with simple checkboxes to assign /
 revoke groups / permissions, or something like that.

 Thanks,

    Carlos


[web2py] Re: French Speakers Group

2010-11-15 Thread lannick
Hi,

I am french and there is no groups and nothing in France about
web2py.
So I have created the web2py users france group :
http://groups.google.com/group/web2py-users-france

The main purpose is to translate web2py and after the website and
documentation. I hope many french users will hel me for that.

Regards,
Lannick


On 15 nov, 14:24, rochacbruno rochacbr...@gmail.com wrote:
 Groups are created voluntary by the community.

 If somebody create a new group wherever. Just have to report the link to 
 Massimo to be included in /usergroups page.

 Is it important to create a google group  because the mainsite just has the 
 ability to fetch rss on google.

 Or, somebody have to patch feeds_reader.py on examples app. Including the 
 reader for Yahoo or another kind of group.

 Are you french? So if the group does not exists yet. Create this and send the 
 link.

 The idea is to translate the main website too.

 Enviado via iPhone

 Em 15/11/2010, às 10:47, lannick abou...@gmail.com escreveu:

  Hi,

  Is it possible to create a French Speakers group ?

  The main purpose of this group will be to work on the translation of
  Web2py.

  Regards,
  Lannick