[web2py:37078] Re: validator breaks update and create other table

2009-12-12 Thread annet
Massimo,

 (db.companyactivity.activity==request.vars.activity)

 the left hand side a reference field or an int and the right hand side
 is a string. Hard to follow ...

I apologize for that. The combination table reads like:

db.define_table('companyactivity',
Field
('company',db.company,default='',notnull=True,ondelete='CASCADE',
writable=False, readable=False),
Field
('activity',db.activity,default='',notnull=True,ondelete='RESTRICT'),
Field('created_on',type='datetime', writable=False,
readable=False),
Field('modified_on',type='datetime', writable=False,
readable=False),
migrate='companyactivity.table')

db.companyactivity.company.requires=[IS_IN_DB(db,db.company.id,'%
(companyname)s'),IS_NOT_IN_DB(db
(db.companyactivity.activity==request.vars.activity),db.companyactivity.company,error_message='already
in database')]
db.companyactivity.activity.requires=IS_IN_DB(db,db.activiteit.id,'%
(activiteit)s')


So company and activity are both of type int.


 db.timetable.activity.requires=IS_IN_SET([row.activity for row in
 activity])

 should be

 db.timetable.activity.requires=IS_IN_SET([row.id for row in activity],
 [row.activity for row in activity])

I changed my code to read like the code above, but I still get the
same error ticket.


Kind regards,

Annet.

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37079] Re: attention ! attention !

2009-12-12 Thread Markus Gritsch
Hi,

the source package contains all kind of $py.class files.  A release
should be done by packaging a fresh check-out from a version control
system -- not by zipping some working directory.

Kind regards,
Markus

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37080] Re: new on web2pyslices.com: WebGrid

2009-12-12 Thread villas
On Dec 11, 10:13 pm, mr.freeze nat...@freezable.com wrote:
 Just added: multiple grids per page is supported now!

Very useful. Thanks for your further explanations too.
-David

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37081] Re: can't upload w2p from/to changeset 10

2009-12-12 Thread DenesL
After removing the repository and downloading from changeset 16 the
problem continues.
Create new app works but upload app welcome.w2p and rename it w2
gives the same error.


On Dec 11, 11:46 pm, Brian M bmere...@gmail.com wrote:
 Strange, I just tried with hg changeset 11 and it worked.

 My Steps:
 1) Pack all an application from site admin screen.
 2) Use Upload existing application to upload the w2p file you just
 downloaded.
 3) New application successfully created.

 This is with python 2.6 and just the plain web2py built-in server.

 ~Brian

 On Dec 11, 9:40 pm, DenesL denes1...@yahoo.ca wrote:

  w2p files created with changeset 10 give this error on upload (also
  running changeset 10):

  Traceback (most recent call last):
    File C:\web2py\hg\gluon\main.py, line 436, in wsgibase
      parse_get_post_vars(request, environ)
    File C:\web2py\hg\gluon\main.py, line 308, in parse_get_post_vars
      if pvalue:
    File C:\Python25\lib\cgi.py, line 633, in __len__
      return len(self.keys())
    File C:\Python25\lib\cgi.py, line 609, in keys
      raise TypeError, not indexable
  TypeError: not indexable

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37083] Re: crud.update(...,message,...)

2009-12-12 Thread annet
Massimo,

Is there a way to solve this problem?


Kind regards,

Annet.

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37084] Re: attention ! attention !

2009-12-12 Thread mdipierro
oops.

On Dec 12, 7:30 am, Markus Gritsch m.grit...@gmail.com wrote:
 Hi,

 the source package contains all kind of $py.class files.  A release
 should be done by packaging a fresh check-out from a version control
 system -- not by zipping some working directory.

 Kind regards,
 Markus

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37085] Re: can't upload w2p from/to changeset 10

2009-12-12 Thread mdipierro
Thanks. I will fix this in trunk. As usual this is because of a new
feature introduced in 10.

On Dec 11, 9:40 pm, DenesL denes1...@yahoo.ca wrote:
 w2p files created with changeset 10 give this error on upload (also
 running changeset 10):

 Traceback (most recent call last):
   File C:\web2py\hg\gluon\main.py, line 436, in wsgibase
     parse_get_post_vars(request, environ)
   File C:\web2py\hg\gluon\main.py, line 308, in parse_get_post_vars
     if pvalue:
   File C:\Python25\lib\cgi.py, line 633, in __len__
     return len(self.keys())
   File C:\Python25\lib\cgi.py, line 609, in keys
     raise TypeError, not indexable
 TypeError: not indexable

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37086] Re: attention ! attention !

2009-12-12 Thread Brian M
Massimo,

Testing of the Windows binary version fails:

Creating an app with Create new application works fine. HOWEVER,
trying to Upload existing application fails with the following error
ticket:

Traceback (most recent call last):
  File gluon/main.py, line 436, in wsgibase
  File gluon/main.py, line 308, in parse_get_post_vars
  File cgi.pyc, line 633, in __len__
  File cgi.pyc, line 609, in keys
TypeError: not indexable

This would seem to be a problem with the Windows binary version, since
I can run the source version on WinXP without a problem - I can
successfully create a new application AND upload an existing
application.  Once I re-compiled the Windows binary with
python setup_exe.py py2exe
and then copied the applications/ folder into the dist directory (it
wasn't there after building the binary) both creating and uploading
applications worked again.  I'm using Windows XP and Python 2.6.3

~Brian


On Dec 12, 12:52 am, mdipierro mdipie...@cs.depaul.edu wrote:
 The new version in trunk will by default override admin, welcome,
 examples and create welcome.w2p at startup.

 This will simplify upgrades.

 You can test the release candidate here:

 http://web2py.com/examples/static/1.74.0/web2py_src.ziphttp://web2py.com/examples/static/1.74.0/web2py_osx.ziphttp://web2py.com/examples/static/1.74.0/web2py_win.zip

 The new version also creates all missing folder including a new one
 (site-packages). You can use it to install web2py level modules that
 should be shared by all apps. It is automatically added to sys.path.

 I have checked the source and ows version but not the windows version.
 If you do please report your findings.

 Massimo

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37087] Re: crud.update(...,message,...)

2009-12-12 Thread mdipierro
I am not sure I understand the problem. Let me assume you want the
message displayed after redirection. In this case you need to use

crud.update(...,message='')

and message will be displayed after redirection.

On Dec 12, 9:07 am, annet annet.verm...@gmail.com wrote:
 Massimo,

 Is there a way to solve this problem?

 Kind regards,

 Annet.

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37088] Re: web2py DAL Boolean type does not play well with others

2009-12-12 Thread mdipierro
This is a good point. It is as it is because originally my concern was
to have the same type mapped into the same type as much as possible.
Another problem is that some systems do not allow storage of NULL in
boolean and that requires treating the type as an exception.

This cannot be changed for backward compatibility but it is trivial to
create new adaptors for example

   db=DAL('sqlite+b://...')

where sqlite+b would mean used boolean instead of char. This is
already done for mssql

   db=DAL('mssql://...') uses BIT
   db=DAL('mssql2://...') uses CHAR(1)

I will think about this some more but definitively should be solved.

Massimo

On Dec 12, 8:41 am, Markus Gritsch m.grit...@gmail.com wrote:
 Hi,

 web2py's Boolean implementation (as CHAR(1) with 'T' and 'F' values)
 periodically leads to some confusion [1][2].

 Further it leads to problems when trying to connect to an existing
 schema created by some other ORM.  Both SQLObject and SQLAlchemy use
 BOOLEAN as the SQL data type with values 0 and 1 (I have only checked
 the SQLite and MySQL backends).  Such existing data can only be used
 with the Integer datatype workaround which does not make me totally
 happy.

 It's even worse the other way around when web2py created the schema.
 I really do not like to use 'T' and 'F' for boolean columns in
 SQLObject queries.

 I cannot understand the recent 'portability reasons' argumentation in
 [2].  If a backend does not support BOOLEAN, the DAL may use the CHAR
 (1) workaround.  But on backends like SQLite and MySQL which do have a
 BOOLEAN data type it should be used, IMO.

 I know, for backwards compatibility reasons web2py cannot change its
 behavior.  However, the current behavior is bad for interoperability
 with other widely used ORMs.

 [1]http://groups.google.com/group/web2py/browse_thread/thread/c3b5e32c7a...
 [2]http://groups.google.com/group/web2py/browse_thread/thread/5a0039a8fb...

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37089] Re: attention ! attention !

2009-12-12 Thread mdipierro
fixed in trunk. Will re-post

On Dec 12, 9:25 am, Brian M bmere...@gmail.com wrote:
 Massimo,

 Testing of the Windows binary version fails:

 Creating an app with Create new application works fine. HOWEVER,
 trying to Upload existing application fails with the following error
 ticket:

 Traceback (most recent call last):
   File gluon/main.py, line 436, in wsgibase
   File gluon/main.py, line 308, in parse_get_post_vars
   File cgi.pyc, line 633, in __len__
   File cgi.pyc, line 609, in keys
 TypeError: not indexable

 This would seem to be a problem with the Windows binary version, since
 I can run the source version on WinXP without a problem - I can
 successfully create a new application AND upload an existing
 application.  Once I re-compiled the Windows binary with
     python setup_exe.py py2exe
 and then copied the applications/ folder into the dist directory (it
 wasn't there after building the binary) both creating and uploading
 applications worked again.  I'm using Windows XP and Python 2.6.3

 ~Brian

 On Dec 12, 12:52 am, mdipierro mdipie...@cs.depaul.edu wrote:

  The new version in trunk will by default override admin, welcome,
  examples and create welcome.w2p at startup.

  This will simplify upgrades.

  You can test the release candidate here:

 http://web2py.com/examples/static/1.74.0/web2py_src.ziphttp://web2py

  The new version also creates all missing folder including a new one
  (site-packages). You can use it to install web2py level modules that
  should be shared by all apps. It is automatically added to sys.path.

  I have checked the source and ows version but not the windows version.
  If you do please report your findings.

  Massimo



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37090] Re: can't upload w2p from/to changeset 10

2009-12-12 Thread Yarko Tymciurak
On Dec 12, 9:25 am, mdipierro mdipie...@cs.depaul.edu wrote:
 Thanks. I will fix this in trunk. As usual this is because of a new
 feature introduced in 10.

 review by releasing   - heh ;-)


 On Dec 11, 9:40 pm, DenesL denes1...@yahoo.ca wrote:



  w2p files created with changeset 10 give this error on upload (also
  running changeset 10):

  Traceback (most recent call last):
    File C:\web2py\hg\gluon\main.py, line 436, in wsgibase
      parse_get_post_vars(request, environ)
    File C:\web2py\hg\gluon\main.py, line 308, in parse_get_post_vars
      if pvalue:
    File C:\Python25\lib\cgi.py, line 633, in __len__
      return len(self.keys())
    File C:\Python25\lib\cgi.py, line 609, in keys
      raise TypeError, not indexable
  TypeError: not indexable

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




Re: [web2py:37091] Re: web2py DAL Boolean type does not play well with others

2009-12-12 Thread Thadeus Burgess
You have another problem of boolean fields that get exported to csv on
say sqlite, and need to be imported to the production server... there
will need to be a type conversion from T to 1.

-Thadeus





On Sat, Dec 12, 2009 at 9:36 AM, mdipierro mdipie...@cs.depaul.edu wrote:
 This is a good point. It is as it is because originally my concern was
 to have the same type mapped into the same type as much as possible.
 Another problem is that some systems do not allow storage of NULL in
 boolean and that requires treating the type as an exception.

 This cannot be changed for backward compatibility but it is trivial to
 create new adaptors for example

   db=DAL('sqlite+b://...')

 where sqlite+b would mean used boolean instead of char. This is
 already done for mssql

   db=DAL('mssql://...') uses BIT
   db=DAL('mssql2://...') uses CHAR(1)

 I will think about this some more but definitively should be solved.

 Massimo

 On Dec 12, 8:41 am, Markus Gritsch m.grit...@gmail.com wrote:
 Hi,

 web2py's Boolean implementation (as CHAR(1) with 'T' and 'F' values)
 periodically leads to some confusion [1][2].

 Further it leads to problems when trying to connect to an existing
 schema created by some other ORM.  Both SQLObject and SQLAlchemy use
 BOOLEAN as the SQL data type with values 0 and 1 (I have only checked
 the SQLite and MySQL backends).  Such existing data can only be used
 with the Integer datatype workaround which does not make me totally
 happy.

 It's even worse the other way around when web2py created the schema.
 I really do not like to use 'T' and 'F' for boolean columns in
 SQLObject queries.

 I cannot understand the recent 'portability reasons' argumentation in
 [2].  If a backend does not support BOOLEAN, the DAL may use the CHAR
 (1) workaround.  But on backends like SQLite and MySQL which do have a
 BOOLEAN data type it should be used, IMO.

 I know, for backwards compatibility reasons web2py cannot change its
 behavior.  However, the current behavior is bad for interoperability
 with other widely used ORMs.

 [1]http://groups.google.com/group/web2py/browse_thread/thread/c3b5e32c7a...
 [2]http://groups.google.com/group/web2py/browse_thread/thread/5a0039a8fb...

 --

 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.




--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37092] Re: Saving Session Variables via a Form

2009-12-12 Thread johntynan
Thank you for your suggestions.

At this point, I am not trying to create a record in the database at
the same time that I am setting a session variable.

What I would like to do is set session.organization_id (and possibly
session.organization_name) by way of a selection list.

I am able to get this form to *almost* work, see
session_organization_id_form here:

http://code.google.com/p/pledgedrivetracker/source/browse/pledgedrives/controllers/default.py?spec=svna6553088a4eaf244a425c4b0a367ffd46edf8b54r=a6553088a4eaf244a425c4b0a367ffd46edf8b54#78

and

http://code.google.com/p/pledgedrivetracker/source/browse/pledgedrives/views/default/session_organization_id_form.html?spec=svna6553088a4eaf244a425c4b0a367ffd46edf8b54r=a6553088a4eaf244a425c4b0a367ffd46edf8b54

However, what I would like to render is:

option value={{=organization.id}}{{=organization.name}}/option

For each row in the organization table.

And what I am getting is a dictionary for each row in the organization
table.

Do you have any suggestions for the syntax I would use to define the
value and text for each select tag in the form?


On Nov 27, 6:37 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 ERRATA:

 Do not use crud.form

 use instead

 form=SQLFORM(db.table)
 if FORM.accepts(form,request.vars):
     session.form_vars=form.vars

 On Nov 27, 7:36 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  Do not use crud.form

  use instead

  form=SQLFORM(db.table)
  if FORM.accepts(form,request.vars):
      session.form_vars=request.vars

  On Nov 27, 6:30 pm,johntynanjgty...@gmail.com wrote:

   I have a question about saving the values from a crud form as session
   variables (as opposed to updating a record in the database).

   Do you know where there might be a good example for doing this?

   To get started, I riffed off of the thread here:

  http://groups.google.com/group/web2py/browse_thread/thread/5343d94b45...

   And then modified the class set_cookies()  that I had started in
   controllers/default.py

   here:

  http://code.google.com/p/django-pledgedrive/source/browse/trunk/pledg...

   and in the simple session_form.html here:

  http://code.google.com/p/django-pledgedrive/source/browse/trunk/pledg...

   Thanks for any suggestions you might have!

   John T.



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37093] Re: web2py DAL Boolean type does not play well with others

2009-12-12 Thread mdipierro
This problem does not exist not and should not exist later (unless
there is a bug I am not aware of). Independently on how boolean is
stored in DB, it is bool in web2py (True/False, not 0/1 or 'T'/'F').
Therefore they are always exported and imported as bool.

massimo

On Dec 12, 10:53 am, Thadeus Burgess thade...@thadeusb.com wrote:
 You have another problem of boolean fields that get exported to csv on
 say sqlite, and need to be imported to the production server... there
 will need to be a type conversion from T to 1.

 -Thadeus

 On Sat, Dec 12, 2009 at 9:36 AM, mdipierro mdipie...@cs.depaul.edu wrote:
  This is a good point. It is as it is because originally my concern was
  to have the same type mapped into the same type as much as possible.
  Another problem is that some systems do not allow storage of NULL in
  boolean and that requires treating the type as an exception.

  This cannot be changed for backward compatibility but it is trivial to
  create new adaptors for example

    db=DAL('sqlite+b://...')

  where sqlite+b would mean used boolean instead of char. This is
  already done for mssql

    db=DAL('mssql://...') uses BIT
    db=DAL('mssql2://...') uses CHAR(1)

  I will think about this some more but definitively should be solved.

  Massimo

  On Dec 12, 8:41 am, Markus Gritsch m.grit...@gmail.com wrote:
  Hi,

  web2py's Boolean implementation (as CHAR(1) with 'T' and 'F' values)
  periodically leads to some confusion [1][2].

  Further it leads to problems when trying to connect to an existing
  schema created by some other ORM.  Both SQLObject and SQLAlchemy use
  BOOLEAN as the SQL data type with values 0 and 1 (I have only checked
  the SQLite and MySQL backends).  Such existing data can only be used
  with the Integer datatype workaround which does not make me totally
  happy.

  It's even worse the other way around when web2py created the schema.
  I really do not like to use 'T' and 'F' for boolean columns in
  SQLObject queries.

  I cannot understand the recent 'portability reasons' argumentation in
  [2].  If a backend does not support BOOLEAN, the DAL may use the CHAR
  (1) workaround.  But on backends like SQLite and MySQL which do have a
  BOOLEAN data type it should be used, IMO.

  I know, for backwards compatibility reasons web2py cannot change its
  behavior.  However, the current behavior is bad for interoperability
  with other widely used ORMs.

  [1]http://groups.google.com/group/web2py/browse_thread/thread/c3b5e32c7a...
  [2]http://groups.google.com/group/web2py/browse_thread/thread/5a0039a8fb...

  --

  You received this message because you are subscribed to the Google Groups 
  web2py-users group.
  To post to this group, send email to web...@googlegroups.com.
  To unsubscribe from this group, send email to 
  web2py+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/web2py?hl=en.



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37094] Re: Saving Session Variables via a Form

2009-12-12 Thread mdipierro
Instead of this:

form=FORM(SELECT(organizations,
_name='organization_id',requires=IS_IN_SET(organizations)),INPUT
(_type='submit'))


I would do

ids=[o.id for o in organizations]
names=[o.name for o in organizations]
form=SQLFORM.factory(Field('organizaiton_id',requires=IS_IN_SET
(ids,names)))


On Dec 12, 11:02 am, johntynan jgty...@gmail.com wrote:
 Thank you for your suggestions.

 At this point, I am not trying to create a record in the database at
 the same time that I am setting a session variable.

 What I would like to do is set session.organization_id (and possibly
 session.organization_name) by way of a selection list.

 I am able to get this form to *almost* work, see
 session_organization_id_form here:

 http://code.google.com/p/pledgedrivetracker/source/browse/pledgedrive...

 and

 http://code.google.com/p/pledgedrivetracker/source/browse/pledgedrive...

 However, what I would like to render is:

 option value={{=organization.id}}{{=organization.name}}/option

 For each row in the organization table.

 And what I am getting is a dictionary for each row in the organization
 table.

 Do you have any suggestions for the syntax I would use to define the
 value and text for each select tag in the form?

 On Nov 27, 6:37 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  ERRATA:

  Do not use crud.form

  use instead

  form=SQLFORM(db.table)
  if FORM.accepts(form,request.vars):
      session.form_vars=form.vars

  On Nov 27, 7:36 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   Do not use crud.form

   use instead

   form=SQLFORM(db.table)
   if FORM.accepts(form,request.vars):
       session.form_vars=request.vars

   On Nov 27, 6:30 pm,johntynanjgty...@gmail.com wrote:

I have a question about saving the values from a crud form as session
variables (as opposed to updating a record in the database).

Do you know where there might be a good example for doing this?

To get started, I riffed off of the thread here:

   http://groups.google.com/group/web2py/browse_thread/thread/5343d94b45...

And then modified the class set_cookies()  that I had started in
controllers/default.py

here:

   http://code.google.com/p/django-pledgedrive/source/browse/trunk/pledg...

and in the simple session_form.html here:

   http://code.google.com/p/django-pledgedrive/source/browse/trunk/pledg...

Thanks for any suggestions you might have!

John T.



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37095] Re: crud.update(...,message,...)

2009-12-12 Thread annet
Massimo,

 I am not sure I understand the problem. Let me assume you want the
 message displayed after redirection. In this case you need to use

 crud.update(...,message='')

 and message will be displayed after redirection.

The message didn't display after redirection because it was overridden
by
another response.flash, I had to rename one of the flashes to get the
flash
to work properly.

Thanks for pointing me in the right direction.

Annet.

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37096] Re: Omit default controller for for any action

2009-12-12 Thread kbochert
I added a slice at web2pyslices.com showing how I 'solved' this
problem.
see 'cleaner urls with routes.py'

Karl

On Nov 29, 6:58 am, mdipierro mdipie...@cs.depaul.edu wrote:
 If I understand you want that

 /f is mapped into /app/default/f

 for every f in default.py if there is no app called f and no
 controller called f.
 You have to explicitly list all cases of write a routes.py that builds
 routes_in diagrammatically.
 Else it is no obvous whether

 /f and f is an app, a controller of the default app or a function in
 the default controller. YOu must be explicit.

 On Nov 29, 3:19 am, Alex person...@gmail.com wrote:

  Looked there in the first place, then checked in bought manual.

  Didn't find any good way to do it.

  Dirty trick was to add rewrite rule in webserver.
  (*) - /myapp/default/

  and in routes.py out:
  /myapp/default/(?Pany.*) - '/(?Pany.*)'

  Drawbacks:
  Now I can have only one controller.
  For each new controller I should add new rewrite rule to web2py and
  webserver.
  I need to place static files to web2py/static/myapp/default instead of
  web2py/static
  because of werbserver's rewrite rule

  Is it the best suggested way of doing such thing? Too much drawbacks
  as for me.

  On Nov 29, 5:35 am, Iceberg iceb...@21cn.com wrote:

   On Nov29, 2:11am, Alex person...@gmail.com wrote:

Is there any way to omit default controller name in URL if there is
appropriate default controller action, like it's done for index action
but to work for any default controller action?

   Create a routes.py in your web2py directory. See web2py/
   route.example.py for detail.

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37097] Re: Fail login doesn't return an errorm msg

2009-12-12 Thread Yannick
Hello Massimo, thanks for the note...
i did follow your instructions which was :
1) I put this in the view {{=loginform}}
2) I print request.function and request.vars from the model
And here is what i see:
login
Storage {'email': 'sdfsdf...@efsdf.cfd', '_formkey':
'440a019c-1479-4b0d-8e86-b27c0496dd7a', 'password': '12w12123',
'_formname': 'login', '_next': ''}
login
Storage {}

It looks like there is a double redirect...

I did create a small brand new application just to test the login with
Auth using the web2py admin console ( Just to double check that is not
my code which cause this) and I have the same result...

I'll send you the code that I used to test it... I really don't know
why that happen, I think it use to work in the pass...

Thanks for your help...

Cheers,
Yannick P.

On Dec 11, 9:59 am, mdipierro mdipie...@cs.depaul.edu wrote:
 For debugging purposes

 1) try replace everything in the view with {{=loginform}}

 2) try print request.function, request.vars

 what do you see?

 Feel free to send me your code and I will take a look.

 massimo

 On Dec 11, 8:47 am, Yannick ytchatch...@gmail.com wrote:

  Yes I did comment this out auth.settings.login_next=URL(r=request,
  f='profile') 
  but still same old, the double redirect is still there... I really
  wonder what trigger that double redirection... there is nothing extra
  I'm doing here, I fulling using Auth API... Hmmm...

  On Dec 11, 9:33 am, Wes James compte...@gmail.com wrote:

   On Thu, Dec 10, 2009 at 8:09 PM, Yannick ytchatch...@gmail.com wrote:
Hello thanks for the note...

I did add print request.function
and Yes there is a double redirection because the output print the
function login twice :
login
login

I wonder how to fix this double redirection here is one of the setting
I have in my controller:
auth.settings.login_next=URL(r=request, f='profile')

   comment this out just to see what happens...

   or use wingide and see where it goes.

Do you have any idea... I'll keep debugging...

On Dec 9, 11:20 pm, mdipierro mdipie...@cs.depaul.edu wrote:
Add a

print request.function

to your model and check if there is a double redirect.
The other possibility is that sessions are not working.

On Dec 9, 9:12 pm, Yannick ytchatch...@gmail.com wrote:

 Is anyone already has this issue and where able to solve it... I 
 don't
 see any double redirect in my code...

 Thanks for your help...

 On Dec 9, 11:36 am, Wes James compte...@gmail.com wrote:

  Sorry,  I'm not sure exactly when/where I made this change in the 
  last
  week.  You can use wingide and check what the repsponse.flash is
  between function calls.

  -wes

  On Wed, Dec 9, 2009 at 8:49 AM, Yannick ytchatch...@gmail.com 
  wrote:
   Hmm interesting, thanks for the note... I don't think I'm doing a
   double redirection in my code though... can you please let me 
   know how
   you resolved that issue when you had it 

   Thanks,
   Yannick P.

   On Dec 9, 9:30 am, Wes James compte...@gmail.com wrote:
   On Tue, Dec 8, 2009 at 9:35 PM, Yannick ytchatch...@gmail.com 
   wrote:
hello mate,
I wonder  because I noticed that in auth, when the user fails 
to login
(enter a fake username and password) there is no error message
returned...

   Yannick,

   I just tried it on one of my sites and I got Invalid Login 
   flash message.

   I had the same issue on one of my forms not showing  field 
   validation
   errors.  It was as mr.freeze indicated, a double redirect that 
   was
   causing this .

   -wes

   --

   You received this message because you are subscribed to the 
   Google Groups web2py-users group.
   To post to this group, send email to web...@googlegroups.com.
   To unsubscribe from this group, send email to 
   web2py+unsubscr...@googlegroups.com.
   For more options, visit this group 
   athttp://groups.google.com/group/web2py?hl=en.

--

You received this message because you are subscribed to the Google 
Groups web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group 
athttp://groups.google.com/group/web2py?hl=en.

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37098] Re: sqlform view

2009-12-12 Thread __Kyo__
Thanks ^^

On 11 dic, 17:16, mdipierro mdipie...@cs.depaul.edu wrote:
 {{=SQLTABLE(rows,truncate=1000)}}

 On Dec 11, 4:10 pm, __Kyo__ iacastil...@gmail.com wrote:

  Hi, I use sqltable to show data, but i want to show al the field data,
  but it just shows me a part of it, like this:

  auth_user.id    auth_user.first_name    auth_user.last_name
  1                            Ivan                            Castillo 
  Ponc...

  I'd like to show this, using sqltable:

  auth_user.id    auth_user.first_name    auth_user.last_name
  1                            Ivan                            Castillo Ponce

  How can i do it? pls.
  Thanks.

  Thanks in advance

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37099] Using alternate login method with custom auth_user table

2009-12-12 Thread Diz
Hi All,

I'm trying to use a custom user table AND an alternate login method.
I get everything to work (i.e. no errors) BUT when I try to log in I
get a flash message saying:

Minimum length is 8
Must include at least 1 of the following : ~...@#$%^*()_+-=?,.:;{}[]|
Must include at least 1 upper case

It appears that with a custom user auth table name web2py not using
the alternate login method.

What am I doing wrong???

Key parts of the code are below (I've xed out confidential data) and
in the sequence called.

Thanks

Diz

auth_table = db.define_table('',
Field('first_name', length=128, default=''),
Field('last_name', length=128, default=''),
Field('email', length=128, default='', unique=True),
Field('password', 'password', length=256, readable=False,
label='Password'),
Field('registration_key', length=128, default= '', writable=False,
readable=False),
Field('email_work'),
Field('email_alternate'),
Field('phone_work'),
Field('phone_alternate'),
Field('phone_fax'),
Field('mailing_address','text'))

auth_table.first_name.requires = IS_NOT_EMPTY
(error_message=auth.messages.is_empty)
auth_table.last_name.requires = IS_NOT_EMPTY
(error_message=auth.messages.is_empty)
auth_table.password.requires = [IS_STRONG(), CRYPT()]
auth_table.email.requires = [IS_EMAIL
(error_message=auth.messages.invalid_email), IS_NOT_IN_DB(db,
auth_table.email)]

auth.settings.table_user = auth_table
auth.define_tables()

auth.settings.actions_disabled.append('register')
auth.settings.login_methods = [ email_auth(smtp..com:587,
@.com)]

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37100] Re: Using alternate login method with custom auth_user table

2009-12-12 Thread mr.freeze
Try removing the IS_STRONG validator temporarily and see if it works.

On Dec 12, 2:02 pm, Diz ken.disb...@gmail.com wrote:
 Hi All,

 I'm trying to use a custom user table AND an alternate login method.
 I get everything to work (i.e. no errors) BUT when I try to log in I
 get a flash message saying:

 Minimum length is 8
 Must include at least 1 of the following : ~...@#$%^*()_+-=?,.:;{}[]|
 Must include at least 1 upper case

 It appears that with a custom user auth table name web2py not using
 the alternate login method.

 What am I doing wrong???

 Key parts of the code are below (I've xed out confidential data) and
 in the sequence called.

 Thanks

 Diz

 auth_table = db.define_table('',
     Field('first_name', length=128, default=''),
     Field('last_name', length=128, default=''),
     Field('email', length=128, default='', unique=True),
     Field('password', 'password', length=256, readable=False,
 label='Password'),
     Field('registration_key', length=128, default= '', writable=False,
 readable=False),
     Field('email_work'),
     Field('email_alternate'),
     Field('phone_work'),
     Field('phone_alternate'),
     Field('phone_fax'),
     Field('mailing_address','text'))

 auth_table.first_name.requires = IS_NOT_EMPTY
 (error_message=auth.messages.is_empty)
 auth_table.last_name.requires = IS_NOT_EMPTY
 (error_message=auth.messages.is_empty)
 auth_table.password.requires = [IS_STRONG(), CRYPT()]
 auth_table.email.requires = [IS_EMAIL
 (error_message=auth.messages.invalid_email), IS_NOT_IN_DB(db,
 auth_table.email)]

 auth.settings.table_user = auth_table
 auth.define_tables()

 auth.settings.actions_disabled.append('register')
 auth.settings.login_methods = [ email_auth(smtp..com:587,
 @.com)]

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37101] multiple SQLForms and rows datetime problem

2009-12-12 Thread Mikey J
Hello,

I've four rows from db, four SQLForms in view.
{{=form1}}
{{=form2}}
{{=form3}}
{{=form4}}
forms come from same table and every form has two datetime fields.

calendar only works in first form in view. Does not mather witch form
comes first datetime picker works only in that form

Am I doing something wrong?

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37102] Re: Using alternate login method with custom auth_user table

2009-12-12 Thread Diz
Thanks...that was it.

I'm new to web2py and just don't have all the details down.  As I read
the the manual I see now why this wouldn't work but I won't of thought
of it in a million years.

To Massimo and all the developers: Thanks this is a great SIMPLE
framework.  I'm more productive with web2py after a week than I have
been with any other framework after years of working with them.

Regards

Diz

On Dec 12, 12:18 pm, mr.freeze nat...@freezable.com wrote:
 Try removing the IS_STRONG validator temporarily and see if it works.

 On Dec 12, 2:02 pm, Diz ken.disb...@gmail.com wrote:

  Hi All,

  I'm trying to use a custom user table AND an alternate login method.
  I get everything to work (i.e. no errors) BUT when I try to log in I
  get a flash message saying:

  Minimum length is 8
  Must include at least 1 of the following : ~...@#$%^*()_+-=?,.:;{}[]|
  Must include at least 1 upper case

  It appears that with a custom user auth table name web2py not using
  the alternate login method.

  What am I doing wrong???

  Key parts of the code are below (I've xed out confidential data) and
  in the sequence called.

  Thanks

  Diz

  auth_table = db.define_table('',
      Field('first_name', length=128, default=''),
      Field('last_name', length=128, default=''),
      Field('email', length=128, default='', unique=True),
      Field('password', 'password', length=256, readable=False,
  label='Password'),
      Field('registration_key', length=128, default= '', writable=False,
  readable=False),
      Field('email_work'),
      Field('email_alternate'),
      Field('phone_work'),
      Field('phone_alternate'),
      Field('phone_fax'),
      Field('mailing_address','text'))

  auth_table.first_name.requires = IS_NOT_EMPTY
  (error_message=auth.messages.is_empty)
  auth_table.last_name.requires = IS_NOT_EMPTY
  (error_message=auth.messages.is_empty)
  auth_table.password.requires = [IS_STRONG(), CRYPT()]
  auth_table.email.requires = [IS_EMAIL
  (error_message=auth.messages.invalid_email), IS_NOT_IN_DB(db,
  auth_table.email)]

  auth.settings.table_user = auth_table
  auth.define_tables()

  auth.settings.actions_disabled.append('register')
  auth.settings.login_methods = [ email_auth(smtp..com:587,
  @.com)]

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37103] Re: Custom Form Element For Crud.Create

2009-12-12 Thread Mengu
massimo,

can you please explain what you mean by processing xxx?

On Dec 11, 7:53 pm, Mengu whalb...@gmail.com wrote:
 thank you annet and massimo. your posts were helpful.

 massimo, what you mean by processing xxx on onaccept? like form =
 crud.create(table, onaccept=aMethodName) and then def aMethodName
 (form): form.vars.field = some value?

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37104] Re: multiple SQLForms and rows datetime problem

2009-12-12 Thread Mikey J
This problem comes also with default view.. and Firefox, IE7..  Too
depressed to try opera ;)

On 13 joulu, 00:45, Mikey J missingtu...@gmail.com wrote:
 Hello,

 I've four rows from db, four SQLForms in view.
 {{=form1}}
 {{=form2}}
 {{=form3}}
 {{=form4}}
 forms come from same table and every form has two datetime fields.

 calendar only works in first form in view. Does not mather witch form
 comes first datetime picker works only in that form

 Am I doing something wrong?

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37105] Re: Ngram based search. App

2009-12-12 Thread Richard
this seems useful for a cross database search application I had in
mind. Would you be able to describe more, particularly its limitations
and how you are using it?

Also, why did you role your own code for ngram similarity instead of
using the builtin difflib.SequenceMatcher?

Richard


On Dec 12, 9:46 am, Thadeus Burgess thade...@thadeusb.com wrote:
 http://static.thadeusb.com/web2py.app.ngram.w2p

 This uses a ngram class and will perform searches on content. With
 sample data from the populate() function, the results are not very
 good, however in a blog setting, with real sentences results are very
 accurate in my testing.

 -Thadeus

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37106] Re: new DAL('gae')

2009-12-12 Thread Richard
how did you add belongs support for GAE? I remember in a previous
discussion this was considered not possible/practical:
http://code.google.com/p/web2py/issues/detail?id=56can=1



On Dec 12, 4:42 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 I have re-factored a lot of code in gluon/contrib/gql.py in order to
 make it leaner, more readable and add new syntax. Now you can do mix
 and match queries like:

 q1=(db.table.id==1)
 q2=(db.table.id0)
 q3=(db.table.field.belongs(('value1','value2','value3')))

 in expressions like

 db(q1)(q2)q3).select()
 db(q1qq3).select()
 db(...).update(...)
 db(...).delete()

 Before this patch, belongs was not supported by web2py on GAE, q1 and
 q2 could not be mixed with other conditions.

 Now you can do for example:

     d=datetime.date.today()
     db.define_table('person',Field('name'),Field('birthday','date'))
     db.person.insert(name='John',birthday=d)
     rows=db(db.person.id0)(db.person.name.belongs(('John',))).count()
     rows=db(db.person.id==1)(db.person.name.belongs(('John',)))\
                   (birthday==d).update(name='Jim')

 Moreover the db['_lastsql'] now contains a complete representation of
 the last query on GAE and it can be used for debugging, and both db, db
 (...) and can serialized as a string.

 Please check it and report any problem.

 Also please let me know if you find places in the online documentation
 that have just become obsolete.

 Massimo

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37107] Re: Custom Form Element For Crud.Create

2009-12-12 Thread Mengu
so far, i have managed to do this:

def view():
postid = request.args(0)
post = db(db.post.id == postid).select()[0]
post.body = post.body.replace(\n, br /)
commentform = crud.create(db.comment, onaccept=_setPostId)
commentform[0].append(XML('input type=hidden name=post
value='+postid+' /'))
return dict(post=post, commentform=commentform)

def _setPostId(form):
db(db.comment.id == form.vars.id).select()[0].update_record
(post=request.vars.post)

however as you can see, it sets the post for the comment after
inserting the comment despite the fact that the hidden post field has
a value inside the form which does not get posted. isn't this a bug? i
also should note that post field is not readable and writable.

thanks again.

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37108] Re: multiple SQLForms and rows datetime problem

2009-12-12 Thread mr.freeze
You're not doing anything wrong. It's either a problem with the
calendar.js plugin or the way it is implemented in web2py_ajax.html.

On Dec 12, 5:49 pm, Mikey J missingtu...@gmail.com wrote:
 This problem comes also with default view.. and Firefox, IE7..  Too
 depressed to try opera ;)

 On 13 joulu, 00:45, Mikey J missingtu...@gmail.com wrote:

  Hello,

  I've four rows from db, four SQLForms in view.
  {{=form1}}
  {{=form2}}
  {{=form3}}
  {{=form4}}
  forms come from same table and every form has two datetime fields.

  calendar only works in first form in view. Does not mather witch form
  comes first datetime picker works only in that form

  Am I doing something wrong?



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37109] Re: multiple SQLForms and rows datetime problem

2009-12-12 Thread Mikey J
So I very much need help to solve this.
custom widget tutor could also help.

On 13 joulu, 02:31, mr.freeze nat...@freezable.com wrote:
 You're not doing anything wrong. It's either a problem with the
 calendar.js plugin or the way it is implemented in web2py_ajax.html.

 On Dec 12, 5:49 pm, Mikey J missingtu...@gmail.com wrote:

  This problem comes also with default view.. and Firefox, IE7..  Too
  depressed to try opera ;)

  On 13 joulu, 00:45, Mikey J missingtu...@gmail.com wrote:

   Hello,

   I've four rows from db, four SQLForms in view.
   {{=form1}}
   {{=form2}}
   {{=form3}}
   {{=form4}}
   forms come from same table and every form has two datetime fields.

   calendar only works in first form in view. Does not mather witch form
   comes first datetime picker works only in that form

   Am I doing something wrong?

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37111] Re: new DAL('gae')

2009-12-12 Thread mdipierro
At some point GAE added support for the IN operator. I do not know
when but when I found out I added it (belongs maps to IN). Notice that
this is not the same as LIKE.

Massimo

On Dec 12, 6:19 pm, Richard richar...@gmail.com wrote:
 how did you add belongs support for GAE? I remember in a previous
 discussion this was considered not 
 possible/practical:http://code.google.com/p/web2py/issues/detail?id=56can=1

 On Dec 12, 4:42 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  I have re-factored a lot of code in gluon/contrib/gql.py in order to
  make it leaner, more readable and add new syntax. Now you can do mix
  and match queries like:

  q1=(db.table.id==1)
  q2=(db.table.id0)
  q3=(db.table.field.belongs(('value1','value2','value3')))

  in expressions like

  db(q1)(q2)q3).select()
  db(q1qq3).select()
  db(...).update(...)
  db(...).delete()

  Before this patch, belongs was not supported by web2py on GAE, q1 and
  q2 could not be mixed with other conditions.

  Now you can do for example:

      d=datetime.date.today()
      db.define_table('person',Field('name'),Field('birthday','date'))
      db.person.insert(name='John',birthday=d)
      rows=db(db.person.id0)(db.person.name.belongs(('John',))).count()
      rows=db(db.person.id==1)(db.person.name.belongs(('John',)))\
                    (birthday==d).update(name='Jim')

  Moreover the db['_lastsql'] now contains a complete representation of
  the last query on GAE and it can be used for debugging, and both db, db
  (...) and can serialized as a string.

  Please check it and report any problem.

  Also please let me know if you find places in the online documentation
  that have just become obsolete.

  Massimo



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37112] Re: Custom Form Element For Crud.Create

2009-12-12 Thread mdipierro
I do not understand what you are tryng to do. If the postid is already
in the URL (request.args(0)) why to you put it in the form?

My best guess is that you are trying to do this:

def view():
postid = request.args(0)
## post.body = post.body.replace(\n, br /)  WARNING
db.comment.post.readable=False
db.comment.post.writaable=False
db.comment.post.default=postid
commentform = crud.create(db.comment)
return dict(post=post, commentform=commentform)

WARNING. The replace you are doing tells me you have XML(post.body) in
the view. IF this is the case your app has XSS vulnerability. Do not
do

{{=XML(post.body.replace(\n, br /))}}

but do

{{=XML(post.body.replace(\n, br /),sanitize=True)}}

or

{{from gluon.contrib.markdown import WIKI}}
{{=WIKI(post.body)}}

Massimo



On Dec 12, 6:22 pm, Mengu whalb...@gmail.com wrote:
 so far, i have managed to do this:

 def view():
     postid = request.args(0)
     post = db(db.post.id == postid).select()[0]
     post.body = post.body.replace(\n, br /)
     commentform = crud.create(db.comment, onaccept=_setPostId)
     commentform[0].append(XML('input type=hidden name=post
 value='+postid+' /'))
     return dict(post=post, commentform=commentform)

 def _setPostId(form):
     db(db.comment.id == form.vars.id).select()[0].update_record
 (post=request.vars.post)

 however as you can see, it sets the post for the comment after
 inserting the comment despite the fact that the hidden post field has
 a value inside the form which does not get posted. isn't this a bug? i
 also should note that post field is not readable and writable.

 thanks again.

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37114] Re: HELP with new DAL

2009-12-12 Thread mr.freeze
I updated and get this now:

Traceback (most recent call last):
File C:\\web2py\\gluon\\main.py, line 551, in wsgibase
SQLDB.close_all_instances(SQLDB.rollback)
AttributeError: type object 'SQLDB\' has no attribute
'close_all_instances\'


On Dec 12, 11:27 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 I am rewriting the DAL to make more modular. 75% is done and it is in
 trunk.

 Please take a look. I need one official tester for each supported
 database backend (except sqlite since I can do that)

 Any volunteer?

 Now every supported backend has an adapter and most funcitons are
 delegated to the adapter so it will be easy to extend to other RDBS.
 There are still a few exceptions here and there need to be moved into
 the adapter APIs.

 Comments are appreciated. Hope this is going in the direction that
 people expect.

 Massimo

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37115] Re: HELP with new DAL

2009-12-12 Thread mdipierro
oops. I always tested the new DAL isolated. I forgot to integrate it
with the rest of web2py.
Done now. Please try again.

Massimo

On Dec 13, 12:23 am, mr.freeze nat...@freezable.com wrote:
 I updated and get this now:

 Traceback (most recent call last):
 File C:\\web2py\\gluon\\main.py, line 551, in wsgibase
 SQLDB.close_all_instances(SQLDB.rollback)
 AttributeError: type object 'SQLDB\' has no attribute
 'close_all_instances\'

 On Dec 12, 11:27 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  I am rewriting the DAL to make more modular. 75% is done and it is in
  trunk.

  Please take a look. I need one official tester for each supported
  database backend (except sqlite since I can do that)

  Any volunteer?

  Now every supported backend has an adapter and most funcitons are
  delegated to the adapter so it will be easy to extend to other RDBS.
  There are still a few exceptions here and there need to be moved into
  the adapter APIs.

  Comments are appreciated. Hope this is going in the direction that
  people expect.

  Massimo



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37116] Re: HELP with new DAL

2009-12-12 Thread mdipierro
When finished (not yet) it would be nice to run some benchmarks.

Massimo

On Dec 13, 1:00 am, mdipierro mdipie...@cs.depaul.edu wrote:
 oops. I always tested the new DAL isolated. I forgot to integrate it
 with the rest of web2py.
 Done now. Please try again.

 Massimo

 On Dec 13, 12:23 am, mr.freeze nat...@freezable.com wrote:

  I updated and get this now:

  Traceback (most recent call last):
  File C:\\web2py\\gluon\\main.py, line 551, in wsgibase
  SQLDB.close_all_instances(SQLDB.rollback)
  AttributeError: type object 'SQLDB\' has no attribute
  'close_all_instances\'

  On Dec 12, 11:27 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   I am rewriting the DAL to make more modular. 75% is done and it is in
   trunk.

   Please take a look. I need one official tester for each supported
   database backend (except sqlite since I can do that)

   Any volunteer?

   Now every supported backend has an adapter and most funcitons are
   delegated to the adapter so it will be easy to extend to other RDBS.
   There are still a few exceptions here and there need to be moved into
   the adapter APIs.

   Comments are appreciated. Hope this is going in the direction that
   people expect.

   Massimo



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




Re: [web2py:37117] Re: Ngram based search. App

2009-12-12 Thread Thadeus Burgess
SequenceMatcher is for comparing one file to another file... and would
be god awefull if you were to try and index an entire database of
content. I just glanced at SequenceMatcher however, and it does not
seem to suit my needs.

The biggest limitation I would say would be finding the right
min-sim. Depending on length of content, and searched characters,
the similarity gets thrown off when you try to search for a single
word. If you are indexing paragraphs (or say blog posts) the search
performs much better when more keywords are typed in.

With the demo, try changing the min-sim around, with the same query,
and see how drastically the result set can change.

Where I originally implemented this in was a mp3 playlist creator, I
stored artist names, albums, etc as their own separate ngram lists.
This is where ngram's really shine, comparing single-word to
single-word.

-Thadeus





On Sat, Dec 12, 2009 at 6:08 PM, Richard richar...@gmail.com wrote:
 difflib.SequenceMatcher

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.