[web2py:27877] Re: How to change how IS_IN_DB() is rendered?

2009-08-03 Thread Fran

On Aug 2, 11:32 pm, Alastair Medford 
wrote:
> Alright, this quetion seems like it should have an easy answer and I'm
> just missing something. Currently IS_IN_DB is rendered as a drop down
> box. What I would like to do is have the user be able to type in an
> identification number (which as you can guess is not very easy to find
> in a dropdown or autofilled by jquery), and have it validated as being
> an ictual I.D in the database upon form submission. I'm currently
> using SQLFORM to create the form. Since as I understand it IS_IN_DB
> verifies it is in the table by fetching and listing the table entries,
> and SQLFORM first validates then submits the form, I'm a bit at a loss
> as to how to accomplish this. The only place I can think of putting a
> check is in the form accepts, but it has already been sent to the
> database by that point. Can what I'm trying to do be accomplished with
> SQLFORM or should I be doing something different? Thanks.

This should do what you want:
crud.create(db.table, onvalidation=lambda: form: myvalidator(form))

onvalidation callback runs before DB I/O
(onaccept callback is after DB I/O)

F
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27878] Re: How to change how IS_IN_DB() is rendered?

2009-08-03 Thread Fran

On Aug 3, 9:53 am, Fran  wrote:
> This should do what you want:
> crud.create(db.table, onvalidation=lambda: form: myvalidator(form))
> onvalidation callback runs before DB I/O
> (onaccept callback is after DB I/O)

Actually, I see that SQLFORM's accepts() method includes an
onvalidation callback as well...no need to used crud...

F
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27879] Re: hidden fields

2009-08-03 Thread Fran

On Aug 2, 9:19 pm, mattynoce  wrote:
> hi, i have a question about hidden fields.
> i have a form that looks like this:
> fields=['f1','f2','f3'...]
> hidden=dict(fieldname=val)
> form = SQLFORM(db.table, fields=fields, showid=False, hidden=hidden)
> in the view it's simply {{=form}}
> when i look at the view, there's a hidden input field for my hidden
> field. however, when i do the insert, the hidden field is not getting
> inserted into my db. the accept info is:
>     if form.accepts(request.vars,session):
>          session.flash='Added'
>          redirect(URL(r=request, f="function"))
> am i doing something wrong? why would the hidden field show up
> properly in the view but not update the db?

Hi Matt,

I didn't know about this functionality before as it's not a documented
option in the docstring for SQLFORM (or FORM), but I see it in the
manual now.

Looking at the code in sqlhtml.py, it seems that the hidden fields
aren't processed by SQLFORM itself...I guess this is a design rather
than a bug (the hidden fields would normally be for other things than
DB fields).

You have several options to achieve what you want, including:
(1) Process this field manually in the 'if form.accepts' part
(2) Don't pass the field as hidden to 'form' but instead use jQuery to
hide the row (default value can be set within model or by jQuery)
(3) Follow Massimo's suggestion:
db.table.hidden_field.writable = False
form = SQLFORM(db.table, fields=fields, showid=False, hidden=hidden)
db.table.hidden_field.writable = True
if form.accepts(request.vars,session):

Best Wishes,
Fran.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27880] Re: Fwd: My thoughts on web2py

2009-08-03 Thread Pynthon

I'm reading this topic for a time and it really makes me doubt about
web2py =[. Hopefully Massimo can fix this =].

On 3 aug, 02:46, Bottiger  wrote:
> I haven't had time to verify the other findings, but there are
> definitely file handle leakages. I can never delete an application if
> I just visited it once.
>
> On Aug 2, 12:21 pm, mdipierro  wrote:
>
> > I am about to catch a plane so I will be short. We can talk more about
> > this in a couple of days.
>
> > > > First a word of warning.  I send you this mail in private because I  
> > > > want
> > > > to share my thoughts on the web2py code and because I hope I can help
> > > > with that somehow.  You're free to publish this mail if you want.
>
> > This is constructive criticism so I appreciate it.
>
> > > > As you might remember I came in contract with web2py a long ago when  
> > > > you
> > > > were evaluating pygments as a syntax highlighter for the web2py
> > > > documentation or something and you decided to implement your own  
> > > > because
> > > > you were unable to "ship" pygments as part of web2py.  As far as I
> > > > remember py2app or py2exe were not able to pick up the on-demand  
> > > > imports
> > > > in the lexer module.
>
> > > > I have been watching the development ever since because (And please
> > > > don't think bad of me because of that) it appeared to me that web2py  
> > > > was
> > > > a joke.  I remember reading some very early revisions of your PDF
> > > > documentation where I remember a code that looks something like that:
>
> > > >    db.define_table('something', db.Field('meh', 'date',
> > > >                    default=date.today()))
>
> > > > That line freaked me out.  This line alone showed me that web2py is
> > > > doing something very, very weird.  From this line I could see that it
> > > > means one of the following two things:
>
> > > > - either the code has a bug for long running applications (in this  
> > > > case
> > > >  when the application code runs longer than a day in which case the
> > > >  default would have to change dynamically)
>
> > > > - or the global scope has different semantics and is reevaluated each
> > > >  request.
>
> > > > Turns out the latter is what happens in web2py.
>
> > Correct.
>
> > > There still is a race
> > > > condition but only a small one.
>
> > No there is not. Why do you think there is a race condition?
>
> > > The bigger problem with this  
> > > > however is
> > > > that this means the (not so) static definitions are reevaluated each
> > > > request.
>
> > Correct. A small price to pay for a lot of flexibility.
> > We are working on lazy evaluation of tables.
> > There is also a speedup if you press the "compile" button in admin.
>
> > > > Especially for the database table definitions (which cause many  
> > > > function
> > > > calls) this means an enormous per-request penality if you have many of
> > > > them.  I even remember reading a case like this in the web2py  
> > > > newsgroup
> > > > about someone who had twenty table definitions or something and the
> > > > majority of the request time was spent setting up the tables.
>
> > There was a slow down problem that has been fixed by Alexey. I agree
> > there is still room for improvement.
>
> > > > However that also means another thing.  Standard Python  
> > > > optimizations no
> > > > longer apply.  In Python usually modules are cached in an interpreter
> > > > bound dictionary for reusing.  This of course does not apply for  
> > > > web2py.
> > > > However the second problem here is that only the local scope gets
> > > > certain optimizations in cpython such as fast-local lookup.  Instead  
> > > > of
> > > > storing the variables in a dictionary they are instead stored in an an
> > > > object where items are looked up by index (fast locals) rather than  
> > > > by a
> > > > string.
>
> > > > Now of course one can argue that this is the way it's intended.  
> > > > That's
> > > > nice but for that, the documentation is lacking.
>
> > Yes it is true that documentation is lacking.
>
> > >  There is no
> > > > explanation of what implications this has on the code.  And in
> > > > comparison with "enterprise ready" that gives me a strange feeling  
> > > > about
> > > > the project.
>
> > > > I'm not even exactly sure what kills web2py for me in the end, but I'm
> > > > pretty sure that part of the reason is the way the project is  
> > > > advertised.
>
> > We prefer to talk about "advocating" not "advertising" since we do not
> > sell it.
> > Mistakes were made on my side.
>
> > > > web2py does not have worse code than many popular libraries out there.
>
> > Thanks. I take is as a compliment.
>
> > > > BeautifulSoup comes to mind.  That library does some really ugly  
> > > > things
> > > > there including monkeypatching of the standard library.  It does
> > > > different things depending on the version of Python it's running on  
> > > > and
> > > > in the code are some really ugly idioms like a unicode sub

[web2py:27881] Re: Fwd: My thoughts on web2py

2009-08-03 Thread Jason Brower

I am happy for the efforts being made in web2py.  I think we should have
a better way to file a bug or request a feature.  But after buying the
book, I am very happy documentation wise.


On Mon, 2009-08-03 at 06:18 -0700, Pynthon wrote:
> I'm reading this topic for a time and it really makes me doubt about
> web2py =[. Hopefully Massimo can fix this =].
> 
> On 3 aug, 02:46, Bottiger  wrote:
> > I haven't had time to verify the other findings, but there are
> > definitely file handle leakages. I can never delete an application if
> > I just visited it once.
> >
> > On Aug 2, 12:21 pm, mdipierro  wrote:
> >
> > > I am about to catch a plane so I will be short. We can talk more about
> > > this in a couple of days.
> >
> > > > > First a word of warning.  I send you this mail in private because I  
> > > > > want
> > > > > to share my thoughts on the web2py code and because I hope I can help
> > > > > with that somehow.  You're free to publish this mail if you want.
> >
> > > This is constructive criticism so I appreciate it.
> >
> > > > > As you might remember I came in contract with web2py a long ago when  
> > > > > you
> > > > > were evaluating pygments as a syntax highlighter for the web2py
> > > > > documentation or something and you decided to implement your own  
> > > > > because
> > > > > you were unable to "ship" pygments as part of web2py.  As far as I
> > > > > remember py2app or py2exe were not able to pick up the on-demand  
> > > > > imports
> > > > > in the lexer module.
> >
> > > > > I have been watching the development ever since because (And please
> > > > > don't think bad of me because of that) it appeared to me that web2py  
> > > > > was
> > > > > a joke.  I remember reading some very early revisions of your PDF
> > > > > documentation where I remember a code that looks something like that:
> >
> > > > >db.define_table('something', db.Field('meh', 'date',
> > > > >default=date.today()))
> >
> > > > > That line freaked me out.  This line alone showed me that web2py is
> > > > > doing something very, very weird.  From this line I could see that it
> > > > > means one of the following two things:
> >
> > > > > - either the code has a bug for long running applications (in this  
> > > > > case
> > > > >  when the application code runs longer than a day in which case the
> > > > >  default would have to change dynamically)
> >
> > > > > - or the global scope has different semantics and is reevaluated each
> > > > >  request.
> >
> > > > > Turns out the latter is what happens in web2py.
> >
> > > Correct.
> >
> > > > There still is a race
> > > > > condition but only a small one.
> >
> > > No there is not. Why do you think there is a race condition?
> >
> > > > The bigger problem with this  
> > > > > however is
> > > > > that this means the (not so) static definitions are reevaluated each
> > > > > request.
> >
> > > Correct. A small price to pay for a lot of flexibility.
> > > We are working on lazy evaluation of tables.
> > > There is also a speedup if you press the "compile" button in admin.
> >
> > > > > Especially for the database table definitions (which cause many  
> > > > > function
> > > > > calls) this means an enormous per-request penality if you have many of
> > > > > them.  I even remember reading a case like this in the web2py  
> > > > > newsgroup
> > > > > about someone who had twenty table definitions or something and the
> > > > > majority of the request time was spent setting up the tables.
> >
> > > There was a slow down problem that has been fixed by Alexey. I agree
> > > there is still room for improvement.
> >
> > > > > However that also means another thing.  Standard Python  
> > > > > optimizations no
> > > > > longer apply.  In Python usually modules are cached in an interpreter
> > > > > bound dictionary for reusing.  This of course does not apply for  
> > > > > web2py.
> > > > > However the second problem here is that only the local scope gets
> > > > > certain optimizations in cpython such as fast-local lookup.  Instead  
> > > > > of
> > > > > storing the variables in a dictionary they are instead stored in an an
> > > > > object where items are looked up by index (fast locals) rather than  
> > > > > by a
> > > > > string.
> >
> > > > > Now of course one can argue that this is the way it's intended.  
> > > > > That's
> > > > > nice but for that, the documentation is lacking.
> >
> > > Yes it is true that documentation is lacking.
> >
> > > >  There is no
> > > > > explanation of what implications this has on the code.  And in
> > > > > comparison with "enterprise ready" that gives me a strange feeling  
> > > > > about
> > > > > the project.
> >
> > > > > I'm not even exactly sure what kills web2py for me in the end, but I'm
> > > > > pretty sure that part of the reason is the way the project is  
> > > > > advertised.
> >
> > > We prefer to talk about "advocating" not "advertising" since we do not
> > > sell it.
> > > Mistakes wer

[web2py:27882] Re: Fwd: My thoughts on web2py

2009-08-03 Thread Pynthon

True, hopefully Massimo can make the inner of W2P nicer.

On 3 aug, 15:26, Jason Brower  wrote:
> I am happy for the efforts being made in web2py.  I think we should have
> a better way to file a bug or request a feature.  But after buying the
> book, I am very happy documentation wise.
>
> On Mon, 2009-08-03 at 06:18 -0700, Pynthon wrote:
> > I'm reading this topic for a time and it really makes me doubt about
> > web2py =[. Hopefully Massimo can fix this =].
>
> > On 3 aug, 02:46, Bottiger  wrote:
> > > I haven't had time to verify the other findings, but there are
> > > definitely file handle leakages. I can never delete an application if
> > > I just visited it once.
>
> > > On Aug 2, 12:21 pm, mdipierro  wrote:
>
> > > > I am about to catch a plane so I will be short. We can talk more about
> > > > this in a couple of days.
>
> > > > > > First a word of warning.  I send you this mail in private because I 
> > > > > >  
> > > > > > want
> > > > > > to share my thoughts on the web2py code and because I hope I can 
> > > > > > help
> > > > > > with that somehow.  You're free to publish this mail if you want.
>
> > > > This is constructive criticism so I appreciate it.
>
> > > > > > As you might remember I came in contract with web2py a long ago 
> > > > > > when  
> > > > > > you
> > > > > > were evaluating pygments as a syntax highlighter for the web2py
> > > > > > documentation or something and you decided to implement your own  
> > > > > > because
> > > > > > you were unable to "ship" pygments as part of web2py.  As far as I
> > > > > > remember py2app or py2exe were not able to pick up the on-demand  
> > > > > > imports
> > > > > > in the lexer module.
>
> > > > > > I have been watching the development ever since because (And please
> > > > > > don't think bad of me because of that) it appeared to me that 
> > > > > > web2py  
> > > > > > was
> > > > > > a joke.  I remember reading some very early revisions of your PDF
> > > > > > documentation where I remember a code that looks something like 
> > > > > > that:
>
> > > > > >    db.define_table('something', db.Field('meh', 'date',
> > > > > >                    default=date.today()))
>
> > > > > > That line freaked me out.  This line alone showed me that web2py is
> > > > > > doing something very, very weird.  From this line I could see that 
> > > > > > it
> > > > > > means one of the following two things:
>
> > > > > > - either the code has a bug for long running applications (in this  
> > > > > > case
> > > > > >  when the application code runs longer than a day in which case the
> > > > > >  default would have to change dynamically)
>
> > > > > > - or the global scope has different semantics and is reevaluated 
> > > > > > each
> > > > > >  request.
>
> > > > > > Turns out the latter is what happens in web2py.
>
> > > > Correct.
>
> > > > > There still is a race
> > > > > > condition but only a small one.
>
> > > > No there is not. Why do you think there is a race condition?
>
> > > > > The bigger problem with this  
> > > > > > however is
> > > > > > that this means the (not so) static definitions are reevaluated each
> > > > > > request.
>
> > > > Correct. A small price to pay for a lot of flexibility.
> > > > We are working on lazy evaluation of tables.
> > > > There is also a speedup if you press the "compile" button in admin.
>
> > > > > > Especially for the database table definitions (which cause many  
> > > > > > function
> > > > > > calls) this means an enormous per-request penality if you have many 
> > > > > > of
> > > > > > them.  I even remember reading a case like this in the web2py  
> > > > > > newsgroup
> > > > > > about someone who had twenty table definitions or something and the
> > > > > > majority of the request time was spent setting up the tables.
>
> > > > There was a slow down problem that has been fixed by Alexey. I agree
> > > > there is still room for improvement.
>
> > > > > > However that also means another thing.  Standard Python  
> > > > > > optimizations no
> > > > > > longer apply.  In Python usually modules are cached in an 
> > > > > > interpreter
> > > > > > bound dictionary for reusing.  This of course does not apply for  
> > > > > > web2py.
> > > > > > However the second problem here is that only the local scope gets
> > > > > > certain optimizations in cpython such as fast-local lookup.  
> > > > > > Instead  
> > > > > > of
> > > > > > storing the variables in a dictionary they are instead stored in an 
> > > > > > an
> > > > > > object where items are looked up by index (fast locals) rather than 
> > > > > >  
> > > > > > by a
> > > > > > string.
>
> > > > > > Now of course one can argue that this is the way it's intended.  
> > > > > > That's
> > > > > > nice but for that, the documentation is lacking.
>
> > > > Yes it is true that documentation is lacking.
>
> > > > >  There is no
> > > > > > explanation of what implications this has on the code.  And in
> > > > > > comparison with "enterprise re

[web2py:27883] Re: r1045 breaks some upload fields

2009-08-03 Thread Jose



On 2 ago, 21:25, Fran  wrote:
> Really bizarre this as my simple testcases work fine.
> However r1044 works with my app whereas 1045 doesn't

Fran

I have the version 1.65.9 (r1153).
Do not be from when it is happening, but yesterday I noticed that the
images are not uploaded.

The only changes that I did were:
1) To update web2py
2) to migrate of py2.5 to py2.6 (SO: Freebsd)

Jose
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27884] Re: Google seems to know Web2Py

2009-08-03 Thread dlypka

PolyModel enables true polymorphic behavior when querying objects
whose classes are derived from other classes.
So, in the retrieved instance, all fields of all classes at and above
the target class are available to the retrieved instance.

When PolyModel is not used as the base class, then the query only
returns  the attributes of the queried class.
Attributes of inherited classes are uninitialized.

So using PolyModel as the base class, the web2py DAL classes can carry
along GAE-specific attributes in base classes,
one of the most useful being the Reference attribute, which will link
together related instances so that GAE will return them in a single
query.
Also, Reference gives automatic bidirectional links.

On Aug 2, 1:17 pm, mdipierro  wrote:
> What is PolyModel? How is different than what DAL already does when
> running on GAE?
>
> On Aug 2, 11:33 am, dlypka  wrote:
>
>
>
> > I just got an experimental version of T3 to work with the PolyModel
> > base class in GAE.
> > That gives inherited Classes.
> > So GAE is Quite Amazing.
>
> > I almost have my own DALnr ('nr' = non relational) for web2py working
> > with GAE now.
> > It is using my 'Phantom' Field concept (special table fields in a
> > db.define_table(...) which do native GAE operations but are not
> > otherwise part of the list of columns for that web2py table)
>
> > In particular I got PolyModel to work together with the Reference
> > feature which links together the related entities so that GAE loads
> > them ***ALL*** in a
> > single datastore query.
>
> > In theory, my DALnr will allow creating web2py models which will work
> > on both SQL and GAE and will automatically use 'nr' GAE native
> > features if on GAE.
>
> > ToDo: I still have to generalize my DALnr code.
>
> > My first application of this DALnr is to a high performance TreeView
> > control which loads all branches of a given level in PARALLEL using
> > async multi simultaneous Ajax callbacks.
>
> > On Aug 2, 11:34 am, Pynthon  wrote:
>
> > > IMO GAE is too difficult :P.
>
> > > On 2 aug, 07:02, Bottiger  wrote:
>
> > > > Google has sunk too much time and effort into adapting Django to
> > > > recommend another framework. They also need to attract more users to
> > > > GAE which Django has plenty of.
>
> > > > On Aug 1, 3:12 pm, mdipierro  wrote:
>
> > > > > Yes, if only they'd understand we support GAE better than Django does.
> > > > > Our DAL and our appadmin work on GAE, the Django ORM and Django admin
> > > > > do not as far as I know.
>
> > > > > Massimo
>
> > > > > On Aug 1, 3:10 pm, Pynthon  wrote:
>
> > > > > > Watch 
> > > > > > this:http://googleappengine.blogspot.com/2009/05/web2py-support-new-datast...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27885] Re: Fwd: My thoughts on web2py

2009-08-03 Thread suiato

I found this thread encouraging. It shows Massimo and members here are
open to different views/opinions while maintaining integrity. That's
essential for open-source software to evolve. E.g., who thought  in
the early 1990's Linux was going to be as serious a software as we see
today?

Cheers,
Teru
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27886] ldap-auth issue

2009-08-03 Thread Johann Spies

I want to do have a website on which I can register a few usernames.
Only they may authentiicate and they must authenticate against a
central ldap server.

At the moment  I have the following in db.py:


if request.env.web2py_runtime_gae:# if running on Google App Engine
db = DAL('gae')   # connect to Google BigTable
session.connect(request, response, db=db) # and store sessions and
tickets there
else: # else use a normal
relational database
db = DAL('sqlite://storage.sqlite')   # if not, use SQLite or other DB

from gluon.contrib.login_methods.ldap_auth import ldap_auth
from gluon.tools import *
auth=Auth(globals(),db)  # authentication/authorization
crud=Crud(globals(),db)  # for CRUD helpers using auth
service=Service(globals())   # for json, xml, jsonrpc,
xmlrpc, amfrpc
auth.settings.login_methods=[ldap_auth(server='stbldap01.sun.ac.za',base_dn='ou=users,O=SU',
mode='cn', secure=True)]

auth.settings.table_user =
db.define_table("auth_user",db.Field("first_name",length=128,default=""),
   db.Field("last_name", length=128,default=""),
   db.Field("email", length=128,default=""),
   db.Field("username", length=32,default=""),

db.Field("password",'password',readable=False, label="Password"),
   db.Field("registration_key", length=128,
   writable=False, readable=False, default=""))
t = auth.settings.table_user
t.first_name.requires = IS_NOT_EMPTY()
t.username.requires = IS_NOT_EMPTY()
t.last_name.requires = IS_NOT_EMPTY()
t.password.requires = CRYPT() # password will be stored hashed
t.email.requires = [IS_EMAIL(), IS_NOT_IN_DB(db, db.auth_user.email)]
t.username.requires = [IS_NOT_IN_DB(db, db.auth_user.username)]
auth.define_tables() ### auth_user will not be redefined!
crud.settings.auth=auth  # enforces authorization on crud
mail=Mail()  # mailer
mail.settings.server='localhost'# your SMTP server
mail.settings.sender='johann.sp...@gmail.com' # your email

Now my question:

When I register a user I don't want the user to enter a password
because when the user logs in in future the password must be checked
against the hash in the LDAP tree. So when I register myself (with or
without a password on registration) I cannot log in afterwords.  All
my logins ends with "Invalid login".  How can I find out what went
wrong?  Is ther some sort of log somewhere?

Regards
Johann

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27887] Re: Fwd: My thoughts on web2py

2009-08-03 Thread Pynthon Pynthon
Indeed, but I still hope that Massimo can fix this stuff :P.

2009/8/3 suiato 

>
> I found this thread encouraging. It shows Massimo and members here are
> open to different views/opinions while maintaining integrity. That's
> essential for open-source software to evolve. E.g., who thought  in
> the early 1990's Linux was going to be as serious a software as we see
> today?
>
> Cheers,
> Teru
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27888] Re: Hosting and Future

2009-08-03 Thread weheh

I believe that any host that handles Plone/Zope would probably be a
good option for you for supporting web2py. There are a few of them out
there that cost a few tens-of-bucks a year. You'll have to hunt
around. Search for "Zope hosting" or "Plone hosting".
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27889] Sharing Auth user table between two registration processes

2009-08-03 Thread Carl

hi

Has anyone had a simlilar requirement and used a different/better
approach that that described below?

I have 2 registration forms to cover my 2 user groups. Each is
prompted to register with a different subset of Auth User fields.

I've extended Auth to include the additional fields (e.g., Country,
Billing Country). The challenge is that for only one set of users are
some fields are Mandatory.

To achieve this I did the following:

1. set-up a table called iso3166 to hold a standard set of countries.

2. in my custom autrh user table include this statement:
db.Field('country', db.iso3166, requires=IS_NULL_OR(IS_INT_IN_RANGE(0,
1e100) ) )

I set 'requires' here otherwise the framework jumps in at this point
and will insist that this field has a validator to check that the
field is always set to an integer. My setting enables one of my
registration UIs to ignore the field.

3. in my controller...

for the form that prompts the user for country:
db.auth_user.country.requires = IS_IN_DB(db, db.iso3166.id, '%(country)
s', orderby=db.iso3166.country_order)

for the form that doesn't prompt for country:
db.auth_user.country.requires = IS_NULL_OR(IS_NOT_EMPTY())

So... I'm twisting existing validators to get the behaviour I want. In
step #3 "IS_NULL_OR(IS_NOT_EMPTY())" feels hacky but otherwise I'm
comfortable enough.

Constructive feedback welcomed.

Carl
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27890] Re: Fwd: My thoughts on web2py

2009-08-03 Thread Álvaro Justen [Turicas]

On Mon, Aug 3, 2009 at 11:09, Pynthon Pynthon wrote:
> Indeed, but I still hope that Massimo can fix this stuff :P.

Think in community: WE can change this (including you!).
Massimo have done a lot of work in web2py and I think users need to
help more this project.

> 2009/8/3 suiato 
>>
>> I found this thread encouraging. It shows Massimo and members here are
>> open to different views/opinions while maintaining integrity. That's
>> essential for open-source software to evolve. E.g., who thought  in
>> the early 1990's Linux was going to be as serious a software as we see
>> today?
>>
>> Cheers,
>> Teru
>>
>
>
> 
-- 
 Álvaro Justen
 Peta5 - Telecomunicações e Software Livre
 21 3021-6001 / 9898-0141
 http://www.peta5.com.br/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27891] Re: r1045 breaks some upload fields

2009-08-03 Thread Fran

On Aug 3, 2:51 pm, Jose  wrote:
> On 2 ago, 21:25, Fran  wrote:
> > Really bizarre this as my simple testcases work fine.
> > However r1044 works with my app whereas 1045 doesn't
> I have the version 1.65.9 (r1153).

I guess tha's an SVN ref?
I always quote the master Bzr revisions (which is up to only 1050 now:
https://code.launchpad.net/~mdipierro/web2py/devel)

> Do not be from when it is happening, but yesterday I noticed that the
> images are not uploaded.
> The only changes that I did were:
> 1) To update web2py
> 2) to migrate of py2.5 to py2.6 (SO: Freebsd)

I'm running Python-2.5.4 on XP
Same error seen with 2.5.2 on Debian Lenny

F
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27892] Re: Fwd: My thoughts on web2py

2009-08-03 Thread Pynthon

If I could I would help...

On 3 aug, 17:13, Álvaro Justen [Turicas] 
wrote:
> On Mon, Aug 3, 2009 at 11:09, Pynthon Pynthon wrote:
> > Indeed, but I still hope that Massimo can fix this stuff :P.
>
> Think in community: WE can change this (including you!).
> Massimo have done a lot of work in web2py and I think users need to
> help more this project.
>
> > 2009/8/3 suiato 
>
> >> I found this thread encouraging. It shows Massimo and members here are
> >> open to different views/opinions while maintaining integrity. That's
> >> essential for open-source software to evolve. E.g., who thought  in
> >> the early 1990's Linux was going to be as serious a software as we see
> >> today?
>
> >> Cheers,
> >> Teru
>
> --
>  Álvaro Justen
>  Peta5 - Telecomunicações e Software Livre
>  21 3021-6001 / 9898-0141
>  http://www.peta5.com.br/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27893] Re: ldap-auth issue

2009-08-03 Thread Fran

On Aug 3, 3:06 pm, Johann Spies  wrote:
> I want to do have a website on which I can register a few usernames.
> Only they may authentiicate and they must authenticate against a
> central ldap server.

> auth.settings.login_methods=[ldap_auth(server='stbldap01.sun.ac.za',base_dn='ou=users,O=SU',
> mode='cn', secure=True)]

This is the right type of line then.

> When I register a user I don't want the user to enter a password
> because when the user logs in in future the password must be checked
> against the hash in the LDAP tree.

> db.Field("password",'password',readable=False, label="Password"),

Add writable=False to make it not show in the register form.

> t = auth.settings.table_user
> t.password.requires = CRYPT() # password will be stored hashed

Why bother since you're not storing password locally?

> So when I register myself (with or
> without a password on registration) I cannot log in afterwords.  All
> my logins ends with "Invalid login".  How can I find out what went
> wrong?  Is ther some sort of log somewhere?

My guess is that this is an LDAP failure.
Try the LDAP login from the CLI on the same machine as the server (to
check for Firewall issues).
The relevant string to test from what you have above is:
ldapwhoami -x -D cn=username,ou=users,O=SU -W -H ldaps://stbldap01.sun.ac.za:389
(replace 'username' with your username)

If you get a working LDAP connection string, then we can let you know
how to do this within ldap-auth (which may require amending the ldap-
auth to cater for the option(s) you need)

Best Wishes,
Fran.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27894] Re: r1045 breaks some upload fields

2009-08-03 Thread Jose



On 3 ago, 12:16, Fran  wrote:
> On Aug 3, 2:51 pm, Jose  wrote:
>
> > On 2 ago, 21:25, Fran  wrote:
> > > Really bizarre this as my simple testcases work fine.
> > > However r1044 works with my app whereas 1045 doesn't
> > I have the version 1.65.9 (r1153).
>
> I guess tha's an SVN ref?
> I always quote the master Bzr revisions (which is up to only 1050 
> now:https://code.launchpad.net/~mdipierro/web2py/devel)
>
> > Do not be from when it is happening, but yesterday I noticed that the
> > images are not uploaded.
> > The only changes that I did were:
> > 1) To update web2py
> > 2) to migrate of py2.5 to py2.6 (SO: Freebsd)
>
> I'm running Python-2.5.4 on XP
> Same error seen with 2.5.2 on Debian Lenny
>
> F

I have just tried this in Windows XP(r1153) + python 2.5.x

db.define_table('unatabla',
Field('nombre'),
Field('imagen', 'upload'),
)

The following mistake takes is produced when I do submit:

Error traceback
Traceback (most recent call last):
  File "E:\web2py2\gluon\restricted.py", line 178, in restricted
exec ccode in environment
  File "E:/web2py2/applications/prueba/controllers/appadmin.py", line
255, in 
  File "E:\web2py2\gluon\globals.py", line 101, in 
self._caller = lambda f: f()
  File "E:/web2py2/applications/prueba/controllers/appadmin.py", line
104, in insert
if form.accepts(request.vars, session):
  File "E:\web2py2\gluon\sqlhtml.py", line 809, in accepts
if not f:
  File "E:\Python25\lib\cgi.py", line 633, in __len__
return len(self.keys())
  File "E:\Python25\lib\cgi.py", line 609, in keys
raise TypeError, "not indexable"
TypeError: not indexable

Jose



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27895] Re: r1045 breaks some upload fields

2009-08-03 Thread Jose



On 3 ago, 12:16, Fran  wrote:

> I guess tha's an SVN ref?
Yes, it is svn.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27897] Re: Fwd: My thoughts on web2py

2009-08-03 Thread Armin Ronacher

Hi,

> True. but I would not call it a race condition. We timestamp
> everything with the time when a request arrives, not when it is
> processed, unless specified otherwise (datetime.now() instead of
> request.now)
True.  But that does not make it a better idea.  Also, datetime.now()
should be consistently replaced with datetime.utcnow() because using
anythign else than UTC data internally is problematic for various
reasons.  See the discussion on that topic in various i18n/l10n
libraries such as babel / pytz.

> True but I believe we never do that in web2py. It is also true that
> nothing prevent the user from doing it but the same would be true with
> other frameworks.
You're not doing it, a user might be doing that by accident or because
he things it should work.  This problem does not exist in other
frameworks because besides web2py I don't know a single one that does
this sort of execfile() + namespace thing or uses any other kind of
throwaway modules.  As soon as a single reference leaks from the
execfile()'d namespace you're in big troubles and due to the open
nature of Python this could happen very, very fast.

> Yes but because all relevant application code is executed within a
> context and there are no references outside the context to stuff
> inside the context, when a request is completed, the context is
> deleted and everything should be garbage collected.
That depends on two things.  First not having a reference leaked,
which could happen with abstract base classes and other stuff that
uses registries or steals non-weak references.  Also and more
importantly, the file descriptor limit is very low and the majority of
Python implementations will only collect that on the GC run (always,
no matter where references are).  Say you're opening three files per
request and you have more than 100 requests/sec you could lose all
file descriptors that are available before the GC even thought about
running.


Regards,
Armin

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27896] Combo problem

2009-08-03 Thread Sophie

Hi

i have a problem with a combo. I have 3 tables "productType","product"
and "sales". So when i select a "productType" it appears a combo with
the products of that type. My problem is when i want to  select a
product and i want the sales of that product.

Here is my code:

Controller:
def index():
   productType = db().select(db.productType.ALL)
return dict(productType=productType)

def getproduct():
productType = request.vars.values()[0]
product = db(db.product.productTypeId == productType).select()
return SELECT(_id='product',*[OPTION(product[i].nProduct,
_value=str(product[i].id)) for i in range(len(product))])

-->Here, i think i have to return 2 values, the combo and the product.
But i dont know how to return both values.
-->The other problem is where i have insert the ajax, so when i do the
onChange it redirects to getsales.

def getsales():
product = request.vars.values()[0]
sales = db(db.sales.productId == product).select()
return SELECT(_id='sales',*[OPTION(sales[i].nSales, _value=str
(sales[i].id)) for i in range(len(sales))])

-->What changes i have to do in the view.

View:
{{extend 'layout.html'}}


{{=SELECT( _id='productType', _onChange="ajax('"+URL
(r=request,f='getproduct')+"'
, ['productType'], 'target');", *[OPTION(productType
[i].nProductType,_value=str(productType[i].id)) for i in range(len
(productType))] )}}


 



-->I think another way to do it. but i dont know if this is posible.
Create the combo in the view, and when i select a productType, i want
to execute a function in the controller wich receive the
productTypeId, i do a select and the other combo appear with the
data.

I hope you can help me. Thanks a lot.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27898] Re: Fwd: My thoughts on web2py

2009-08-03 Thread Yarko Tymciurak
Pynthon -

Remember that just recently you mentioned you have been 3 months since you
looked at Python, and you did not remember lists and dict's...

It is easy to have doubts out of fear, but remember to watch the discussion,
and see what develops, rather than assume everything raised "must be a
problem".   The point of discourse is to air views, and come to
understanding.

Don't worry, rather watch and read background and try to understand the
topics being discussed.

Regards,
- Yarko

On Mon, Aug 3, 2009 at 9:09 AM, Pynthon Pynthon  wrote:

> Indeed, but I still hope that Massimo can fix this stuff :P.
>
> 2009/8/3 suiato 
>
>
>> I found this thread encouraging. It shows Massimo and members here are
>> open to different views/opinions while maintaining integrity. That's
>> essential for open-source software to evolve. E.g., who thought  in
>> the early 1990's Linux was going to be as serious a software as we see
>> today?
>>
>> Cheers,
>> Teru
>>
>>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27899] Re: Fwd: My thoughts on web2py

2009-08-03 Thread Pynthon

Thanks Yarko, indeed because I don't know about it and Armin (Massimo
too and a lot of more guys here) looks like an advanced programmer I
thought maybe he is right and thats the reason why I'm kinda scared.

On 3 aug, 18:59, Yarko Tymciurak  wrote:
> Pynthon -
>
> Remember that just recently you mentioned you have been 3 months since you
> looked at Python, and you did not remember lists and dict's...
>
> It is easy to have doubts out of fear, but remember to watch the discussion,
> and see what develops, rather than assume everything raised "must be a
> problem".   The point of discourse is to air views, and come to
> understanding.
>
> Don't worry, rather watch and read background and try to understand the
> topics being discussed.
>
> Regards,
> - Yarko
>
> On Mon, Aug 3, 2009 at 9:09 AM, Pynthon Pynthon  wrote:
> > Indeed, but I still hope that Massimo can fix this stuff :P.
>
> > 2009/8/3 suiato 
>
> >> I found this thread encouraging. It shows Massimo and members here are
> >> open to different views/opinions while maintaining integrity. That's
> >> essential for open-source software to evolve. E.g., who thought  in
> >> the early 1990's Linux was going to be as serious a software as we see
> >> today?
>
> >> Cheers,
> >> Teru
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27900] Re: r1045 breaks some upload fields

2009-08-03 Thread Fran

On Aug 3, 4:33 pm, Jose  wrote:
> I have just tried this in Windows XP(r1153) + python 2.5.x
> db.define_table('unatabla',
>     Field('nombre'),
>     Field('imagen', 'upload'),
> )
> The following mistake takes is produced when I do submit:
> Error traceback
>   File "E:\web2py2\gluon\sqlhtml.py", line 809, in accepts
>     if not f:
>   File "E:\Python25\lib\cgi.py", line 633, in __len__
>     return len(self.keys())
>   File "E:\Python25\lib\cgi.py", line 609, in keys
>     raise TypeError, "not indexable"
> TypeError: not indexable

Wow, the same error I had but with a simpler model!

In fact I can now reproduce this with just the simplest model:
db.define_table('test_photo',
Field('image', 'upload'))

Therefore it's nothing weird about my code but a bug in sqlhtml.py

reverting the changed line 809 back to:
if f == '':

(from the current 'if not f:')

fixes it - patch sent to Massimo...

F
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27901] Re: r1045 breaks some upload fields

2009-08-03 Thread Jose



On 3 ago, 15:49, Fran  wrote:
> reverting the changed line 809 back to:
> if f == '':
>
> (from the current 'if not f:')
>
> fixes it - patch sent to Massimo...
>
> F
Thank you, it works well. Do not be if it breaks anything in another
place.

Regards
Jose
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27902] Re: Fwd: My thoughts on web2py

2009-08-03 Thread waTR

Hi all,

What do you guys think of, at this time, filing a few of these issues
as ISSUES on the google code page for this project. Then, start a
debate on each individual issue separately. They have a great platform
for this on google code. Also, it keeps the discussion focused, as
right now there seem to be multiple issues being discussed here, and
it could get messy very quickly. Furthermore, do web2py users need to
see this discussion in web2py-users? It seems more of a web2py-
developer discussion or a google code "issues" page discussion.
Lastly, you guys really need to start using google code, it is simple,
easy to contribute on, fast, and while there may be a lot of issues
that will be killed by the team as a result of the conclusions reached
in the debates for each issue, it will show great project activity for
project lurkers. Nothing against launch-pad, it just feels too bloated
for me.

Just my 1.91 CAD cents for our $2 USD.

P.S. Armin, it's great to have you posting on this mailing list!!  You
sound like you have a lot of love for this framework (or at least
hope), which is up to the project team to make sure is not dashed.
Though definitely stick around and continue to poke the src code and
find soft-spots / holes. I really feel it is people like you, working
with/in the web2py team who can take this project to the next level
re: quality, etc.




On Aug 3, 10:57 am, Pynthon  wrote:
> Thanks Yarko, indeed because I don't know about it and Armin (Massimo
> too and a lot of more guys here) looks like an advanced programmer I
> thought maybe he is right and thats the reason why I'm kinda scared.
>
> On 3 aug, 18:59, Yarko Tymciurak  wrote:
>
> > Pynthon -
>
> > Remember that just recently you mentioned you have been 3 months since you
> > looked at Python, and you did not remember lists and dict's...
>
> > It is easy to have doubts out of fear, but remember to watch the discussion,
> > and see what develops, rather than assume everything raised "must be a
> > problem".   The point of discourse is to air views, and come to
> > understanding.
>
> > Don't worry, rather watch and read background and try to understand the
> > topics being discussed.
>
> > Regards,
> > - Yarko
>
> > On Mon, Aug 3, 2009 at 9:09 AM, Pynthon Pynthon  wrote:
> > > Indeed, but I still hope that Massimo can fix this stuff :P.
>
> > > 2009/8/3 suiato 
>
> > >> I found this thread encouraging. It shows Massimo and members here are
> > >> open to different views/opinions while maintaining integrity. That's
> > >> essential for open-source software to evolve. E.g., who thought  in
> > >> the early 1990's Linux was going to be as serious a software as we see
> > >> today?
>
> > >> Cheers,
> > >> Teru
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27903] Re: Fwd: My thoughts on web2py

2009-08-03 Thread Pynthon

Indeed, I think its also a good idea or post this thing son the web2py
developers group. Maybe new users see this and think "Hmmm..." and
that is now what we want (well I think that).
And indeed Armin is a good guy!

On 3 aug, 22:13, waTR  wrote:
> Hi all,
>
> What do you guys think of, at this time, filing a few of these issues
> as ISSUES on the google code page for this project. Then, start a
> debate on each individual issue separately. They have a great platform
> for this on google code. Also, it keeps the discussion focused, as
> right now there seem to be multiple issues being discussed here, and
> it could get messy very quickly. Furthermore, do web2py users need to
> see this discussion in web2py-users? It seems more of a web2py-
> developer discussion or a google code "issues" page discussion.
> Lastly, you guys really need to start using google code, it is simple,
> easy to contribute on, fast, and while there may be a lot of issues
> that will be killed by the team as a result of the conclusions reached
> in the debates for each issue, it will show great project activity for
> project lurkers. Nothing against launch-pad, it just feels too bloated
> for me.
>
> Just my 1.91 CAD cents for our $2 USD.
>
> P.S. Armin, it's great to have you posting on this mailing list!!  You
> sound like you have a lot of love for this framework (or at least
> hope), which is up to the project team to make sure is not dashed.
> Though definitely stick around and continue to poke the src code and
> find soft-spots / holes. I really feel it is people like you, working
> with/in the web2py team who can take this project to the next level
> re: quality, etc.
>
> On Aug 3, 10:57 am, Pynthon  wrote:
>
> > Thanks Yarko, indeed because I don't know about it and Armin (Massimo
> > too and a lot of more guys here) looks like an advanced programmer I
> > thought maybe he is right and thats the reason why I'm kinda scared.
>
> > On 3 aug, 18:59, Yarko Tymciurak  wrote:
>
> > > Pynthon -
>
> > > Remember that just recently you mentioned you have been 3 months since you
> > > looked at Python, and you did not remember lists and dict's...
>
> > > It is easy to have doubts out of fear, but remember to watch the 
> > > discussion,
> > > and see what develops, rather than assume everything raised "must be a
> > > problem".   The point of discourse is to air views, and come to
> > > understanding.
>
> > > Don't worry, rather watch and read background and try to understand the
> > > topics being discussed.
>
> > > Regards,
> > > - Yarko
>
> > > On Mon, Aug 3, 2009 at 9:09 AM, Pynthon Pynthon  
> > > wrote:
> > > > Indeed, but I still hope that Massimo can fix this stuff :P.
>
> > > > 2009/8/3 suiato 
>
> > > >> I found this thread encouraging. It shows Massimo and members here are
> > > >> open to different views/opinions while maintaining integrity. That's
> > > >> essential for open-source software to evolve. E.g., who thought  in
> > > >> the early 1990's Linux was going to be as serious a software as we see
> > > >> today?
>
> > > >> Cheers,
> > > >> Teru
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27905] Re: Fwd: My thoughts on web2py

2009-08-03 Thread JohnMc

I take the long view on all of this. Tools/Systems are a process not a
end. I point that out only because from time to time I will get a
notice that a bug has been found in C/C++ and the required patches or
replacement code to use. C is nearly as old as dirt (1972 for me) and
still has fixes and we complain about Web2Py that is 3 years in the
making has bugs? For its lifecycle Web2Py is probably about average in
code issues/fixes from what I see. That does not discourage me from
using the tool.

Armin has done a public service and should be encouraged to point out
more.

JohnMc

On Aug 3, 9:09 am, Pynthon Pynthon  wrote:
> Indeed, but I still hope that Massimo can fix this stuff :P.
>
> 2009/8/3 suiato 
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27906] Re: hidden fields

2009-08-03 Thread mattynoce

hi, and thanks for the reply. you gave some good options.
__
i'm hesitant to go to the jquery method unless it's a last resort,
because resorting to javascript here seems like a workaround.
__
i tried doing the simplest, which i figured was removing the hidden
field and putting this:
request.vars['hiddenfield'] = val
immediately before the form.accepts part. i could confirm that it set
properly and that request.vars found hiddenfield, but it still
wouldn't update (even if i set db.table.hiddenfield.writable=True).

something seems wrong there. is that by design? it was not a part of
the sqlform but it becomes a part of request.vars immediately before
the if form.accepts(request.vars, session), so i don't understand why
it would be left behind.
__
next i tried was your suggestion about processing the field manually
in the "if form.accepts" part. the problem i'm finding is that
form.accepts returns True or False rather than [id] or False. so i did
this:
a=form.accepts(request.vars,session)
if a:
...

but when i printed a, it printed not as 1 or 2 but as True. so it
doesn't seem to be returning the identity that i would need in order
to process an update. am i missing something there?
__
lastly, i tried massimo's suggestion of setting the writable to false,
creating the form, and setting the writable to true. unfortunately,
that still didn't make the hidden field get processed. i tried making
the field not hidden and what that did was print out to the user:
hiddenfield: None
__
so i know i can use jquery to hide it and i'm willing to do that, but
it seems there should be a way to accomplish what i'm looking to do
server-side. i'm open to the idea that i'm doing something wrong, as
i'm still a relative newbie with web2py. thank you for the help so far
and i look forward to hearing what's out there.

matt

On Aug 3, 5:59 am, Fran  wrote:
> On Aug 2, 9:19 pm, mattynoce  wrote:
>
> > hi, i have a question about hidden fields.
> > i have a form that looks like this:
> > fields=['f1','f2','f3'...]
> > hidden=dict(fieldname=val)
> > form = SQLFORM(db.table, fields=fields, showid=False, hidden=hidden)
> > in the view it's simply {{=form}}
> > when i look at the view, there's a hidden input field for my hidden
> > field. however, when i do the insert, the hidden field is not getting
> > inserted into my db. the accept info is:
> >     if form.accepts(request.vars,session):
> >          session.flash='Added'
> >          redirect(URL(r=request, f="function"))
> > am i doing something wrong? why would the hidden field show up
> > properly in the view but not update the db?
>
> Hi Matt,
>
> I didn't know about this functionality before as it's not a documented
> option in the docstring for SQLFORM (or FORM), but I see it in the
> manual now.
>
> Looking at the code in sqlhtml.py, it seems that the hidden fields
> aren't processed by SQLFORM itself...I guess this is a design rather
> than a bug (the hidden fields would normally be for other things than
> DB fields).
>
> You have several options to achieve what you want, including:
> (1) Process this field manually in the 'if form.accepts' part
> (2) Don't pass the field as hidden to 'form' but instead use jQuery to
> hide the row (default value can be set within model or by jQuery)
> (3) Follow Massimo's suggestion:
> db.table.hidden_field.writable = False
> form = SQLFORM(db.table, fields=fields, showid=False, hidden=hidden)
> db.table.hidden_field.writable = True
> if form.accepts(request.vars,session):
>
> Best Wishes,
> Fran.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27904] Re: file downloading problem

2009-08-03 Thread Alex Fanjul
Could you solve the "infinite error ticket loop"? It happened to me and
I had to "reinstall" web2py. after that It worked again...

Alex F

El 01/08/2009 7:50, 陶艺夫 escribió:
> Now there are some problems I can't figure out why.
>
> My application has been doing well under binary web2py with cherrypy.
> After I moved it into Apache and mod_wsgi env, some pages would issue
> an error ticket and when I click the ticket link, it would continue
> issue another error ticket, and on...
> I found the admin application wouldn't work in this env till now. I
> try to remove ssl from Apache, the error was still there.
>
> Any idea?
>
> 2009/8/1 陶艺夫 mailto:artman...@gmail.com>>
>
> I got it works evetually.
> Guess what was wrong? I had a wrong spelled word in the conf file!
> It had taken my 2 hours away from my life :)
>
> Thanks a lot. You are so cool...
>
> 2009/8/1 mdipierro  >
>
>
> which browser are you using? can you try wget and/or other
> browsers?
>
> On Jul 30, 10:32 pm, 陶艺夫  > wrote:
> > Hi,
> > I'm using "response.stream(file_name)" method to offer users
> downloading
> > files which are sort of business-classified, but the
> downloading process
> > always terminated halfway. The testing file is 4.2M, an
> Excel workbook.
> > Is there anything I can do with system
> configuration(CherryPy), or it's
> > just an internet problem?
> >
> > thanks
>
>
>
>
> >

-- 
Alejandro Fanjul Fdez.
alex.fan...@gmail.com
www.mhproject.org

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27907] selective IS_STRONG

2009-08-03 Thread Jonathan Lundell

Suppose I wanted to enforce IS_STRONG when creating, but not checking,  
a password. (Which is how it should work anyway, according to me.) Can  
I do that without overriding the Auth login and registration functions?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27908] Re: selective IS_STRONG

2009-08-03 Thread mr.freeze

Not sure if it's the best way but I do this in my model:

t = auth.settings.table_user
if "login" in request.args:
t.password.requires = [CRYPT()]
else:
t.password.requires = [IS_STRONG(special=None),CRYPT()]


On Aug 3, 6:30 pm, Jonathan Lundell  wrote:
> Suppose I wanted to enforce IS_STRONG when creating, but not checking,  
> a password. (Which is how it should work anyway, according to me.) Can  
> I do that without overriding the Auth login and registration functions?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27909] random_password and IS_STRONG

2009-08-03 Thread mr.freeze

Just a quick message to point out that if you use IS_STRONG, you must
override Auth's random_password function to match it's complexity or
users won't be able to login after resetting their password.  Here's
what I did in my model:

class MyAuth(Auth):
def random_password(self):
import string
import random
password = ''
specials=r'!...@#$*?'
for i in range(0,3):
password += random.choice(string.lowercase)
password += random.choice(string.uppercase)
password += random.choice(string.digits)
password += random.choice(specials)
return ''.join(random.sample(password,len(password)))

auth=MyAuth(globals(),db)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27910] Re: random_password and IS_STRONG

2009-08-03 Thread Jonathan Lundell

On Aug 3, 2009, at 5:33 PM, mr.freeze wrote:

> Just a quick message to point out that if you use IS_STRONG, you must
> override Auth's random_password function to match its complexity

Yes, I was going to point that out. But if you turn off IS_STRONG for  
login, then it doesn't matter, does it?

There's another reason to turn off IS_STRONG for logins, too: it leaks  
information to an attacker about the nature of the required password  
content, significantly pruning his dictionary.

I think that the IS_STRONG-login-bypass trick (or something like it)  
ought to be in the manual under the IS_STRONG entry.

> or
> users won't be able to login after resetting their password.  Here's
> what I did in my model:
>
> class MyAuth(Auth):
>def random_password(self):
>import string
>import random
>password = ''
>specials=r'!...@#$*?'
>for i in range(0,3):
>password += random.choice(string.lowercase)
>password += random.choice(string.uppercase)
>password += random.choice(string.digits)
>password += random.choice(specials)
>return ''.join(random.sample(password,len(password)))
>
> auth=MyAuth(globals(),db)



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27911] Re: random_password and IS_STRONG

2009-08-03 Thread mr.freeze

> Yes, I was going to point that out. But if you turn off IS_STRONG for
> login, then it doesn't matter, does it?

Correct.  IS_STRONG is not a default validator for the password field
(only CRYPT) so if you don't have complexity requirements, just avoid
using it.

> There's another reason to turn off IS_STRONG for logins, too: it leaks
> information to an attacker about the nature of the required password
> content, significantly pruning his dictionary.

Good point.

On Aug 3, 7:40 pm, Jonathan Lundell  wrote:
> On Aug 3, 2009, at 5:33 PM, mr.freeze wrote:
>
> > Just a quick message to point out that if you use IS_STRONG, you must
> > override Auth's random_password function to match its complexity
>
> Yes, I was going to point that out. But if you turn off IS_STRONG for  
> login, then it doesn't matter, does it?
>
> There's another reason to turn off IS_STRONG for logins, too: it leaks  
> information to an attacker about the nature of the required password  
> content, significantly pruning his dictionary.
>
> I think that the IS_STRONG-login-bypass trick (or something like it)  
> ought to be in the manual under the IS_STRONG entry.
>
> > or
> > users won't be able to login after resetting their password.  Here's
> > what I did in my model:
>
> > class MyAuth(Auth):
> >    def random_password(self):
> >        import string
> >        import random
> >        password = ''
> >        specials=r'!...@#$*?'
> >        for i in range(0,3):
> >            password += random.choice(string.lowercase)
> >            password += random.choice(string.uppercase)
> >            password += random.choice(string.digits)
> >            password += random.choice(specials)
> >        return ''.join(random.sample(password,len(password)))
>
> > auth=MyAuth(globals(),db)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27912] Re: random_password and IS_STRONG

2009-08-03 Thread Jonathan Lundell

On Aug 3, 2009, at 5:51 PM, mr.freeze wrote:

>
>> Yes, I was going to point that out. But if you turn off IS_STRONG for
>> login, then it doesn't matter, does it?
>
> Correct.  IS_STRONG is not a default validator for the password field
> (only CRYPT) so if you don't have complexity requirements, just avoid
> using it.

I mean: use it, but also use something like your hack (excuse the  
expression) for turning it off specifically for login requests, and  
leaving it enabled for everything else.

>
>> There's another reason to turn off IS_STRONG for logins, too: it  
>> leaks
>> information to an attacker about the nature of the required password
>> content, significantly pruning his dictionary.
>
> Good point.
>
> On Aug 3, 7:40 pm, Jonathan Lundell  wrote:
>> On Aug 3, 2009, at 5:33 PM, mr.freeze wrote:
>>
>>> Just a quick message to point out that if you use IS_STRONG, you  
>>> must
>>> override Auth's random_password function to match its complexity
>>
>> Yes, I was going to point that out. But if you turn off IS_STRONG for
>> login, then it doesn't matter, does it?
>>
>> There's another reason to turn off IS_STRONG for logins, too: it  
>> leaks
>> information to an attacker about the nature of the required password
>> content, significantly pruning his dictionary.
>>
>> I think that the IS_STRONG-login-bypass trick (or something like it)
>> ought to be in the manual under the IS_STRONG entry.
>>
>>> or
>>> users won't be able to login after resetting their password.  Here's
>>> what I did in my model:
>>
>>> class MyAuth(Auth):
>>>def random_password(self):
>>>import string
>>>import random
>>>password = ''
>>>specials=r'!...@#$*?'
>>>for i in range(0,3):
>>>password += random.choice(string.lowercase)
>>>password += random.choice(string.uppercase)
>>>password += random.choice(string.digits)
>>>password += random.choice(specials)
>>>return ''.join(random.sample(password,len(password)))
>>
>>> auth=MyAuth(globals(),db)
> --~--~-~--~~---




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27913] Re: file downloading problem

2009-08-03 Thread 陶艺夫
When I upgraded web2py to next version, the problem's gone and I just got
the message saying "can not access the password file". Then I created a
parameters_80.py by start web2py with -a option once, and all is fine.

There must had been something wrong around there. But for it's gone, I never
can figure out what it is. The result is fine, but the feelings is not so
good...


2009/8/4 Alex Fanjul 

>  Could you solve the "infinite error ticket loop"? It happened to me and I
> had to "reinstall" web2py. after that It worked again...
>
> Alex F
>
> El 01/08/2009 7:50, 陶艺夫 escribió:
>
> Now there are some problems I can't figure out why.
>
> My application has been doing well under binary web2py with cherrypy. After
> I moved it into Apache and mod_wsgi env, some pages would issue an error
> ticket and when I click the ticket link, it would continue issue another
> error ticket, and on...
> I found the admin application wouldn't work in this env till now. I try to
> remove ssl from Apache, the error was still there.
>
> Any idea?
>
> 2009/8/1 陶艺夫 
>
>> I got it works evetually.
>> Guess what was wrong? I had a wrong spelled word in the conf file! It had
>> taken my 2 hours away from my life :)
>>
>> Thanks a lot. You are so cool...
>>
>> 2009/8/1 mdipierro 
>>
>>>
>>> which browser are you using? can you try wget and/or other browsers?
>>>
>>> On Jul 30, 10:32 pm, 陶艺夫  wrote:
>>> > Hi,
>>> > I'm using "response.stream(file_name)" method to offer users
>>> downloading
>>> > files which are sort of business-classified, but the downloading
>>> process
>>> > always terminated halfway. The testing file is 4.2M, an Excel workbook.
>>> > Is there anything I can do with system configuration(CherryPy), or
>>>  it's
>>> > just an internet problem?
>>> >
>>> > thanks
>>>
>>>
>>
>
>
>
> --
> Alejandro Fanjul Fdez.
> alex.fan...@gmail.com
> www.mhproject.org
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27914] Re: random_password and IS_STRONG

2009-08-03 Thread mr.freeze

> I mean: use it, but also use something like your hack (excuse the
> expression) for turning it off specifically for login requests, and
> leaving it enabled for everything else.

No excuse necessary...It is a hack!  I should have considered when
writing IS_STRONG.  What do you think about a bypass=['login']
parameter added to it?

On Aug 3, 8:08 pm, Jonathan Lundell  wrote:
> On Aug 3, 2009, at 5:51 PM, mr.freeze wrote:
>
>
>
> >> Yes, I was going to point that out. But if you turn off IS_STRONG for
> >> login, then it doesn't matter, does it?
>
> > Correct.  IS_STRONG is not a default validator for the password field
> > (only CRYPT) so if you don't have complexity requirements, just avoid
> > using it.
>
> I mean: use it, but also use something like your hack (excuse the  
> expression) for turning it off specifically for login requests, and  
> leaving it enabled for everything else.
>
>
>
>
>
> >> There's another reason to turn off IS_STRONG for logins, too: it  
> >> leaks
> >> information to an attacker about the nature of the required password
> >> content, significantly pruning his dictionary.
>
> > Good point.
>
> > On Aug 3, 7:40 pm, Jonathan Lundell  wrote:
> >> On Aug 3, 2009, at 5:33 PM, mr.freeze wrote:
>
> >>> Just a quick message to point out that if you use IS_STRONG, you  
> >>> must
> >>> override Auth's random_password function to match its complexity
>
> >> Yes, I was going to point that out. But if you turn off IS_STRONG for
> >> login, then it doesn't matter, does it?
>
> >> There's another reason to turn off IS_STRONG for logins, too: it  
> >> leaks
> >> information to an attacker about the nature of the required password
> >> content, significantly pruning his dictionary.
>
> >> I think that the IS_STRONG-login-bypass trick (or something like it)
> >> ought to be in the manual under the IS_STRONG entry.
>
> >>> or
> >>> users won't be able to login after resetting their password.  Here's
> >>> what I did in my model:
>
> >>> class MyAuth(Auth):
> >>>    def random_password(self):
> >>>        import string
> >>>        import random
> >>>        password = ''
> >>>        specials=r'!...@#$*?'
> >>>        for i in range(0,3):
> >>>            password += random.choice(string.lowercase)
> >>>            password += random.choice(string.uppercase)
> >>>            password += random.choice(string.digits)
> >>>            password += random.choice(specials)
> >>>        return ''.join(random.sample(password,len(password)))
>
> >>> auth=MyAuth(globals(),db)
> > --~--~-~--~~ Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27915] '@' in url args

2009-08-03 Thread Kevin Butler

I'd like to use @ in the url args in a web2py application.

For example:

http://hostname/app/file/user/usern...@host.domain

However, web2py yields "Invalid request" whenever I include an @ in
the URL.

I expect that some manipulation of regex_url in main.py would allow
this, but I haven't found the magic incantation yet.

I'm also concerned that there could be other escaped characters in
email addresses that may run afoul of the regex. Any general advice to
allow this?

Thanks

kb
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27916] Re: random_password and IS_STRONG

2009-08-03 Thread Jonathan Lundell

On Aug 3, 2009, at 6:31 PM, mr.freeze wrote:

>
>> I mean: use it, but also use something like your hack (excuse the
>> expression) for turning it off specifically for login requests, and
>> leaving it enabled for everything else.
>
> No excuse necessary...It is a hack!  I should have considered when
> writing IS_STRONG.  What do you think about a bypass=['login']
> parameter added to it?

Good idea. Anything to encourage best practices.

>
> On Aug 3, 8:08 pm, Jonathan Lundell  wrote:
>> On Aug 3, 2009, at 5:51 PM, mr.freeze wrote:
>>
>>
>>
 Yes, I was going to point that out. But if you turn off IS_STRONG  
 for
 login, then it doesn't matter, does it?
>>
>>> Correct.  IS_STRONG is not a default validator for the password  
>>> field
>>> (only CRYPT) so if you don't have complexity requirements, just  
>>> avoid
>>> using it.
>>
>> I mean: use it, but also use something like your hack (excuse the
>> expression) for turning it off specifically for login requests, and
>> leaving it enabled for everything else.
>>
>>
>>
>>
>>
 There's another reason to turn off IS_STRONG for logins, too: it
 leaks
 information to an attacker about the nature of the required  
 password
 content, significantly pruning his dictionary.
>>
>>> Good point.
>>
>>> On Aug 3, 7:40 pm, Jonathan Lundell  wrote:
 On Aug 3, 2009, at 5:33 PM, mr.freeze wrote:
>>
> Just a quick message to point out that if you use IS_STRONG, you
> must
> override Auth's random_password function to match its complexity
>>
 Yes, I was going to point that out. But if you turn off IS_STRONG  
 for
 login, then it doesn't matter, does it?
>>
 There's another reason to turn off IS_STRONG for logins, too: it
 leaks
 information to an attacker about the nature of the required  
 password
 content, significantly pruning his dictionary.
>>
 I think that the IS_STRONG-login-bypass trick (or something like  
 it)
 ought to be in the manual under the IS_STRONG entry.
>>
> or
> users won't be able to login after resetting their password.   
> Here's
> what I did in my model:
>>
> class MyAuth(Auth):
>def random_password(self):
>import string
>import random
>password = ''
>specials=r'!...@#$*?'
>for i in range(0,3):
>password += random.choice(string.lowercase)
>password += random.choice(string.uppercase)
>password += random.choice(string.digits)
>password += random.choice(specials)
>return ''.join(random.sample(password,len(password)))
>>
> auth=MyAuth(globals(),db)
>>> --~--~-~--~~ Hide quoted text -
>>
>> - Show quoted text -
> >



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27917] Re: Google seems to know Web2Py

2009-08-03 Thread mdipierro

Can you show us an example?

On Aug 3, 9:01 am, dlypka  wrote:
> PolyModel enables true polymorphic behavior when querying objects
> whose classes are derived from other classes.
> So, in the retrieved instance, all fields of all classes at and above
> the target class are available to the retrieved instance.
>
> When PolyModel is not used as the base class, then the query only
> returns  the attributes of the queried class.
> Attributes of inherited classes are uninitialized.
>
> So using PolyModel as the base class, the web2py DAL classes can carry
> along GAE-specific attributes in base classes,
> one of the most useful being the Reference attribute, which will link
> together related instances so that GAE will return them in a single
> query.
> Also, Reference gives automatic bidirectional links.
>
> On Aug 2, 1:17 pm, mdipierro  wrote:
>
> > What is PolyModel? How is different than what DAL already does when
> > running on GAE?
>
> > On Aug 2, 11:33 am, dlypka  wrote:
>
> > > I just got an experimental version of T3 to work with the PolyModel
> > > base class in GAE.
> > > That gives inherited Classes.
> > > So GAE is Quite Amazing.
>
> > > I almost have my own DALnr ('nr' = non relational) for web2py working
> > > with GAE now.
> > > It is using my 'Phantom' Field concept (special table fields in a
> > > db.define_table(...) which do native GAE operations but are not
> > > otherwise part of the list of columns for that web2py table)
>
> > > In particular I got PolyModel to work together with the Reference
> > > feature which links together the related entities so that GAE loads
> > > them ***ALL*** in a
> > > single datastore query.
>
> > > In theory, my DALnr will allow creating web2py models which will work
> > > on both SQL and GAE and will automatically use 'nr' GAE native
> > > features if on GAE.
>
> > > ToDo: I still have to generalize my DALnr code.
>
> > > My first application of this DALnr is to a high performance TreeView
> > > control which loads all branches of a given level in PARALLEL using
> > > async multi simultaneous Ajax callbacks.
>
> > > On Aug 2, 11:34 am, Pynthon  wrote:
>
> > > > IMO GAE is too difficult :P.
>
> > > > On 2 aug, 07:02, Bottiger  wrote:
>
> > > > > Google has sunk too much time and effort into adapting Django to
> > > > > recommend another framework. They also need to attract more users to
> > > > > GAE which Django has plenty of.
>
> > > > > On Aug 1, 3:12 pm, mdipierro  wrote:
>
> > > > > > Yes, if only they'd understand we support GAE better than Django 
> > > > > > does.
> > > > > > Our DAL and our appadmin work on GAE, the Django ORM and Django 
> > > > > > admin
> > > > > > do not as far as I know.
>
> > > > > > Massimo
>
> > > > > > On Aug 1, 3:10 pm, Pynthon  wrote:
>
> > > > > > > Watch 
> > > > > > > this:http://googleappengine.blogspot.com/2009/05/web2py-support-new-datast...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27918] Re: Combo problem

2009-08-03 Thread mdipierro

I suggest change the getproduct to return JSON and change the view to
use the .getJSON instead of ajax function.
http://docs.jquery.com/Ajax/jQuery.getJSON

So you can have an action triggered when data is received.

Massimo


On Aug 3, 11:13 am, Sophie  wrote:
> Hi
>
> i have a problem with a combo. I have 3 tables "productType","product"
> and "sales". So when i select a "productType" it appears a combo with
> the products of that type. My problem is when i want to  select a
> product and i want the sales of that product.
>
> Here is my code:
>
> Controller:
> def index():
>    productType = db().select(db.productType.ALL)
>     return dict(productType=productType)
>
> def getproduct():
>     productType = request.vars.values()[0]
>     product = db(db.product.productTypeId == productType).select()
>     return SELECT(_id='product',*[OPTION(product[i].nProduct,
> _value=str(product[i].id)) for i in range(len(product))])
>
> -->Here, i think i have to return 2 values, the combo and the product.
> But i dont know how to return both values.
> -->The other problem is where i have insert the ajax, so when i do the
> onChange it redirects to getsales.
>
> def getsales():
>     product = request.vars.values()[0]
>     sales = db(db.sales.productId == product).select()
>     return SELECT(_id='sales',*[OPTION(sales[i].nSales, _value=str
> (sales[i].id)) for i in range(len(sales))])
>
> -->What changes i have to do in the view.
>
> View:
> {{extend 'layout.html'}}
> 
>     
>     {{=SELECT( _id='productType', _onChange="ajax('"+URL
> (r=request,f='getproduct')+"'
>     , ['productType'], 'target');", *[OPTION(productType
> [i].nProductType,_value=str(productType[i].id)) for i in range(len
> (productType))] )}}
>     
>     
>      
>     
> 
>
> -->I think another way to do it. but i dont know if this is posible.
> Create the combo in the view, and when i select a productType, i want
> to execute a function in the controller wich receive the
> productTypeId, i do a select and the other combo appear with the
> data.
>
> I hope you can help me. Thanks a lot.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27919] Re: Fwd: My thoughts on web2py

2009-08-03 Thread mdipierro

A minor corrections. web2py is not 3 years old. It will be 2 years old
on October 1st, 2009.
We are already working on fixing many of these issues although I
should point out none of these issues so far has manifested itself as
a bug, as far as I know. People should submit a bug report on the
google code if they think there is a bug, and it is not been
addressed,

Massimo

On Aug 3, 5:34 pm, JohnMc  wrote:
> I take the long view on all of this. Tools/Systems are a process not a
> end. I point that out only because from time to time I will get a
> notice that a bug has been found in C/C++ and the required patches or
> replacement code to use. C is nearly as old as dirt (1972 for me) and
> still has fixes and we complain about Web2Py that is 3 years in the
> making has bugs? For its lifecycle Web2Py is probably about average in
> code issues/fixes from what I see. That does not discourage me from
> using the tool.
>
> Armin has done a public service and should be encouraged to point out
> more.
>
> JohnMc
>
> On Aug 3, 9:09 am, Pynthon Pynthon  wrote:
>
> > Indeed, but I still hope that Massimo can fix this stuff :P.
>
> > 2009/8/3 suiato 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27920] Re: hidden fields

2009-08-03 Thread mdipierro

Fran, you are right. This is not a bug. Handling hidden fields
otherwise would result in a security vulenrability.

On can also do

form=SQLFORM()
form.vars.hidden_field_name=request.vars_hidden_field_name
if form.accepts()

On Aug 3, 4:59 am, Fran  wrote:
> On Aug 2, 9:19 pm, mattynoce  wrote:
>
> > hi, i have a question about hidden fields.
> > i have a form that looks like this:
> > fields=['f1','f2','f3'...]
> > hidden=dict(fieldname=val)
> > form = SQLFORM(db.table, fields=fields, showid=False, hidden=hidden)
> > in the view it's simply {{=form}}
> > when i look at the view, there's a hidden input field for my hidden
> > field. however, when i do the insert, the hidden field is not getting
> > inserted into my db. the accept info is:
> >     if form.accepts(request.vars,session):
> >          session.flash='Added'
> >          redirect(URL(r=request, f="function"))
> > am i doing something wrong? why would the hidden field show up
> > properly in the view but not update the db?
>
> Hi Matt,
>
> I didn't know about this functionality before as it's not a documented
> option in the docstring for SQLFORM (or FORM), but I see it in the
> manual now.
>
> Looking at the code in sqlhtml.py, it seems that the hidden fields
> aren't processed by SQLFORM itself...I guess this is a design rather
> than a bug (the hidden fields would normally be for other things than
> DB fields).
>
> You have several options to achieve what you want, including:
> (1) Process this field manually in the 'if form.accepts' part
> (2) Don't pass the field as hidden to 'form' but instead use jQuery to
> hide the row (default value can be set within model or by jQuery)
> (3) Follow Massimo's suggestion:
> db.table.hidden_field.writable = False
> form = SQLFORM(db.table, fields=fields, showid=False, hidden=hidden)
> db.table.hidden_field.writable = True
> if form.accepts(request.vars,session):
>
> Best Wishes,
> Fran.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27921] Re: problem with web2py, gae, and taskqueue

2009-08-03 Thread Dan

Hi David-
Yes, I'm using GAE's taskqueue with web2py, and it works in both the
dev and production environments. Note that in the dev environment, the
tasks do not run automatically - you will need to manually trigger
them using the http://localhost:8080/_ah/admin web console.

I wasn't able to get the url-encoded payload variable working
properly, so I tried the other method that uses a params dictionary
and it worked OK. (I'm not a python expert, so it's quite likely that
I was doing something wrong with urllib.) In any case, here is the
code snippet that works for me to create a task:

if request.env.web2py_runtime_gae: # if running on Google App Engine
from google.appengine.api.labs import taskqueue

tqparams = {'row_id':r}
taskqueue.add(
  url=URL(r=request, c='mycontroller', f='call/run/taskfunction'),
  params=tqparams,
)

and the controller file that gets called has these lines in it
(simplified for this example):

def call():
return service()

@service.run  ## we'll use this to enable this as a taskqueue-
friendly URL
def taskfunction():
"""
   For security, this URL should be restricted to the admin user in
app.yaml
"""
return dict(row_id=request.vars.row_id)


On Jul 31, 11:38 am, David Watson  wrote:
> Has anybody had any luck getting the taskqueue from google app engine
> to work in web2py? I presume that it should work under dev_appserver,
> but isn't working for me.
>
> I defined a simple default controller based on the gae example at the
> google blog:
>
> def process_post_file():
>     rows=db(db.files.processed=='False').select(db.files.ALL)
>     for row in rows:
>         f = row.file_blob
>         email_addresses = f.split('\n')
>         for email_address in email_addresses:
>             taskqueue.add(url='/init/default/sendmail', params=dict
> (to=email_address, subject='Hello ' + email_address, body='this is a
> message!'))
>     return dict(message=T('mail was queued'))
>
> def sendmail():
>     mail.send_mail(
>             '@my.com', # needs to be from settings
>             request.vars['to'],
>             request.vars['subject'],
>             request.vars['body'])
>
> but my sendmail function never gets called. Everything seems fine up
> through the task queue, but no callback.
>
> Thanks,
> David
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27922] Re: problem with web2py, gae, and taskqueue

2009-08-03 Thread mdipierro

Dan,

can you post an AlterEgo entry about this? It would be useful to other
users. Email me if you need the edit code.

Massimo

On Aug 4, 12:03 am, Dan  wrote:
> Hi David-
> Yes, I'm using GAE's taskqueue with web2py, and it works in both the
> dev and production environments. Note that in the dev environment, the
> tasks do not run automatically - you will need to manually trigger
> them using thehttp://localhost:8080/_ah/adminweb console.
>
> I wasn't able to get the url-encoded payload variable working
> properly, so I tried the other method that uses a params dictionary
> and it worked OK. (I'm not a python expert, so it's quite likely that
> I was doing something wrong with urllib.) In any case, here is the
> code snippet that works for me to create a task:
>
> if request.env.web2py_runtime_gae: # if running on Google App Engine
>     from google.appengine.api.labs import taskqueue
>
> tqparams = {'row_id':r}
> taskqueue.add(
>   url=URL(r=request, c='mycontroller', f='call/run/taskfunction'),
>   params=tqparams,
> )
>
> and the controller file that gets called has these lines in it
> (simplified for this example):
>
> def call():
>     return service()
>
> @service.run      ## we'll use this to enable this as a taskqueue-
> friendly URL
> def taskfunction():
>     """
>    For security, this URL should be restricted to the admin user in
> app.yaml
>     """
>     return dict(row_id=request.vars.row_id)
>
> On Jul 31, 11:38 am, David Watson  wrote:
>
> > Has anybody had any luck getting the taskqueue from google app engine
> > to work in web2py? I presume that it should work under dev_appserver,
> > but isn't working for me.
>
> > I defined a simple default controller based on the gae example at the
> > google blog:
>
> > def process_post_file():
> >     rows=db(db.files.processed=='False').select(db.files.ALL)
> >     for row in rows:
> >         f = row.file_blob
> >         email_addresses = f.split('\n')
> >         for email_address in email_addresses:
> >             taskqueue.add(url='/init/default/sendmail', params=dict
> > (to=email_address, subject='Hello ' + email_address, body='this is a
> > message!'))
> >     return dict(message=T('mail was queued'))
>
> > def sendmail():
> >     mail.send_mail(
> >             '@my.com', # needs to be from settings
> >             request.vars['to'],
> >             request.vars['subject'],
> >             request.vars['body'])
>
> > but my sendmail function never gets called. Everything seems fine up
> > through the task queue, but no callback.
>
> > Thanks,
> > David
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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:27923] Re: '@' in url args

2009-08-03 Thread mdipierro

There is a possible fix for this in trunk. Please give it a try.

On Aug 3, 9:11 pm, Kevin Butler  wrote:
> I'd like to use @ in the url args in a web2py application.
>
> For example:
>
> http://hostname/app/file/user/usern...@host.domain
>
> However, web2py yields "Invalid request" whenever I include an @ in
> the URL.
>
> I expect that some manipulation of regex_url in main.py would allow
> this, but I haven't found the magic incantation yet.
>
> I'm also concerned that there could be other escaped characters in
> email addresses that may run afoul of the regex. Any general advice to
> allow this?
>
> Thanks
>
> kb
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@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
-~--~~~~--~~--~--~---