[web2py:28138] Re: How to POST information from link?

2009-08-07 Thread mdipierro

This is the source of the web2py ajax function:

function ajax(u,s,t)
{
  var
query="";
  for(i=0; i0) query=query
+"&";
 query=query+encodeURIComponent(s[i])+"="+encodeURIComponent
(document.getElementById(s[i]).value);
  }
  jQuery.ajax({type: "POST", url: u, data: query, success: function
(msg) { if(t==':eval') eval(msg); else document.getE\
lementById
(t).innerHTML=msg; } });
}

As you can see it calls jQuery.ajax which is more powerful and you can
pass "data" it. I think you can do what you need using the
jQuery.ajax.

On Aug 6, 6:55 pm, Alastair Medford  wrote:
> What I'm trying to do is place information into a nornal  link,
> which will be sent along with an onclick ajax call. I know how to do
> this when the information is from an  tag just fine. But in
> this case I would like the information, like an id, to be contained
> somewhere in the  tag itself.
>
> The reasoning behind this is I would like to build a jquery tree, and
> when a link inside is clicked, an ajax function is called that then
> "knows" which link was clicked and will act accordingly. I've tried
> sending the  tag along by adding its id to the arguments of the
> ajax call, but its value in request.vars ends up being undefined. I
> theoreticaly could have a hidden field with each element containing
> the id but this seems messy. Is there a better way?
>
> The reason I'm not just straight out callng controller functions is
> this tree will be generated from a user made xml file. It's then used
> to find content in another user made file, so it has nothing to with
> calling certain 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:28139] Re: Where'd table_newfilename go ?

2009-08-07 Thread mdipierro

Sorry. This is a bug. I will fix it later today.

On Aug 6, 8:11 pm, AchipA  wrote:
> I might have missed a few classes, but where did the newfilename field
> go from SQLFORM's accepts/vars and why ? I know I can query it back
> from the DB but it's kind of awkward, having it returned by
> sqlform.accepts() was far more natural, especially considering
> transactions...
--~--~-~--~~~---~--~~
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:28140] Re: session forgetMeNot

2009-08-07 Thread rb

Thx. But where'd you get this info from?


On Aug 6, 10:31 pm, Richard  wrote:
> try auth.settings.expiration = X
>
> On Aug 7, 2:35 pm, rb  wrote:
>
> > Section 4.8 from the Web2py Manual states that session data remains
> > until/unless the user deletes the session cookie or else the session
> > expires. When does a session expire - or what causes a session to
> > expire? Do I have any control over maintaining the life of a session ?
> > I guess I can delete a session with "session.forget" but do I have a
> > "session.forgetMeNot" ? Below I show a snippet from section 4.8 which
> > talks about this.
>
> > ===
> > 4.8 session
>
> >     is another instance of the Storage  class. Whatever is stored into
> > session for example:
>
> > session.myvariable="hello"
>
> > can be retrieved at a later time:
>
> > a=session.myvariable
>
> > as long as the code is executed within the same session by the same
> > user
> > (provided the user has not deleted session cookies and the session did
> > not
> > expire).
> > ===
--~--~-~--~~~---~--~~
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:28141] Re: Bizzare Auth Bug. Could Fix But Need Massimo's Ok

2009-08-07 Thread mdipierro

Hi Bottiger,

When Auth was first developed was that if "username" is defined in a
custom "auth_user" table then it would be used.

I do not think we should modify the auth_user table in order to allow
an extension (openid) to work. I would prefer to create a mechanism of
hooks by which the extension can create its own tables and forms as
required. Every login mechanism may have its own requirements.

For example OpenID could have its own define_tables that makes openid
specific tables (including for example auth_user) then calls
Auth.define_tables for everything else.

There should also be a hook to allow openid to build and process its
own login form (perhaps by overriding Auth.login).

Make a proposal and I may accept a patch in this direction.

On Aug 6, 9:08 pm, Bottiger  wrote:
> At this point I think it would just be easier to let Massimo decide.
>
> Anyway, OpenID integration with Auth is coming along. It is usable but
> has some security concerns because people can change their OID in
> their profile.
>
> http://bitbucket.org/bottiger/web2py-openid-cas/overview/
>
> On Aug 6, 7:05 pm, Yarko Tymciurak  wrote:
>
> > maybe a fifth option is to make the username a settable item, much like
> > auth_table_name is,
> > have a username_name item, and thus the tables can be defined this way?
>
> > The advantage is it would simplify the tools code (instead of adding
> > try/except), and
> > I think would serve the need you point out.  What do you think?
>
> > Still just thinking out loud...
>
> > On Thu, Aug 6, 2009 at 9:00 PM, Yarko Tymciurak  wrote:
> > > That's fine - then if you are building an OpenID application, you can
> > > either:
> > > manually have a separate field, or - have the OpenID solution modify what
> > > the default auth fields are.
>
> > > This way, other apps still have choice.
>
> > > On Thu, Aug 6, 2009 at 8:54 PM, Bottiger  wrote:
>
> > >> > well, the problem then is that if you WANT to use email as username, 
> > >> > you
> > >> > have duplicate fields;
>
> > >> Actually as I am implementing OpenID, I am finding a need for a
> > >> separate field. In websites where you need to publicly display the
> > >> person's username, such as with comments etc... your users might not
> > >> like it if you displayed their email or First/Last name to the whole
> > >> Internet.
>
> > >> On Aug 6, 6:47 pm, Yarko Tymciurak  wrote:
> > >> > On Thu, Aug 6, 2009 at 8:42 PM, Bottiger  wrote:
>
> > >> > > Well you see, unlike the "username" column, the "email" column is
> > >> > > actually defined.
>
> > >> > > So there are 3 possible solutions.
>
> > >> > > 1. Define a "username" column in the "auth_user" table by default.
>
> > >> > well, the problem then is that if you WANT to use email as username, 
> > >> > you
> > >> > have duplicate fields;
> > >> > I don't like this solution;
>
> > >> > > 2. Change "username" to a column that is actually defined, such as
> > >> > > "first_name"
>
> > >> > It would have to be unique, and this isn't reasonable constraint for
> > >> > first_name or last_name (or even a combination of the two);
> > >> > I don't like this either;
>
> > >> > > 3. Remove the "username" check and usage completely.
>
> > >> > I think I like my action:  try username if that is what is passed in 
> > >> > the
> > >> > dict, perhaps raise a ticket a single time,
> > >> > and fall back to 'email' if 'username' doesn't exist.
>
> > >> > What do others think?
>
> > >> > > On Aug 6, 6:38 pm, Yarko Tymciurak  wrote:
> > >> > > > I see - so you would want an exception to be raised?   What do you
> > >> > > propose?
>
> > >> > > > On Thu, Aug 6, 2009 at 8:26 PM, Bottiger 
> > >> wrote:
>
> > >> > > > > The function takes a dictionary where if the username key is
> > >> defined,
> > >> > > > > then it assumes that your database has a "username" column which
> > >> is
> > >> > > > > incorrect behavior.
>
> > >> > > > > On Aug 6, 6:16 pm, Yarko Tymciurak  wrote:
> > >> > > > > > On Thu, Aug 6, 2009 at 8:09 PM, Bottiger 
> > >> > > wrote:
>
> > >> > > > > > > I am using the latest version.
>
> > >> > > > > > By "latest version" do you mean revision 1062 from Launchpad, 
> > >> > > > > > or
> > >> do
> > >> > > you
> > >> > > > > > mean
>
> > >> > > > > > > I know there is a check, but the check is useless. If you
> > >> specify a
> > >> > > > > > > username in the dictionary that comes with the argument, then
> > >> it
> > >> > > will
> > >> > > > > > > automatically assume that your auth_users table has a 
> > >> > > > > > > username
> > >> > > column,
> > >> > > > > > > which isn't the case.
>
> > >> > > > > > You you define the auth_users table, then you can define this
> > >> > > additional
> > >> > > > > > field;
> > >> > > > > > if not, it uses the email field.
> > >> > > > > > This is how it is designed.
>
> > >> > > > > > Am I missing something?
>
> > >> > > > > > > On Aug 6, 5:58 pm, Yarko Tymciurak  wrote:
> > >> > > > > > > > Which version of web2py are you looking at?
>
> > >> > > > > > >

[web2py:28142] Re: View Pagination Help

2009-08-07 Thread mdipierro

That code was very old so I cleaned it up a big. Anyway, your example
below should work and should have worked. What problems do you have?

On Aug 6, 9:20 pm, FERNANDO VILLARROEL  wrote:
> Hello.
>
> I am trying to implementing the example pagination:
>
> http://www.web2py.com/AlterEgo/default/show/95
>
> How i use backward and forward in the view:
>
> {{extend 'layout.html'}}
> Pagos Cliente
>
> 
>          
>          {{for row in rows:}}
>          ..
>          .
> 
>
> 
>
> {{=nav}}
>
> previous
>
> next
>
> How i use backward and forward ?
>
> Fernando
--~--~-~--~~~---~--~~
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:28143] ldap authentification

2009-08-07 Thread max

How can i configure the Active directory authentification using CAS?
should i have to uncomment and edit the
""
auth.settings.login_methods.append(ldap_auth
(mode='ad',server='my.domain.controller',base_dn="ou=Users,dc=domain,dc=com",bind_dn="cn=Administrator,ou=Users,d
c=domain,dc=com",bind_pass="password"))
""
or is there anyway to configure it application based?

--~--~-~--~~~---~--~~
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:28144] Re: session forgetMeNot

2009-08-07 Thread mdipierro

Let me clarify here:

The session object never expires.

The Auth(entication) information stored inside a session object does
expire. This has to do with login/login not with session data.
Basically session contains session.auth and if Auth expires,
session.auth is deleted.

This should be better documented. I will add a note in the new book.

Massimo


On Aug 7, 2:08 am, rb  wrote:
> Thx. But where'd you get this info from?
>
> On Aug 6, 10:31 pm, Richard  wrote:
>
> > try auth.settings.expiration = X
>
> > On Aug 7, 2:35 pm, rb  wrote:
>
> > > Section 4.8 from the Web2py Manual states that session data remains
> > > until/unless the user deletes the session cookie or else the session
> > > expires. When does a session expire - or what causes a session to
> > > expire? Do I have any control over maintaining the life of a session ?
> > > I guess I can delete a session with "session.forget" but do I have a
> > > "session.forgetMeNot" ? Below I show a snippet from section 4.8 which
> > > talks about this.
>
> > > ===
> > > 4.8 session
>
> > >     is another instance of the Storage  class. Whatever is stored into
> > > session for example:
>
> > > session.myvariable="hello"
>
> > > can be retrieved at a later time:
>
> > > a=session.myvariable
>
> > > as long as the code is executed within the same session by the same
> > > user
> > > (provided the user has not deleted session cookies and the session did
> > > not
> > > expire).
> > > ===
--~--~-~--~~~---~--~~
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:28145] Re: IS_EMAIL validator problem

2009-08-07 Thread mdipierro

I will take a patch for this.

Massimo

On Aug 7, 1:33 am, Jonathan Lundell  wrote:
> On Aug 6, 2009, at 9:32 PM, DenesL wrote:
>
> > IS_EMAIL does not follow the RFC specs for valid email addresses
> > (seehttp://en.wikipedia.org/wiki/E-mail_address)
>
> > even a simple a...@b.com fails
>
> > it is kinda late to work on the regex now, maybe tomorrow.
>
> The RFC is fairly hard to validate. If that's what we really want, I  
> found this one on the web that looks about right:
>
> ^(?!\.)("([^"\r\\]|\\["\r\\])*"|([-a-z0-9!#$%&'*+/=?^_`{|}~]|(?...@[a-
> z0-9][\w\.-]*[a-z0-9]\.[a-z][a-z\.]*[a-z]$
>
> It assumes the case-insensitive flag.
>
> http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email...
>
> Overkill? Or, what the heck?
--~--~-~--~~~---~--~~
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:28146] Re: IS_EMAIL validator problem

2009-08-07 Thread Jonathan Lundell

On Aug 7, 2009, at 12:22 AM, mdipierro wrote:

>
> I will take a patch for this.

If nobody else gets to it first, I'll work up a patch over the weekend.

>
> Massimo
>
> On Aug 7, 1:33 am, Jonathan Lundell  wrote:
>> On Aug 6, 2009, at 9:32 PM, DenesL wrote:
>>
>>> IS_EMAIL does not follow the RFC specs for valid email addresses
>>> (seehttp://en.wikipedia.org/wiki/E-mail_address)
>>
>>> even a simple a...@b.com fails
>>
>>> it is kinda late to work on the regex now, maybe tomorrow.
>>
>> The RFC is fairly hard to validate. If that's what we really want, I
>> found this one on the web that looks about right:
>>
>> ^(?!\.)("([^"\r\\]|\\["\r\\])*"|([-a-z0-9!#$%&'*+/=?^_`{|}~]|(?...@[a-
>> z0-9][\w\.-]*[a-z0-9]\.[a-z][a-z\.]*[a-z]$
>>
>> It assumes the case-insensitive flag.
>>
>> http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an- 
>> email...
>>
>> Overkill? Or, what the heck?



--~--~-~--~~~---~--~~
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:28147] Re: breadcrumb design

2009-08-07 Thread Richard

hi Alex,

I am now using this automatic breadcrumb function:


def breadcrumbs():
"Create breadcrumb links for current request"
# make links pretty by capitalizing and using 'home' instead of
'default'
pretty = lambda s: s.replace('default', 'home').replace('_', '
').capitalize()
menus = [A('Home', _href=URL(r=request, c='default', f='index'))]
if request.controller != 'default':
# add link to current controller
menus.append(A(pretty(request.controller), _href=URL
(r=request, c=request.controller, f='index')))
if request.function == 'index':
# are at root of controller
menus[-1] = pretty(request.controller)
else:
# are at function within controller
menus.append(pretty(request.function))
return XML(' > '.join(str(m) for m in menus))


Has anyone else got a system they can share?
Richard


On Aug 5, 10:48 am, Richard  wrote:
> On Jul 17, 10:52 am, Alex Fanjul  wrote:
>
> > I agree with you Richard,
> > In deed, in statusbar there is already a "kind of breadcrumb" but
> > wihtout links...
>
> > A vote for this inbuild functionallity...
> > Otherwise, I bet that someone has a quick and simple idea to do this
> > with one function and getting the information from url app, controller,
> > function.
>
> hmm, doing it automatically from the URL might work for me if I plan
> it right.
> Does anyone else already have their own breadcrumb system?
>
> Richard
--~--~-~--~~~---~--~~
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:28148] Re: db - stored procedure

2009-08-07 Thread Sebastian E. Ovide
consider also to change logic...

instead of calculating 50k age range every time that you need to see that
view, you could add an extra field containing the range... you could do add
an extra field telling when it will change range... then you could calculate
new range only on a fraction of the 50k and update those fields...

of course if you have 500k or more people you will feel the difference



2009/8/7 Yarko Tymciurak 

> can you calculate this as you process payment per person?  Or is this
> something that is calculated once a month?
>
> The idea is that stored procedures work on the database engine, and can
> sometimes be more efficient, but you can do the same as you describe on the
> selected data.
>
> I think perhaps a nice way to do this is with a database view, where you
> create a stored procedure, and return a non-stored value through the view.
>
> What i mean is the payment would look to web2py "like" a data table column,
> but in reality it would be a calculated value by your view, which would use
> a stored procedure to return the proper value.
>
> This means you would set migrate to False for your web2py table definition
> (you do not want to change the view, once the basic table is setup).
>
> You would create the stored procedure in whatever way is conveneint (most
> likely with a management tool for the database);
> You would create a VIEW in the database which would return all the fields
> of the "native" table, PLUS a field which would be defined as the return of
> your stored procedure on the current row-id, and the appropriate age fields.
>
> In web2py you COULD define an administrative function to make the initial
> "native" table, and then define a second one, migrate=False, and this payout
> field as readonly, and name it for the VIEW you created separately in your
> DB.
>
> That should nicely and transparently give you what you want.
>
> Perhaps others will have other ideas.  I have done things like this in the
> past, and it can work rather well.
>
> Regards,
> - Yarko
>
> 2009/8/6 陶艺夫 
>
> Thank you for reply.
>>
>> It's a charity project. The city goverment here decided to help old people
>> who aged 70 above financially every month. There are aid standards here:
>> age range : 70-7980-8990-9495-99100+
>> aid money:  30 80 150  300   500
>> You know, every month some people's ages will changed to the next age
>> range. So I need to calculate monthly every person's age to decide how much
>> money (s)he will get.
>> The fields of the people table:
>> name, gender, birth_date, township_id, community_id
>> When the calculating work is done, I need to generate an Excel file by
>> xlwt, a town a worksheet, the rows will be grouped by every community.
>> The aged 70+ people here is 50,000+.
>> Any solutions more efficient than python's "For Loop" on a huge DAL
>> records set?
>>
>> Thanks
>>
>>
>> 2009/8/7 mdipierro 
>>
>>
>>> You can do
>>>
>>> db.executesql('')
>>>
>>> and pass any sql you want. If you show us what you need to do
>>> specifically perhaps we can suggest a better way.
>>>
>>> Massimo
>>>
>>> On Aug 6, 1:13 pm, 陶艺夫  wrote:
>>> > Hi,
>>> > I'm using PostgreSQL, I need to use stored procedure to calculate on
>>> more
>>> > than 5 records -- according to every people's birthday, figure out
>>> how
>>> > much subsidy (s)he will get. Is this a rational idea?
>>> > I have done calculating by a controller, but it has taken more than 50
>>> > seconds to get the result. Is a stored procedure helpful for this? And
>>> how
>>> > to do it in DAL?
>>> >
>>> > Thanks.
>>>
>>>
>>
>>
>>
>
> >
>


-- 

Sebastian E. Ovide

skype: seezov

+353 87 6340149

Sent from Dublin, Ireland

--~--~-~--~~~---~--~~
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:28149] Re: db - stored procedure

2009-08-07 Thread 陶艺夫
Thank you!
I'll try the last method, it's more rational I think.

2009/8/7 Sebastian E. Ovide 

> consider also to change logic...
>
> instead of calculating 50k age range every time that you need to see that
> view, you could add an extra field containing the range... you could do add
> an extra field telling when it will change range... then you could calculate
> new range only on a fraction of the 50k and update those fields...
>
> of course if you have 500k or more people you will feel the difference
>
>
>
> 2009/8/7 Yarko Tymciurak 
>
> can you calculate this as you process payment per person?  Or is this
>> something that is calculated once a month?
>>
>> The idea is that stored procedures work on the database engine, and can
>> sometimes be more efficient, but you can do the same as you describe on the
>> selected data.
>>
>> I think perhaps a nice way to do this is with a database view, where you
>> create a stored procedure, and return a non-stored value through the view.
>>
>> What i mean is the payment would look to web2py "like" a data table
>> column, but in reality it would be a calculated value by your view, which
>> would use a stored procedure to return the proper value.
>>
>> This means you would set migrate to False for your web2py table definition
>> (you do not want to change the view, once the basic table is setup).
>>
>> You would create the stored procedure in whatever way is conveneint (most
>> likely with a management tool for the database);
>> You would create a VIEW in the database which would return all the fields
>> of the "native" table, PLUS a field which would be defined as the return of
>> your stored procedure on the current row-id, and the appropriate age fields.
>>
>> In web2py you COULD define an administrative function to make the initial
>> "native" table, and then define a second one, migrate=False, and this payout
>> field as readonly, and name it for the VIEW you created separately in your
>> DB.
>>
>> That should nicely and transparently give you what you want.
>>
>> Perhaps others will have other ideas.  I have done things like this in the
>> past, and it can work rather well.
>>
>> Regards,
>> - Yarko
>>
>> 2009/8/6 陶艺夫 
>>
>> Thank you for reply.
>>>
>>> It's a charity project. The city goverment here decided to help old
>>> people who aged 70 above financially every month. There are aid standards
>>> here:
>>> age range : 70-7980-8990-9495-99100+
>>> aid money:  30 80 150  300   500
>>> You know, every month some people's ages will changed to the next age
>>> range. So I need to calculate monthly every person's age to decide how much
>>> money (s)he will get.
>>> The fields of the people table:
>>> name, gender, birth_date, township_id, community_id
>>> When the calculating work is done, I need to generate an Excel file by
>>> xlwt, a town a worksheet, the rows will be grouped by every community.
>>> The aged 70+ people here is 50,000+.
>>> Any solutions more efficient than python's "For Loop" on a huge DAL
>>> records set?
>>>
>>> Thanks
>>>
>>>
>>> 2009/8/7 mdipierro 
>>>
>>>
 You can do

 db.executesql('')

 and pass any sql you want. If you show us what you need to do
 specifically perhaps we can suggest a better way.

 Massimo

 On Aug 6, 1:13 pm, 陶艺夫  wrote:
 > Hi,
 > I'm using PostgreSQL, I need to use stored procedure to calculate on
 more
 > than 5 records -- according to every people's birthday, figure out
 how
 > much subsidy (s)he will get. Is this a rational idea?
 > I have done calculating by a controller, but it has taken more than 50
 > seconds to get the result. Is a stored procedure helpful for this? And
 how
 > to do it in DAL?
 >
 > Thanks.


>>>
>>>
>>>
>>
>>
>>
>
>
> --
>
> Sebastian E. Ovide
>
> skype: seezov
>
> +353 87 6340149
>
> Sent from Dublin, Ireland
> >
>

--~--~-~--~~~---~--~~
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:28150] Form_factory on Google Appengine

2009-08-07 Thread Delaney Burke
Hi, i am using a form_factory on GAE and i keep getting this error.

In FILE: /base/data/home/apps/thewallapp/1.335448138740622861/ 
applications/init/controllers/account.py

Traceback (most recent call last):
   File "/base/data/home/apps/thewallapp/1.335448138740622861/gluon/ 
restricted.py", line 178, in restricted
 exec ccode in environment
   File "/base/data/home/apps/thewallapp/1.335448138740622861/ 
applications/init/controllers/account.py:signup", line 56, in 
   File "/base/data/home/apps/thewallapp/1.335448138740622861/gluon/ 
globals.py", line 101, in 
 self._caller = lambda f: f()
   File "/base/data/home/apps/thewallapp/1.335448138740622861/ 
applications/init/controllers/account.py:signup", line 38, in signup
   File "/base/data/home/apps/thewallapp/1.335448138740622861/gluon/ 
sqlhtml.py", line 866, in factory
 return SQLFORM(SQLDB(None).define_table('no_table', *fields),
   File "/base/data/home/apps/thewallapp/1.335448138740622861/gluon/ 
sql.py", line 675, in __init__
 os.mkdir(self._folder)
AttributeError: 'module' object has no attribute 'mkdir'

So i looked in the sql.py file and and found this
 # Creating the folder if it does not exists
 if self._folder:
 if not os.path.exists(self._folder):
os.mkdir(self._folder)
pass

When i change the file to

 # Creating the folder if it does not exists
 if self._folder:
 if not os.path.exists(self._folder):
#os.mkdir(self._folder)
pass

it all works fine.

from my investigations you are unable to make a directory on GAE and i  
think that is why it breaks.

 # Creating the folder if it does not exists
 if self._folder:
 if not os.path.exists(self._folder):
#os.mkdir(self._folder)
pass

what are the implications of commenting out this code ? have i just  
stored up another problem for myself later?
if there are no implications is there anyway of having some type of  
check the does not do this call if on GAE?

Thanks in advance Delaney Burke


--~--~-~--~~~---~--~~
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:28151] Re: Form_factory on Google Appengine

2009-08-07 Thread mdipierro

If you only use this on GAE there is no problem. The problem is that
somehow you are not uploading the yourapp/databases folder on GAE. It
should be there althought it should be empty.

On Aug 7, 6:05 am, Delaney Burke  wrote:
> Hi, i am using a form_factory on GAE and i keep getting this error.
>
> In FILE: /base/data/home/apps/thewallapp/1.335448138740622861/
> applications/init/controllers/account.py
>
> Traceback (most recent call last):
>    File "/base/data/home/apps/thewallapp/1.335448138740622861/gluon/
> restricted.py", line 178, in restricted
>      exec ccode in environment
>    File "/base/data/home/apps/thewallapp/1.335448138740622861/
> applications/init/controllers/account.py:signup", line 56, in 
>    File "/base/data/home/apps/thewallapp/1.335448138740622861/gluon/
> globals.py", line 101, in 
>      self._caller = lambda f: f()
>    File "/base/data/home/apps/thewallapp/1.335448138740622861/
> applications/init/controllers/account.py:signup", line 38, in signup
>    File "/base/data/home/apps/thewallapp/1.335448138740622861/gluon/
> sqlhtml.py", line 866, in factory
>      return SQLFORM(SQLDB(None).define_table('no_table', *fields),
>    File "/base/data/home/apps/thewallapp/1.335448138740622861/gluon/
> sql.py", line 675, in __init__
>      os.mkdir(self._folder)
> AttributeError: 'module' object has no attribute 'mkdir'
>
> So i looked in the sql.py file and and found this
>          # Creating the folder if it does not exists
>          if self._folder:
>              if not os.path.exists(self._folder):
>                         os.mkdir(self._folder)
>                 pass
>
> When i change the file to
>
>          # Creating the folder if it does not exists
>          if self._folder:
>              if not os.path.exists(self._folder):
>                         #os.mkdir(self._folder)
>                                 pass
>
> it all works fine.
>
> from my investigations you are unable to make a directory on GAE and i  
> think that is why it breaks.
>
>          # Creating the folder if it does not exists
>          if self._folder:
>              if not os.path.exists(self._folder):
>                         #os.mkdir(self._folder)
>                                 pass
>
> what are the implications of commenting out this code ? have i just  
> stored up another problem for myself later?
> if there are no implications is there anyway of having some type of  
> check the does not do this call if on GAE?
>
> Thanks in advance Delaney Burke
--~--~-~--~~~---~--~~
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:28152] Re: ldap authentification

2009-08-07 Thread Fran

On Aug 7, 8:19 am, max  wrote:
> How can i configure the Active directory authentification using CAS?
> should i have to uncomment and edit the
> ""
> auth.settings.login_methods.append(ldap_auth
> (mode='ad',server='my.domain.controller',base_dn="ou=Users,dc=domain,dc=com",bind_dn="cn=Administrator,ou=Users,d
> c=domain,dc=com",bind_pass="password"))
> ""
> or is there anyway to configure it application based?

You can use AD without CAS...just for a single application...this is
the usual usage.
I don't have experience of using it with CAS...I just downloaded the
CAS appliance & it doesn't seem to use Auth, so would need converting
to use Auth before it could be made to work with ldap_auth.

The best docs for LDAP authentication are currently within the source
(the new book also has some, but the source is fine):
gluon/contrib/login_methods/ldap_auth.py

So to use AD, you need to have 2 lines in your model (on top of the
usual Auth lines):
from gluon.contrib.login_methods.ldap_auth import ldap_auth
auth.settings.login_methods.append(ldap_auth(mode='ad',
server='my.domain.controller', base_dn='ou=Users,dc=domain,dc=com'))

This mode means that password is cached in DB & so you can access
using last password known to the app in case AD is down.
To not have this method, make the 2nd line instead:
auth.settings.login_methods = [ldap_auth(mode='ad',
server='my.domain.controller', base_dn='ou=Users,dc=domain,dc=com')]

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:28153] Re: LDAP Authentication notes

2009-08-07 Thread Fran

On Aug 6, 11:42 am, Ahmed Soliman  wrote:
>    1. Change password still checks the password against the database, it
>    should check binding to the LDAP instead.
>    2. We should add method to hook on change profile and change password to
>    update the LDAP as well.

Definitely - patch welcomed :)

Meanwhile I suggest users use their usual login system to amend their
password & simply disable this option within Web2Py applications:
auth.settings.actions_disabled.append('change_password')

(As well as not exposing in menus, of course)

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:28155] Re: ldap authentification

2009-08-07 Thread max

thanks, fran

On 7 Aug., 14:10, Fran  wrote:
> On Aug 7, 8:19 am, max  wrote:
>
> > How can i configure the Active directory authentification using CAS?
> > should i have to uncomment and edit the
> > ""
> > auth.settings.login_methods.append(ldap_auth
> > (mode='ad',server='my.domain.controller',base_dn="ou=Users,dc=domain,dc=com",bind_dn="cn=Administrator,ou=Users,d
> > c=domain,dc=com",bind_pass="password"))
> > ""
> > or is there anyway to configure it application based?
>
> You can use AD without CAS...just for a single application...this is
> the usual usage.
> I don't have experience of using it with CAS...I just downloaded the
> CAS appliance & it doesn't seem to use Auth, so would need converting
> to use Auth before it could be made to work with ldap_auth.
>
> The best docs for LDAP authentication are currently within the source
> (the new book also has some, but the source is fine):
> gluon/contrib/login_methods/ldap_auth.py
>
> So to use AD, you need to have 2 lines in your model (on top of the
> usual Auth lines):
> from gluon.contrib.login_methods.ldap_auth import ldap_auth
> auth.settings.login_methods.append(ldap_auth(mode='ad',
> server='my.domain.controller', base_dn='ou=Users,dc=domain,dc=com'))
>
> This mode means that password is cached in DB & so you can access
> using last password known to the app in case AD is down.
> To not have this method, make the 2nd line instead:
> auth.settings.login_methods = [ldap_auth(mode='ad',
> server='my.domain.controller', base_dn='ou=Users,dc=domain,dc=com')]
>
> 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:28154] Re: How to a static file as logo

2009-08-07 Thread Johann Spies

2009/8/6 Yarko Tymciurak :
> On Thu, Aug 6, 2009 at 9:49 AM, Mladen Milankovic  wrote:
>> {{=IMG(_src=URL(r=request, c='static', f='Tux.jpg'))}}
>>
>> Everything you want to write out in the view, from python code needs =
>> like: {{=variable}}
>
> Yes ... this will make more sense for example if you want to do more
> processing before outputting something, e.g.:
>
>  {{mylogo=IMG(_src=URL(r=request, c='static', f='Tux.jpg'))}}
>  {{ # more processing perhaps with mylogo...}}
>  {{ =mylogo  =title }}
>
> Think of the empty left-side of the assignment as a "here" assignment (e.g.,
> output)

Thanks to you two.  That helped me a lot.

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:28156] Question about where various things belong.

2009-08-07 Thread __future__

I realize that there are many place you *can* put things but I was
wondering if there is a best-practice or web2py convention I should
follow for where certain things belong.

In the controller, I am sure most people rely on custom functions for
various things.  Where should these functions live?  They don't seem
like they belong in the controller.  Should they go in a module?


--~--~-~--~~~---~--~~
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:28157] Re: Question about where various things belong.

2009-08-07 Thread Fran

On Aug 7, 3:03 pm, __future__  wrote:
> In the controller, I am sure most people rely on custom functions for
> various things.  Where should these functions live?  They don't seem
> like they belong in the controller.  Should they go in a module?

If the function only applies to that Controller, then I put it in the
controller.
If it applies to multiple Controllers then it can go into either the
Model or else a Module.
Currently I'm putting most stuff into the Model, but for performance
reasons, it can be better to move stuff to a Module & only import when
needed (the whole model gets processed each request)

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:28158] Re: Images page 60 list index out of range

2009-08-07 Thread jayvandal

I have two image records and two comment records
I will try your code
Thanks ,
Jim

On Aug 6, 11:54 pm, jayvandal  wrote:
> Error ticket for "images"
> Ticket 127.0.0.1.2009-08-06.23-39-06.cf3dcbd3-ce73-4175-8d61-
> ff5aca00c066
>
> Hello,
> I am reworking the tutorials in the web2py manual. In this Images
> 3.6 , I am following the  code and I am lost atthis point.
> Thanks for any help
> Jim
>
> Error traceback
> 1.2.3.4.5.6.7. Traceback (most recent call last):  File "gluon/
> restricted.py", line 178, in restricted  File "C:/web2py_win(2)/web2py/
> applications/images/controllers/default.py", line 19, in 
> File "gluon/globals.py", line 101, in   File "C:/web2py_win(2)/
> web2py/applications/images/controllers/default.py", line 6, in
> showIndexError: list index out of range
>
> In file: C:\web2py_win(2)\web2py\applications\images/controllers/
> default.py
> 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20. def index():
> images=db().select(db.image.ALL,orderby=db.image.title) return dict
> (images=images) def show(): image=db(db.image.id==request.args
> [0]).select()[0] form=SQLFORM(db.comment,fields=
> ['author','email','body']) form.vars.image_id=image.id if form.accepts
> (request.vars,session):   response.flash='your comment is posted'
> comments=db(db.comment.image_id==image.id).select() return dict
> (image=image,comments=comments,form=form)  def download(): import os
> path=os.path.join(request.folder,'uploads',request.args[0]) return
> response.stream(path)response._vars=response._caller(show)
--~--~-~--~~~---~--~~
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:28159] Re: IS_EMAIL validator problem

2009-08-07 Thread Carl

This is an excellent article on the traps to beware of when regex'ing
email address formats

http://www.regular-expressions.info/email.html

This may ignite a debate though :)

I favour this variation...
[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-
z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|gov|mil|biz|
info|mobi|name|aero|jobs|museum)\b

C


On Aug 7, 8:25 am, Jonathan Lundell  wrote:
> On Aug 7, 2009, at 12:22 AM, mdipierro wrote:
>
>
>
> > I will take a patch for this.
>
> If nobody else gets to it first, I'll work up a patch over the weekend.
>
>
>
>
>
> > Massimo
>
> > On Aug 7, 1:33 am, Jonathan Lundell  wrote:
> >> On Aug 6, 2009, at 9:32 PM, DenesL wrote:
>
> >>> IS_EMAIL does not follow the RFC specs for valid email addresses
> >>> (seehttp://en.wikipedia.org/wiki/E-mail_address)
>
> >>> even a simple a...@b.com fails
>
> >>> it is kinda late to work on the regex now, maybe tomorrow.
>
> >> The RFC is fairly hard to validate. If that's what we really want, I
> >> found this one on the web that looks about right:
>
> >> ^(?!\.)("([^"\r\\]|\\["\r\\])*"|([-a-z0-9!#$%&'*+/=?^_`{|}~]|(?...@[a-
> >> z0-9][\w\.-]*[a-z0-9]\.[a-z][a-z\.]*[a-z]$
>
> >> It assumes the case-insensitive flag.
>
> >>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-
> >> email...
>
> >> Overkill? Or, what the heck?
--~--~-~--~~~---~--~~
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:28160] Re: IS_EMAIL validator problem

2009-08-07 Thread Jonathan Lundell

On Aug 7, 2009, at 8:13 AM, Carl wrote:

>
> This is an excellent article on the traps to beware of when regex'ing
> email address formats
>
> http://www.regular-expressions.info/email.html
>
> This may ignite a debate though :)

A discussion, maybe. In the abstract, I like the idea of verifying the  
RFC verbatim, but we *should* be clear on what we're trying to do.  
Guard against typos? Prevent some kind of attack? How much do we care  
about false positives?

The article objects (to RFC-style checking) that j...@aol.com.nospam,  
for example, will validate. I'm not too concerned about that, in that  
there are lots of ways that a user can enter a wrong but  
(syntactically) valid address. We deal with that through active  
validation, not a syntax check.

Might there be a security concern? The quoted variation of the RFC  
checker is very permissive:

"([^"\r\\]|\\["\r\\])*"

Could that open the door to some kind of injection attack? Presumably  
we sanitize it for display; how about when we actually use it to send  
mail? Any consumer that doesn't understand quoted names could end up  
very confused.

I take false positives as a v. bad thing: if a user enters a real and  
valid address, I do not want to reject it. So I don't much like the  
explicit list of TLDs (below), on the grounds that it's bound to  
expand, and at some point it'll break. From the Wikipedia TLD article:

> During the 32nd International Public ICANN Meeting in Paris in 2008,  
> ICANN started a new process of TLD naming policy to take a  
> "significant step forward on the introduction of new generic top- 
> level domains." This program envisions the availability of many new  
> or already proposed domains, as well a new application and  
> implementation process. Observers believed that the new rules could  
> result in hundreds of new gTLDs to be registered. Proposed TLDs  
> include music, berlin and nyc.

I think I'd favor the RFC-style pattern without the quoted-name  
alternation.

One thing we could do is to give the developer an option:  
IS_EMAIL(something or other) that lets them select one of a small  
number of regexes. And of course the developer can always use IS_MATCH  
if they don't like our choice of email filters.

If we permitted a choice, I'd suggest:

1. default to the RFC regex, but without quoted names
2. RFC including quoted names
3. something like the pattern below, including the TLD filter (maybe)


>
> I favour this variation...
> [a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-
> z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|gov|mil|biz|
> info|mobi|name|aero|jobs|museum)\b
>
> C
>
>
> On Aug 7, 8:25 am, Jonathan Lundell  wrote:
>> On Aug 7, 2009, at 12:22 AM, mdipierro wrote:
>>
>>
>>
>>> I will take a patch for this.
>>
>> If nobody else gets to it first, I'll work up a patch over the  
>> weekend.
>>
>>
>>
>>
>>
>>> Massimo
>>
>>> On Aug 7, 1:33 am, Jonathan Lundell  wrote:
 On Aug 6, 2009, at 9:32 PM, DenesL wrote:
>>
> IS_EMAIL does not follow the RFC specs for valid email addresses
> (seehttp://en.wikipedia.org/wiki/E-mail_address)
>>
> even a simple a...@b.com fails
>>
> it is kinda late to work on the regex now, maybe tomorrow.
>>
 The RFC is fairly hard to validate. If that's what we really  
 want, I
 found this one on the web that looks about right:
>>
 ^(?!\.)("([^"\r\\]|\\["\r\\])*"|([-a-z0-9!#$%&'*+/=?^_`{|}~]|(?...@[a-
 z0-9][\w\.-]*[a-z0-9]\.[a-z][a-z\.]*[a-z]$
>>
 It assumes the case-insensitive flag.
>>
 http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-
 email...
>>
 Overkill? Or, what the heck?



--~--~-~--~~~---~--~~
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:28161] Re: IS_EMAIL validator problem

2009-08-07 Thread Carl

You've convinced me that staying close to RFC is a "best choice" even
though we lose the opportunity for users to correct addresses at the
point of data entry.

nb the suggested regex in my last posting doesn't work well enough!
e.g., a...@domain.co.uk isn't matched

C



On Aug 7, 4:48 pm, Jonathan Lundell  wrote:
> On Aug 7, 2009, at 8:13 AM, Carl wrote:
>
>
>
> > This is an excellent article on the traps to beware of when regex'ing
> > email address formats
>
> >http://www.regular-expressions.info/email.html
>
> > This may ignite a debate though :)
>
> A discussion, maybe. In the abstract, I like the idea of verifying the  
> RFC verbatim, but we *should* be clear on what we're trying to do.  
> Guard against typos? Prevent some kind of attack? How much do we care  
> about false positives?
>
> The article objects (to RFC-style checking) that j...@aol.com.nospam,  
> for example, will validate. I'm not too concerned about that, in that  
> there are lots of ways that a user can enter a wrong but  
> (syntactically) valid address. We deal with that through active  
> validation, not a syntax check.
>
> Might there be a security concern? The quoted variation of the RFC  
> checker is very permissive:
>
>         "([^"\r\\]|\\["\r\\])*"
>
> Could that open the door to some kind of injection attack? Presumably  
> we sanitize it for display; how about when we actually use it to send  
> mail? Any consumer that doesn't understand quoted names could end up  
> very confused.
>
> I take false positives as a v. bad thing: if a user enters a real and  
> valid address, I do not want to reject it. So I don't much like the  
> explicit list of TLDs (below), on the grounds that it's bound to  
> expand, and at some point it'll break. From the Wikipedia TLD article:
>
> > During the 32nd International Public ICANN Meeting in Paris in 2008,  
> > ICANN started a new process of TLD naming policy to take a  
> > "significant step forward on the introduction of new generic top-
> > level domains." This program envisions the availability of many new  
> > or already proposed domains, as well a new application and  
> > implementation process. Observers believed that the new rules could  
> > result in hundreds of new gTLDs to be registered. Proposed TLDs  
> > include music, berlin and nyc.
>
> I think I'd favor the RFC-style pattern without the quoted-name  
> alternation.
>
> One thing we could do is to give the developer an option:  
> IS_EMAIL(something or other) that lets them select one of a small  
> number of regexes. And of course the developer can always use IS_MATCH  
> if they don't like our choice of email filters.
>
> If we permitted a choice, I'd suggest:
>
>         1. default to the RFC regex, but without quoted names
>         2. RFC including quoted names
>         3. something like the pattern below, including the TLD filter (maybe)
>
>
>
>
>
> > I favour this variation...
> > [a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-
> > z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|gov|mil|biz|
> > info|mobi|name|aero|jobs|museum)\b
>
> > C
>
> > On Aug 7, 8:25 am, Jonathan Lundell  wrote:
> >> On Aug 7, 2009, at 12:22 AM, mdipierro wrote:
>
> >>> I will take a patch for this.
>
> >> If nobody else gets to it first, I'll work up a patch over the  
> >> weekend.
>
> >>> Massimo
>
> >>> On Aug 7, 1:33 am, Jonathan Lundell  wrote:
>  On Aug 6, 2009, at 9:32 PM, DenesL wrote:
>
> > IS_EMAIL does not follow the RFC specs for valid email addresses
> > (seehttp://en.wikipedia.org/wiki/E-mail_address)
>
> > even a simple a...@b.com fails
>
> > it is kinda late to work on the regex now, maybe tomorrow.
>
>  The RFC is fairly hard to validate. If that's what we really  
>  want, I
>  found this one on the web that looks about right:
>
>  ^(?!\.)("([^"\r\\]|\\["\r\\])*"|([-a-z0-9!#$%&'*+/=?^_`{|}~]|(?...@[a-
>  z0-9][\w\.-]*[a-z0-9]\.[a-z][a-z\.]*[a-z]$
>
>  It assumes the case-insensitive flag.
>
> http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-
>  email...
>
>  Overkill? Or, what the heck?
--~--~-~--~~~---~--~~
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:28162] Re: Fwd: My thoughts on web2py

2009-08-07 Thread Fran

On Aug 6, 10:12 pm, mdipierro  wrote:
> you can do it in your model?
> import datetime
> request.utcnow=datetime.datetime.utcnow()

Perfect, thanks :)

I'd suggest putting this into scaffolding app myself, but entirely
your call...

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:28163] Re: Fwd: My thoughts on web2py

2009-08-07 Thread Fran

On Aug 6, 10:12 pm, mdipierro  wrote:
> Why should I add when you can do it in your model?

So that it can be included in Auth without needing to subclass.

Seems like a good enough reason to me...

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:28164] Re: db - stored procedure

2009-08-07 Thread Donald Hughes

Are you trying to write 50,000 rows to a single webpage without
paging?  If so, you might find the bottleneck is in the browser trying
to render a table that large.



I ran the query below on a similar set of data, albeit in MS SQL
Server 2005 so I'm sure the SQL will vary from that of PostgreSQL. The
query below executed for me in less than second, though hardware and
platform considerations could change that.  Nonetheless, 5 records
is a very small table so long as it is properly indexed and I don't
doubt that PostgreSQL on commodity hardware could also deliver a
subsecond response.

select
ID, FIRST_NAME, LAST_NAME,
case when datediff(yy,BIRTH_DATE,getdate()) between 30 and 39 then
'5'
when datediff(yy,BIRTH_DATE,getdate()) between 40 and 49 then 
'10'
when datediff(yy,BIRTH_DATE,getdate()) between 50 and 59 then 
'15'
when datediff(yy,BIRTH_DATE,getdate()) between 60 and 69 then 
'20'
when datediff(yy,BIRTH_DATE,getdate()) between 70 and 79 then 
'30'
end
from PEOPLE




You would just need to add the township to the select and group by
clauses to additionally group by township and by age for your summary
report.

select  TOWNSHIP,
case when datediff(yy,BIRTH_DATE,getdate()) between 30
and 39 then '30-39'
when datediff(yy,BIRTH_DATE,getdate()) between 40 and 
49 then
'40-49'
when datediff(yy,BIRTH_DATE,getdate()) between 50 and 
59 then
'50-59'
when datediff(yy,BIRTH_DATE,getdate()) between 60 and 
69 then
'60-69'
when datediff(yy,BIRTH_DATE,getdate()) between 70 and 
79 then
'70-79'
end,
count(*)
from PEOPLE
group by
TOWNSHIP,
case when datediff(yy,BIRTH_DATE,getdate()) between 30 and 39 then
'30-39'
when datediff(yy,BIRTH_DATE,getdate()) between 40 and 49 then
'40-49'
when datediff(yy,BIRTH_DATE,getdate()) between 50 and 59 then
'50-59'
when datediff(yy,BIRTH_DATE,getdate()) between 60 and 69 then
'60-69'
when datediff(yy,BIRTH_DATE,getdate()) between 70 and 79 then
'70-79'
end



The above SQL produces results like (though I left the TOWNSHIP
grouping out since I don't have a similar column and for brevity):

30-39   9684
40-49   15344
50-59   15697
60-69   8581
70-79   2358
other   3206






On Aug 6, 1:13 pm, 陶艺夫  wrote:
> Hi,
> I'm using PostgreSQL, I need to use stored procedure to calculate on more
> than 5 records -- according to every people's birthday, figure out how
> much subsidy (s)he will get. Is this a rational idea?
> I have done calculating by a controller, but it has taken more than 50
> seconds to get the result. Is a stored procedure helpful for this? And how
> to do it in DAL?
>
> Thanks.

--~--~-~--~~~---~--~~
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:28165] problem with (supose) yaml file

2009-08-07 Thread Carlos Aboim
Hi folks,
I am developing on Mac Platform 10.4.11
With the GAE Laucher, but when I try to deploy my app to GAE
it seems the Laucher don't find the yaml
Here is the log error:
*** Running dev_appserver with the following flags:
   --admin_console_server= --port=8081
Python command: /usr/local/bin/python2.5
ERROR:root:Application configuration file not found in /Users/
preimpressao/Desktop/web2py

I have pointed the root folder for web2py app to deploy but no
sucess!!

I have tried to find that conf file manually but I couldn't findit
neigther!

Any sugestions??

Thanks
Carlos Aboim

--~--~-~--~~~---~--~~
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:28166] Re: Bizzare Auth Bug. Could Fix But Need Massimo's Ok

2009-08-07 Thread Yarko Tymciurak
Massimo -

There is nonetheless the issue Bottiger points out that if "username" is
passed in a form to this function, it will fail - there should be some
reasonable behavior (as per the discussions here).

I think this is a separate issue from what extensions may want to do.

I think we should address this also.   Do you have any thoughts about how
you would prefer (reading this thread)?  Do you have some alternate ideas?

Regards,
Yarko

On Fri, Aug 7, 2009 at 2:12 AM, mdipierro  wrote:

>
> Hi Bottiger,
>
> When Auth was first developed was that if "username" is defined in a
> custom "auth_user" table then it would be used.
>
> I do not think we should modify the auth_user table in order to allow
> an extension (openid) to work. I would prefer to create a mechanism of
> hooks by which the extension can create its own tables and forms as
> required. Every login mechanism may have its own requirements.
>
> For example OpenID could have its own define_tables that makes openid
> specific tables (including for example auth_user) then calls
> Auth.define_tables for everything else.
>
> There should also be a hook to allow openid to build and process its
> own login form (perhaps by overriding Auth.login).
>
> Make a proposal and I may accept a patch in this direction.
>
> On Aug 6, 9:08 pm, Bottiger  wrote:
> > At this point I think it would just be easier to let Massimo decide.
> >
> > Anyway, OpenID integration with Auth is coming along. It is usable but
> > has some security concerns because people can change their OID in
> > their profile.
> >
> > http://bitbucket.org/bottiger/web2py-openid-cas/overview/
> >
> > On Aug 6, 7:05 pm, Yarko Tymciurak  wrote:
> >
> > > maybe a fifth option is to make the username a settable item, much like
> > > auth_table_name is,
> > > have a username_name item, and thus the tables can be defined this way?
> >
> > > The advantage is it would simplify the tools code (instead of adding
> > > try/except), and
> > > I think would serve the need you point out.  What do you think?
> >
> > > Still just thinking out loud...
> >
> > > On Thu, Aug 6, 2009 at 9:00 PM, Yarko Tymciurak 
> wrote:
> > > > That's fine - then if you are building an OpenID application, you can
> > > > either:
> > > > manually have a separate field, or - have the OpenID solution modify
> what
> > > > the default auth fields are.
> >
> > > > This way, other apps still have choice.
> >
> > > > On Thu, Aug 6, 2009 at 8:54 PM, Bottiger 
> wrote:
> >
> > > >> > well, the problem then is that if you WANT to use email as
> username, you
> > > >> > have duplicate fields;
> >
> > > >> Actually as I am implementing OpenID, I am finding a need for a
> > > >> separate field. In websites where you need to publicly display the
> > > >> person's username, such as with comments etc... your users might not
> > > >> like it if you displayed their email or First/Last name to the whole
> > > >> Internet.
> >
> > > >> On Aug 6, 6:47 pm, Yarko Tymciurak  wrote:
> > > >> > On Thu, Aug 6, 2009 at 8:42 PM, Bottiger 
> wrote:
> >
> > > >> > > Well you see, unlike the "username" column, the "email" column
> is
> > > >> > > actually defined.
> >
> > > >> > > So there are 3 possible solutions.
> >
> > > >> > > 1. Define a "username" column in the "auth_user" table by
> default.
> >
> > > >> > well, the problem then is that if you WANT to use email as
> username, you
> > > >> > have duplicate fields;
> > > >> > I don't like this solution;
> >
> > > >> > > 2. Change "username" to a column that is actually defined, such
> as
> > > >> > > "first_name"
> >
> > > >> > It would have to be unique, and this isn't reasonable constraint
> for
> > > >> > first_name or last_name (or even a combination of the two);
> > > >> > I don't like this either;
> >
> > > >> > > 3. Remove the "username" check and usage completely.
> >
> > > >> > I think I like my action:  try username if that is what is passed
> in the
> > > >> > dict, perhaps raise a ticket a single time,
> > > >> > and fall back to 'email' if 'username' doesn't exist.
> >
> > > >> > What do others think?
> >
> > > >> > > On Aug 6, 6:38 pm, Yarko Tymciurak  wrote:
> > > >> > > > I see - so you would want an exception to be raised?   What do
> you
> > > >> > > propose?
> >
> > > >> > > > On Thu, Aug 6, 2009 at 8:26 PM, Bottiger  >
> > > >> wrote:
> >
> > > >> > > > > The function takes a dictionary where if the username key is
> > > >> defined,
> > > >> > > > > then it assumes that your database has a "username" column
> which
> > > >> is
> > > >> > > > > incorrect behavior.
> >
> > > >> > > > > On Aug 6, 6:16 pm, Yarko Tymciurak 
> wrote:
> > > >> > > > > > On Thu, Aug 6, 2009 at 8:09 PM, Bottiger <
> bottig...@gmail.com>
> > > >> > > wrote:
> >
> > > >> > > > > > > I am using the latest version.
> >
> > > >> > > > > > By "latest version" do you mean revision 1062 from
> Launchpad, or
> > > >> do
> > > >> > > you
> > > >> > > > > > mean
> >
> > > >> > > > > > > I know there is a check, but the c

[web2py:28167] Re: IS_EMAIL validator problem

2009-08-07 Thread Yarko Tymciurak
Whoever makes up this patch, since this is complicated enough,
can I ask you follow the commented regex style (re.X)
which is now used to validate paths;

see example starting on line 74 of main.py:
http://bazaar.launchpad.net/~mdipierro/web2py/devel/annotate/head%3A/gluon/main.py

Thanks,
- Yarko

On Fri, Aug 7, 2009 at 10:56 AM, Carl  wrote:

>
> You've convinced me that staying close to RFC is a "best choice" even
> though we lose the opportunity for users to correct addresses at the
> point of data entry.
>
> nb the suggested regex in my last posting doesn't work well enough!
> e.g., a...@domain.co.uk isn't matched
>
> C
>
>
>
> On Aug 7, 4:48 pm, Jonathan Lundell  wrote:
> > On Aug 7, 2009, at 8:13 AM, Carl wrote:
> >
> >
> >
> > > This is an excellent article on the traps to beware of when regex'ing
> > > email address formats
> >
> > >http://www.regular-expressions.info/email.html
> >
> > > This may ignite a debate though :)
> >
> > A discussion, maybe. In the abstract, I like the idea of verifying the
> > RFC verbatim, but we *should* be clear on what we're trying to do.
> > Guard against typos? Prevent some kind of attack? How much do we care
> > about false positives?
> >
> > The article objects (to RFC-style checking) that j...@aol.com.nospam,
> > for example, will validate. I'm not too concerned about that, in that
> > there are lots of ways that a user can enter a wrong but
> > (syntactically) valid address. We deal with that through active
> > validation, not a syntax check.
> >
> > Might there be a security concern? The quoted variation of the RFC
> > checker is very permissive:
> >
> > "([^"\r\\]|\\["\r\\])*"
> >
> > Could that open the door to some kind of injection attack? Presumably
> > we sanitize it for display; how about when we actually use it to send
> > mail? Any consumer that doesn't understand quoted names could end up
> > very confused.
> >
> > I take false positives as a v. bad thing: if a user enters a real and
> > valid address, I do not want to reject it. So I don't much like the
> > explicit list of TLDs (below), on the grounds that it's bound to
> > expand, and at some point it'll break. From the Wikipedia TLD article:
> >
> > > During the 32nd International Public ICANN Meeting in Paris in 2008,
> > > ICANN started a new process of TLD naming policy to take a
> > > "significant step forward on the introduction of new generic top-
> > > level domains." This program envisions the availability of many new
> > > or already proposed domains, as well a new application and
> > > implementation process. Observers believed that the new rules could
> > > result in hundreds of new gTLDs to be registered. Proposed TLDs
> > > include music, berlin and nyc.
> >
> > I think I'd favor the RFC-style pattern without the quoted-name
> > alternation.
> >
> > One thing we could do is to give the developer an option:
> > IS_EMAIL(something or other) that lets them select one of a small
> > number of regexes. And of course the developer can always use IS_MATCH
> > if they don't like our choice of email filters.
> >
> > If we permitted a choice, I'd suggest:
> >
> > 1. default to the RFC regex, but without quoted names
> > 2. RFC including quoted names
> > 3. something like the pattern below, including the TLD filter
> (maybe)
> >
> >
> >
> >
> >
> > > I favour this variation...
> > > [a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-
> > > z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|gov|mil|biz|
> > > info|mobi|name|aero|jobs|museum)\b
> >
> > > C
> >
> > > On Aug 7, 8:25 am, Jonathan Lundell  wrote:
> > >> On Aug 7, 2009, at 12:22 AM, mdipierro wrote:
> >
> > >>> I will take a patch for this.
> >
> > >> If nobody else gets to it first, I'll work up a patch over the
> > >> weekend.
> >
> > >>> Massimo
> >
> > >>> On Aug 7, 1:33 am, Jonathan Lundell  wrote:
> >  On Aug 6, 2009, at 9:32 PM, DenesL wrote:
> >
> > > IS_EMAIL does not follow the RFC specs for valid email addresses
> > > (seehttp://en.wikipedia.org/wiki/E-mail_address)
> >
> > > even a simple a...@b.com fails
> >
> > > it is kinda late to work on the regex now, maybe tomorrow.
> >
> >  The RFC is fairly hard to validate. If that's what we really
> >  want, I
> >  found this one on the web that looks about right:
> >
> >  ^(?!\.)("([^"\r\\]|\\["\r\\])*"|([-a-z0-9!#$%&'*+/=?^_`{|}~]|(?...@[a-
> >  z0-9][\w\.-]*[a-z0-9]\.[a-z][a-z\.]*[a-z]$
> >
> >  It assumes the case-insensitive flag.
> >
> > http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-
> >  email...
> >
> >  Overkill? Or, what the heck?
> >
>

--~--~-~--~~~---~--~~
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 opti

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

2009-08-07 Thread Yarko Tymciurak
even a commented out version of this in the scaffold, showing what you can
uncomment if you need utc might be useful.

On Fri, Aug 7, 2009 at 11:11 AM, Fran  wrote:

>
> On Aug 6, 10:12 pm, mdipierro  wrote:
> > Why should I add when you can do it in your model?
>
> So that it can be included in Auth without needing to subclass.
>
> Seems like a good enough reason to me...
>
> 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:28169] web2py ajax spreadsheet

2009-08-07 Thread mikech

New video on vimeo by mdpierro http://www.vimeo.com/5432441.
--~--~-~--~~~---~--~~
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:28170] Re: db - stored procedure

2009-08-07 Thread 陶艺夫
Thank you for you help!

I fetch all 5 records from database not for displaying in the browser.

I found the bottleneck was using python's 'for .. in ..' loops. I wrote a
record to a row of an Excel file(using xlwt) within every loop.

And I found it was unavoidable. Now for 5+ records, generating the Excel
file just take 61 seconds...


2009/8/7 Donald Hughes 

>
> Are you trying to write 50,000 rows to a single webpage without
> paging?  If so, you might find the bottleneck is in the browser trying
> to render a table that large.
>
>
>
> I ran the query below on a similar set of data, albeit in MS SQL
> Server 2005 so I'm sure the SQL will vary from that of PostgreSQL. The
> query below executed for me in less than second, though hardware and
> platform considerations could change that.  Nonetheless, 5 records
> is a very small table so long as it is properly indexed and I don't
> doubt that PostgreSQL on commodity hardware could also deliver a
> subsecond response.
>
> select
>ID, FIRST_NAME, LAST_NAME,
>case when datediff(yy,BIRTH_DATE,getdate()) between 30 and 39 then
> '5'
>when datediff(yy,BIRTH_DATE,getdate()) between 40 and 49
> then '10'
>when datediff(yy,BIRTH_DATE,getdate()) between 50 and 59
> then '15'
>when datediff(yy,BIRTH_DATE,getdate()) between 60 and 69
> then '20'
>when datediff(yy,BIRTH_DATE,getdate()) between 70 and 79
> then '30'
>end
> from PEOPLE
>
>
>
>
> You would just need to add the township to the select and group by
> clauses to additionally group by township and by age for your summary
> report.
>
> select  TOWNSHIP,
>case when datediff(yy,BIRTH_DATE,getdate()) between 30
> and 39 then '30-39'
>when datediff(yy,BIRTH_DATE,getdate()) between 40
> and 49 then
> '40-49'
>when datediff(yy,BIRTH_DATE,getdate()) between 50
> and 59 then
> '50-59'
>when datediff(yy,BIRTH_DATE,getdate()) between 60
> and 69 then
> '60-69'
>when datediff(yy,BIRTH_DATE,getdate()) between 70
> and 79 then
> '70-79'
>end,
>count(*)
> from PEOPLE
> group by
>TOWNSHIP,
>case when datediff(yy,BIRTH_DATE,getdate()) between 30 and 39 then
> '30-39'
>when datediff(yy,BIRTH_DATE,getdate()) between 40 and 49
> then
> '40-49'
>when datediff(yy,BIRTH_DATE,getdate()) between 50 and 59
> then
> '50-59'
>when datediff(yy,BIRTH_DATE,getdate()) between 60 and 69
> then
> '60-69'
>when datediff(yy,BIRTH_DATE,getdate()) between 70 and 79
> then
> '70-79'
>end
>
>
>
> The above SQL produces results like (though I left the TOWNSHIP
> grouping out since I don't have a similar column and for brevity):
>
> 30-39   9684
> 40-49   15344
> 50-59   15697
> 60-69   8581
> 70-79   2358
> other   3206
>
>
>
>
>
>
> On Aug 6, 1:13 pm, 陶艺夫  wrote:
> > Hi,
> > I'm using PostgreSQL, I need to use stored procedure to calculate on more
> > than 5 records -- according to every people's birthday, figure out
> how
> > much subsidy (s)he will get. Is this a rational idea?
> > I have done calculating by a controller, but it has taken more than 50
> > seconds to get the result. Is a stored procedure helpful for this? And
> how
> > to do it in DAL?
> >
> > Thanks.
>
> >
>

--~--~-~--~~~---~--~~
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:28171] Re: Images page 60 list index out of range

2009-08-07 Thread jayvandal

Hi,
I tried your code an I got the same error. It pointed to the first
line of your code gave the same error ,
I guess the first record is 0 so the code is pointing to the first
record?
Thanks for your help
Jim
Error ticket for "images"
Ticket
127.0.0.1.2009-08-07.11-47-01.0a2ffb3a-0bf3-4565-88e2-6c2c572178d0



Error traceback
1.2.3.4.5.6.7. Traceback (most recent call last):  File "gluon/
restricted.py", line 178, in restricted  File "C:/web2py_win(2)/web2py/
applications/images/controllers/default.py", line 24, in 
File "gluon/globals.py", line 101, in   File "C:/web2py_win(2)/
web2py/applications/images/controllers/default.py", line 6, in
showIndexError: list index out of range



In file: C:\web2py_win(2)\web2py\applications\images/controllers/
default.py
1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25. def
index(): images=db().select(db.image.ALL,orderby=db.image.title)
return dict(images=images) def show(): images = db(db.image.id ==
request.args[1]).select()  if len(images) < 1:session.flash = T
('No images to show!')image = images[0]  return dict()  image=db
(db.image.id==request.args[0]).select()[0] form=SQLFORM
(db.comment,fields=['author','email','body'])
form.vars.image_id=image.id if form.accepts(request.vars,session):
response.flash='your comment is posted' comments=db
(db.comment.image_id==image.id).select() return dict
(image=image,comments=comments,form=form)  def
==
This is the images files showing two  records.
==
customize me!
/images/default/index
Authentication
LoginRegisterLost PasswordMain Menu
IndexEdit This App
EditControllerViewLayoutStylesheetDB ModelMenu ModelDatabase
 images : image.id image.title image.file
2 me and me file
1 me and the shark file


Current Images
•me and me
•me and the shark


On Aug 7, 12:07 am, Yarko Tymciurak  wrote:
> did you create an image with the admin interface, as shown on p. 56?
>
> If you did not, then the select on line 6 would return NO records, and
> therefore select()[0] would create an
> index out of range.
>
> You can check / change this by re-writing the select in the show() procedure
> to something like this (I have not tried, so it might not be quite right):
>
> def show():
>     images = db(db.image.id == request.args[0]).select()
>     if len(images) < 1:
>        session.flash = T('No images to show!')
>        return dict()
>     image = images[0]
>     # the rest as is
>
> Regards,
> - Yarko
>
>
>
> On Fri, Aug 7, 2009 at 12:54 AM, jayvandal  wrote:
>
> > Error ticket for "images"
> > Ticket 127.0.0.1.2009-08-06.23-39-06.cf3dcbd3-ce73-4175-8d61-
> > ff5aca00c066
>
> > Hello,
> > I am reworking the tutorials in the web2py manual. In this Images
> > 3.6 , I am following the  code and I am lost atthis point.
> > Thanks for any help
> > Jim
>
> > Error traceback
> > 1.2.3.4.5.6.7. Traceback (most recent call last):  File "gluon/
> > restricted.py", line 178, in restricted  File "C:/web2py_win(2)/web2py/
> > applications/images/controllers/default.py", line 19, in 
> > File "gluon/globals.py", line 101, in   File "C:/web2py_win(2)/
> > web2py/applications/images/controllers/default.py", line 6, in
> > showIndexError: list index out of range
>
> > In file: C:\web2py_win(2)\web2py\applications\images/controllers/
> > default.py
> > 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20. def index():
> > images=db().select(db.image.ALL,orderby=db.image.title) return dict
> > (images=images) def show(): image=db(db.image.id==request.args
> > [0]).select()[0] form=SQLFORM(db.comment,fields=
> > ['author','email','body']) form.vars.image_id=image.id if form.accepts
> > (request.vars,session):   response.flash='your comment is posted'
> > comments=db(db.comment.image_id==image.id).select() return dict
> > (image=image,comments=comments,form=form)  def download(): import os
> > path=os.path.join(request.folder,'uploads',request.args[0]) return
> > response.stream(path)response._vars=response._caller(show)- 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:28172] Re: Images page 60 list index out of range

2009-08-07 Thread Yarko Tymciurak
that seems to be saying request.args[0] is the problem - make sure you don't
have a typo in
your views/default/index.html;  be sure you have the brackets properly
balanced in the
, args=[image.id]

part of the 5th line.

On Fri, Aug 7, 2009 at 1:54 PM, jayvandal  wrote:

>
> Hi,
> I tried your code an I got the same error. It pointed to the first
> line of your code gave the same error ,
> I guess the first record is 0 so the code is pointing to the first
> record?
> Thanks for your help
> Jim
> Error ticket for "images"
> Ticket
> 127.0.0.1.2009-08-07.11-47-01.0a2ffb3a-0bf3-4565-88e2-6c2c572178d0
>
>
>
> Error traceback
> 1.2.3.4.5.6.7. Traceback (most recent call last):  File "gluon/
> restricted.py", line 178, in restricted  File "C:/web2py_win(2)/web2py/
> applications/images/controllers/default.py", line 24, in 
> File "gluon/globals.py", line 101, in   File "C:/web2py_win(2)/
> web2py/applications/images/controllers/default.py", line 6, in
> showIndexError: list index out of range
>
>
>
> In file: C:\web2py_win(2)\web2py\applications\images/controllers/
> default.py
> 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25. def
> index(): images=db().select(db.image.ALL,orderby=db.image.title)
> return dict(images=images) def show(): images = db(db.image.id ==
> request.args[1]).select()  if len(images) < 1:session.flash = T
> ('No images to show!')image = images[0]  return dict()  image=db
> (db.image.id==request.args[0]).select()[0] form=SQLFORM
> (db.comment,fields=['author','email','body'])
> form.vars.image_id=image.id if form.accepts(request.vars,session):
> response.flash='your comment is posted' comments=db
> (db.comment.image_id==image.id).select() return dict
> (image=image,comments=comments,form=form)  def
> ==
> This is the images files showing two  records.
> ==
> customize me!
> /images/default/index
> Authentication
> LoginRegisterLost PasswordMain Menu
> IndexEdit This App
> EditControllerViewLayoutStylesheetDB ModelMenu ModelDatabase
>  images : image.id image.title image.file
> 2 me and me file
> 1 me and the shark file
>
>
> Current Images
> •me and me
> •me and the shark
>
>
> On Aug 7, 12:07 am, Yarko Tymciurak  wrote:
> > did you create an image with the admin interface, as shown on p. 56?
> >
> > If you did not, then the select on line 6 would return NO records, and
> > therefore select()[0] would create an
> > index out of range.
> >
> > You can check / change this by re-writing the select in the show()
> procedure
> > to something like this (I have not tried, so it might not be quite
> right):
> >
> > def show():
> > images = db(db.image.id == request.args[0]).select()
> > if len(images) < 1:
> >session.flash = T('No images to show!')
> >return dict()
> > image = images[0]
> > # the rest as is
> >
> > Regards,
> > - Yarko
> >
> >
> >
> > On Fri, Aug 7, 2009 at 12:54 AM, jayvandal  wrote:
> >
> > > Error ticket for "images"
> > > Ticket 127.0.0.1.2009-08-06.23-39-06.cf3dcbd3-ce73-4175-8d61-
> > > ff5aca00c066
> >
> > > Hello,
> > > I am reworking the tutorials in the web2py manual. In this Images
> > > 3.6 , I am following the  code and I am lost atthis point.
> > > Thanks for any help
> > > Jim
> >
> > > Error traceback
> > > 1.2.3.4.5.6.7. Traceback (most recent call last):  File "gluon/
> > > restricted.py", line 178, in restricted  File "C:/web2py_win(2)/web2py/
> > > applications/images/controllers/default.py", line 19, in 
> > > File "gluon/globals.py", line 101, in   File "C:/web2py_win(2)/
> > > web2py/applications/images/controllers/default.py", line 6, in
> > > showIndexError: list index out of range
> >
> > > In file: C:\web2py_win(2)\web2py\applications\images/controllers/
> > > default.py
> > > 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20. def index():
> > > images=db().select(db.image.ALL,orderby=db.image.title) return dict
> > > (images=images) def show(): image=db(db.image.id==request.args
> > > [0]).select()[0] form=SQLFORM(db.comment,fields=
> > > ['author','email','body']) form.vars.image_id=image.id if form.accepts
> > > (request.vars,session):   response.flash='your comment is posted'
> > > comments=db(db.comment.image_id==image.id).select() return dict
> > > (image=image,comments=comments,form=form)  def download(): import os
> > > path=os.path.join(request.folder,'uploads',request.args[0]) return
> > > response.stream(path)response._vars=response._caller(show)- 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:28173] Re: IS_EMAIL validator problem

2009-08-07 Thread Jonathan Lundell
On Aug 7, 2009, at 10:04 AM, Yarko Tymciurak wrote:

> Whoever makes up this patch, since this is complicated enough,
> can I ask you follow the commented regex style (re.X)
> which is now used to validate paths;
>
> see example starting on line 74 of main.py:
> http://bazaar.launchpad.net/~mdipierro/web2py/devel/annotate/head%3A/gluon/main.py

That's my plan (I'm the one who did the main.py re.X patch).

>
> Thanks,
> - Yarko
>
> On Fri, Aug 7, 2009 at 10:56 AM, Carl  wrote:
>
> You've convinced me that staying close to RFC is a "best choice" even
> though we lose the opportunity for users to correct addresses at the
> point of data entry.
>
> nb the suggested regex in my last posting doesn't work well enough!
> e.g., a...@domain.co.uk isn't matched
>
> C
>
>
>
> On Aug 7, 4:48 pm, Jonathan Lundell  wrote:
> > On Aug 7, 2009, at 8:13 AM, Carl wrote:
> >
> >
> >
> > > This is an excellent article on the traps to beware of when  
> regex'ing
> > > email address formats
> >
> > >http://www.regular-expressions.info/email.html
> >
> > > This may ignite a debate though :)
> >
> > A discussion, maybe. In the abstract, I like the idea of verifying  
> the
> > RFC verbatim, but we *should* be clear on what we're trying to do.
> > Guard against typos? Prevent some kind of attack? How much do we  
> care
> > about false positives?
> >
> > The article objects (to RFC-style checking) that  
> j...@aol.com.nospam,
> > for example, will validate. I'm not too concerned about that, in  
> that
> > there are lots of ways that a user can enter a wrong but
> > (syntactically) valid address. We deal with that through active
> > validation, not a syntax check.
> >
> > Might there be a security concern? The quoted variation of the RFC
> > checker is very permissive:
> >
> > "([^"\r\\]|\\["\r\\])*"
> >
> > Could that open the door to some kind of injection attack?  
> Presumably
> > we sanitize it for display; how about when we actually use it to  
> send
> > mail? Any consumer that doesn't understand quoted names could end up
> > very confused.
> >
> > I take false positives as a v. bad thing: if a user enters a real  
> and
> > valid address, I do not want to reject it. So I don't much like the
> > explicit list of TLDs (below), on the grounds that it's bound to
> > expand, and at some point it'll break. From the Wikipedia TLD  
> article:
> >
> > > During the 32nd International Public ICANN Meeting in Paris in  
> 2008,
> > > ICANN started a new process of TLD naming policy to take a
> > > "significant step forward on the introduction of new generic top-
> > > level domains." This program envisions the availability of many  
> new
> > > or already proposed domains, as well a new application and
> > > implementation process. Observers believed that the new rules  
> could
> > > result in hundreds of new gTLDs to be registered. Proposed TLDs
> > > include music, berlin and nyc.
> >
> > I think I'd favor the RFC-style pattern without the quoted-name
> > alternation.
> >
> > One thing we could do is to give the developer an option:
> > IS_EMAIL(something or other) that lets them select one of a small
> > number of regexes. And of course the developer can always use  
> IS_MATCH
> > if they don't like our choice of email filters.
> >
> > If we permitted a choice, I'd suggest:
> >
> > 1. default to the RFC regex, but without quoted names
> > 2. RFC including quoted names
> > 3. something like the pattern below, including the TLD  
> filter (maybe)
> >
> >
> >
> >
> >
> > > I favour this variation...
> > > [a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-] 
> +)*@(?:[a-
> > > z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|gov|mil| 
> biz|
> > > info|mobi|name|aero|jobs|museum)\b
> >
> > > C
> >
> > > On Aug 7, 8:25 am, Jonathan Lundell  wrote:
> > >> On Aug 7, 2009, at 12:22 AM, mdipierro wrote:
> >
> > >>> I will take a patch for this.
> >
> > >> If nobody else gets to it first, I'll work up a patch over the
> > >> weekend.
> >
> > >>> Massimo
> >
> > >>> On Aug 7, 1:33 am, Jonathan Lundell  wrote:
> >  On Aug 6, 2009, at 9:32 PM, DenesL wrote:
> >
> > > IS_EMAIL does not follow the RFC specs for valid email  
> addresses
> > > (seehttp://en.wikipedia.org/wiki/E-mail_address)
> >
> > > even a simple a...@b.com fails
> >
> > > it is kinda late to work on the regex now, maybe tomorrow.
> >
> >  The RFC is fairly hard to validate. If that's what we really
> >  want, I
> >  found this one on the web that looks about right:
> >
> >  ^(?!\.)("([^"\r\\]|\\["\r\\])*"|([-a-z0-9!#$%&'*+/=?^_`{|}~]| 
> (?...@[a-
> >  z0-9][\w\.-]*[a-z0-9]\.[a-z][a-z\.]*[a-z]$
> >
> >  It assumes the case-insensitive flag.
> >
> > http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-
> >  email...
> >
> >  Overkill? Or, what the heck?



--~--~-~--~~~---~--~~
You received this message because you are subscribed t

[web2py:28174] strftime problem

2009-08-07 Thread 陶艺夫
Hi, my app got an error in "db(db.person.birth_date>=_date)" , when the
_date had a value < '1900-01-01'. That's for python's strftime constraint.
I found chaging _date to _date.isoformat() would work, and I had to search
whole my app to make the change.
Or is there a better solution?

Thanks.

--~--~-~--~~~---~--~~
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:28175] Re: IS_EMAIL validator problem

2009-08-07 Thread Yarko Tymciurak
On Fri, Aug 7, 2009 at 2:14 PM, Jonathan Lundell  wrote:

> On Aug 7, 2009, at 10:04 AM, Yarko Tymciurak wrote:
>
> Whoever makes up this patch, since this is complicated enough,
> can I ask you follow the commented regex style (re.X)
> which is now used to validate paths;
>
> see example starting on line 74 of main.py:
>
> http://bazaar.launchpad.net/~mdipierro/web2py/devel/annotate/head%3A/gluon/main.py
>
>
> That's my plan (I'm the one who did the main.py re.X patch).
>

+1  (great!; thanks!)

>
>
> Thanks,
> - Yarko
>
> On Fri, Aug 7, 2009 at 10:56 AM, Carl  wrote:
>
>>
>> You've convinced me that staying close to RFC is a "best choice" even
>> though we lose the opportunity for users to correct addresses at the
>> point of data entry.
>>
>> nb the suggested regex in my last posting doesn't work well enough!
>> e.g., a...@domain.co.uk isn't matched
>>
>> C
>>
>>
>>
>> On Aug 7, 4:48 pm, Jonathan Lundell  wrote:
>> > On Aug 7, 2009, at 8:13 AM, Carl wrote:
>> >
>> >
>> >
>> > > This is an excellent article on the traps to beware of when regex'ing
>> > > email address formats
>> >
>> > >http://www.regular-expressions.info/email.html
>> >
>> > > This may ignite a debate though :)
>> >
>> > A discussion, maybe. In the abstract, I like the idea of verifying the
>> > RFC verbatim, but we *should* be clear on what we're trying to do.
>> > Guard against typos? Prevent some kind of attack? How much do we care
>> > about false positives?
>> >
>> > The article objects (to RFC-style checking) that j...@aol.com.nospam,
>> > for example, will validate. I'm not too concerned about that, in that
>> > there are lots of ways that a user can enter a wrong but
>> > (syntactically) valid address. We deal with that through active
>> > validation, not a syntax check.
>> >
>> > Might there be a security concern? The quoted variation of the RFC
>> > checker is very permissive:
>> >
>> > "([^"\r\\]|\\["\r\\])*"
>> >
>> > Could that open the door to some kind of injection attack? Presumably
>> > we sanitize it for display; how about when we actually use it to send
>> > mail? Any consumer that doesn't understand quoted names could end up
>> > very confused.
>> >
>> > I take false positives as a v. bad thing: if a user enters a real and
>> > valid address, I do not want to reject it. So I don't much like the
>> > explicit list of TLDs (below), on the grounds that it's bound to
>> > expand, and at some point it'll break. From the Wikipedia TLD article:
>> >
>> > > During the 32nd International Public ICANN Meeting in Paris in 2008,
>> > > ICANN started a new process of TLD naming policy to take a
>> > > "significant step forward on the introduction of new generic top-
>> > > level domains." This program envisions the availability of many new
>> > > or already proposed domains, as well a new application and
>> > > implementation process. Observers believed that the new rules could
>> > > result in hundreds of new gTLDs to be registered. Proposed TLDs
>> > > include music, berlin and nyc.
>> >
>> > I think I'd favor the RFC-style pattern without the quoted-name
>> > alternation.
>> >
>> > One thing we could do is to give the developer an option:
>> > IS_EMAIL(something or other) that lets them select one of a small
>> > number of regexes. And of course the developer can always use IS_MATCH
>> > if they don't like our choice of email filters.
>> >
>> > If we permitted a choice, I'd suggest:
>> >
>> > 1. default to the RFC regex, but without quoted names
>> > 2. RFC including quoted names
>> > 3. something like the pattern below, including the TLD filter
>> (maybe)
>> >
>> >
>> >
>> >
>> >
>> > > I favour this variation...
>> > > [a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-
>> > > z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|gov|mil|biz|
>> > > info|mobi|name|aero|jobs|museum)\b
>> >
>> > > C
>> >
>> > > On Aug 7, 8:25 am, Jonathan Lundell  wrote:
>> > >> On Aug 7, 2009, at 12:22 AM, mdipierro wrote:
>> >
>> > >>> I will take a patch for this.
>> >
>> > >> If nobody else gets to it first, I'll work up a patch over the
>> > >> weekend.
>> >
>> > >>> Massimo
>> >
>> > >>> On Aug 7, 1:33 am, Jonathan Lundell  wrote:
>> >  On Aug 6, 2009, at 9:32 PM, DenesL wrote:
>> >
>> > > IS_EMAIL does not follow the RFC specs for valid email addresses
>> > > (seehttp://en.wikipedia.org/wiki/E-mail_address)
>> >
>> > > even a simple a...@b.com fails
>> >
>> > > it is kinda late to work on the regex now, maybe tomorrow.
>> >
>> >  The RFC is fairly hard to validate. If that's what we really
>> >  want, I
>> >  found this one on the web that looks about right:
>> >
>> >  ^(?!\.)("([^"\r\\]|\\["\r\\])*"|([-a-z0-9!#$%&'*+/=?^_`{|}~]|(?...@[a-
>> >  z0-9][\w\.-]*[a-z0-9]\.[a-z][a-z\.]*[a-z]$
>> >
>> >  It assumes the case-insensitive flag.
>> >
>> > http://h

[web2py:28176] Re: strftime problem

2009-08-07 Thread Yarko Tymciurak
Wow!  You're preparing for dealing with some of the oldest living people on
earth here!

On Fri, Aug 7, 2009 at 2:22 PM, 陶艺夫  wrote:

> Hi, my app got an error in "db(db.person.birth_date>=_date)" , when the
> _date had a value < '1900-01-01'. That's for python's strftime constraint.
> I found chaging _date to _date.isoformat() would work, and I had to search
> whole my app to make the change.
> Or is there a better solution?
>
> Thanks.
>
> >
>

--~--~-~--~~~---~--~~
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:28177] Re: problem with (supose) yaml file

2009-08-07 Thread mdipierro

You need the source version to deploy on GAE. The binary versions do
not include the app.yaml file. Even if we did you would still need the
source version to run the google development server, something you
must do in order to build the index.yaml file. Moreover the binary
version only include the pyc files (not the py files) and they do not
run on GAE because they have a funny magic number.


On Aug 7, 10:23 am, Carlos Aboim  wrote:
> Hi folks,
> I am developing on Mac Platform 10.4.11
> With the GAE Laucher, but when I try to deploy my app to GAE
> it seems the Laucher don't find the yaml
> Here is the log error:
> *** Running dev_appserver with the following flags:
>    --admin_console_server= --port=8081
> Python command: /usr/local/bin/python2.5
> ERROR:root:Application configuration file not found in /Users/
> preimpressao/Desktop/web2py
>
> I have pointed the root folder for web2py app to deploy but no
> sucess!!
>
> I have tried to find that conf file manually but I couldn't findit
> neigther!
>
> Any sugestions??
>
> Thanks
> Carlos Aboim
--~--~-~--~~~---~--~~
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:28178] filtering values offered in selectbox

2009-08-07 Thread David Zejda

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello!

Is it possible to restrict or filter choices listed in a select box
generated by SQLFORM for a field referring to other table?

E.g. I have a field person_id with reference to person.id. I wish to
allow only persons, who meet some criteria according to other fields in
the person table or based on certain joins, to be offered in the select box.

Thank you!

David.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkp8qvoACgkQ3oCkkciamVFHkQCcC0TyPb9QMSjfrDl7ly+1NxOa
ERoAn0s5kfjMDwAvf8KUXWG7vPSFzj03
=8cOP
-END PGP SIGNATURE-

--~--~-~--~~~---~--~~
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:28179] Re: strftime problem

2009-08-07 Thread 陶艺夫

It's just a try, means nothing :)
But what if the date is not birth_date and really means something


2009/8/8, Yarko Tymciurak :
> Wow!  You're preparing for dealing with some of the oldest living people on
> earth here!
>
> On Fri, Aug 7, 2009 at 2:22 PM, 陶艺夫  wrote:
>
>> Hi, my app got an error in "db(db.person.birth_date>=_date)" , when the
>> _date had a value < '1900-01-01'. That's for python's strftime constraint.
>> I found chaging _date to _date.isoformat() would work, and I had to search
>> whole my app to make the change.
>> Or is there a better solution?
>>
>> Thanks.
>>
>> >
>>
>
> >
>

--~--~-~--~~~---~--~~
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:28180] Bug: rows.response is no longer a list

2009-08-07 Thread rfx_labs

Hi,

rows.response is now SQLite3.row but shut be list:

Manual Page 146:
Notice that an SQLRows object is a container for:
1 rows.colnames
2 rows.response
colnames is a list of the column names returned by the raw select.
response
is a list of tuples which containes the raw response of select, before
being
parsed and converted to the proper web2py format.

This breaks me 2 of my 8 Applications and also rows.as_list
(storage_to_dict=False)


Kind regards

Martin


--~--~-~--~~~---~--~~
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:28181] Moving Questions to Stackoverflow

2009-08-07 Thread Bottiger

We should direct people to http://stackoverflow.com to answer
questions in order to boost traffic.

There is a bigger audience there and people regularly seeing Web2Py
being asked may stumble upon it. Google Groups is not a very
convenient way to find questions and answers.
--~--~-~--~~~---~--~~
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:28182] Re: How to POST information from link?

2009-08-07 Thread Alastair Medford

I was thinking it would take me a long time to figure out how to use
jquery for this application, but I guess it's been a while since I've
looked at the source because I think I can already spot what I need to
do. I should just be able to copy the function but change .value to
whatever tag attribute I'm stashing the data in. Thanks for the heads
up.

On Aug 7, 1:01 am, mdipierro  wrote:
> This is the source of the web2py ajax function:
>
> function ajax(u,s,t)
> {
>   var
> query="";
>   for(i=0; i {
>      if(i>0) query=query
> +"&";
>      query=query+encodeURIComponent(s[i])+"="+encodeURIComponent
> (document.getElementById(s[i]).value);
>   }
>   jQuery.ajax({type: "POST", url: u, data: query, success: function
> (msg) { if(t==':eval') eval(msg); else document.getE\
> lementById
> (t).innerHTML=msg; } });
>
> }
>
> As you can see it calls jQuery.ajax which is more powerful and you can
> pass "data" it. I think you can do what you need using the
> jQuery.ajax.
>
> On Aug 6, 6:55 pm, Alastair Medford  wrote:
>
> > What I'm trying to do is place information into a nornal  link,
> > which will be sent along with an onclick ajax call. I know how to do
> > this when the information is from an  tag just fine. But in
> > this case I would like the information, like an id, to be contained
> > somewhere in the  tag itself.
>
> > The reasoning behind this is I would like to build a jquery tree, and
> > when a link inside is clicked, an ajax function is called that then
> > "knows" which link was clicked and will act accordingly. I've tried
> > sending the  tag along by adding its id to the arguments of the
> > ajax call, but its value in request.vars ends up being undefined. I
> > theoreticaly could have a hidden field with each element containing
> > the id but this seems messy. Is there a better way?
>
> > The reason I'm not just straight out callng controller functions is
> > this tree will be generated from a user made xml file. It's then used
> > to find content in another user made file, so it has nothing to with
> > calling certain 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:28183] Re: filtering values offered in selectbox

2009-08-07 Thread DenesL

Hi David,

use any query in combination with widget e.g.:

q=db.person.name.like('A%')
r=db(q).select(db.person.id,db.person.name)
db.table2.person_id.widget= lambda self,value: SELECT
(_name='person_id',*[OPTION(e.name,_value=e.id) for e in r])

you can also build the validator:
db.table2.person_id.requires=IS_IN_SET([e.id for e in r])

Notes:
- you have to handle the special case where r is empty.
- _name in SELECT is required, otherwise appadmin does not work
  (@developers: should appadmin.insert check form.errors ?)


Denes.
--~--~-~--~~~---~--~~
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:28184] Re: Images page 60 list index out of range

2009-08-07 Thread jayvandal

I have been checking the code.It seemed to bethe first record. Ihad
trouble trying to delete one record so ii DELETED THE DATABASE ising
the delete  of default db. I reintered the database description  and
entered two records. I deleted the  then tried to enter the comment
records. I tried the update and go the IMAGE did not exist. I looked
ate the SQL logand saw there were two instances of image and comment.
Is that what is susposed to be?
Thanks
Jim

On Aug 7, 12:54 pm, jayvandal  wrote:
> Hi,
> I tried your code an I got the same error. It pointed to the first
> line of your code gave the same error ,
> I guess the first record is 0 so the code is pointing to the first
> record?
> Thanks for your help
> Jim
> Error ticket for "images"
> Ticket
> 127.0.0.1.2009-08-07.11-47-01.0a2ffb3a-0bf3-4565-88e2-6c2c572178d0
>
> Error traceback
> 1.2.3.4.5.6.7. Traceback (most recent call last):  File "gluon/
> restricted.py", line 178, in restricted  File "C:/web2py_win(2)/web2py/
> applications/images/controllers/default.py", line 24, in 
> File "gluon/globals.py", line 101, in   File "C:/web2py_win(2)/
> web2py/applications/images/controllers/default.py", line 6, in
> showIndexError: list index out of range
>
> In file: C:\web2py_win(2)\web2py\applications\images/controllers/
> default.py
> 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25. def
> index(): images=db().select(db.image.ALL,orderby=db.image.title)
> return dict(images=images) def show(): images = db(db.image.id ==
> request.args[1]).select()  if len(images) < 1:    session.flash = T
> ('No images to show!')    image = images[0]  return dict()  image=db
> (db.image.id==request.args[0]).select()[0] form=SQLFORM
> (db.comment,fields=['author','email','body'])
> form.vars.image_id=image.id if form.accepts(request.vars,session):
> response.flash='your comment is posted' comments=db
> (db.comment.image_id==image.id).select() return dict
> (image=image,comments=comments,form=form)  def
> ==
> This is the images files showing two  records.
> ==
> customize me!
> /images/default/index
> Authentication
> LoginRegisterLost PasswordMain Menu
> IndexEdit This App
> EditControllerViewLayoutStylesheetDB ModelMenu ModelDatabase
>  images : image.id image.title image.file
> 2 me and me file
> 1 me and the shark file
>
> Current Images
> •me and me
> •me and the shark
>
> On Aug 7, 12:07 am, Yarko Tymciurak  wrote:
>
>
>
> > did you create an image with the admin interface, as shown on p. 56?
>
> > If you did not, then the select on line 6 would return NO records, and
> > therefore select()[0] would create an
> > index out of range.
>
> > You can check / change this by re-writing the select in the show() procedure
> > to something like this (I have not tried, so it might not be quite right):
>
> > def show():
> >     images = db(db.image.id == request.args[0]).select()
> >     if len(images) < 1:
> >        session.flash = T('No images to show!')
> >        return dict()
> >     image = images[0]
> >     # the rest as is
>
> > Regards,
> > - Yarko
>
> > On Fri, Aug 7, 2009 at 12:54 AM,jayvandal wrote:
>
> > > Error ticket for "images"
> > > Ticket 127.0.0.1.2009-08-06.23-39-06.cf3dcbd3-ce73-4175-8d61-
> > > ff5aca00c066
>
> > > Hello,
> > > I am reworking the tutorials in the web2py manual. In this Images
> > > 3.6 , I am following the  code and I am lost atthis point.
> > > Thanks for any help
> > > Jim
>
> > > Error traceback
> > > 1.2.3.4.5.6.7. Traceback (most recent call last):  File "gluon/
> > > restricted.py", line 178, in restricted  File "C:/web2py_win(2)/web2py/
> > > applications/images/controllers/default.py", line 19, in 
> > > File "gluon/globals.py", line 101, in   File "C:/web2py_win(2)/
> > > web2py/applications/images/controllers/default.py", line 6, in
> > > showIndexError: list index out of range
>
> > > In file: C:\web2py_win(2)\web2py\applications\images/controllers/
> > > default.py
> > > 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20. def index():
> > > images=db().select(db.image.ALL,orderby=db.image.title) return dict
> > > (images=images) def show(): image=db(db.image.id==request.args
> > > [0]).select()[0] form=SQLFORM(db.comment,fields=
> > > ['author','email','body']) form.vars.image_id=image.id if form.accepts
> > > (request.vars,session):   response.flash='your comment is posted'
> > > comments=db(db.comment.image_id==image.id).select() return dict
> > > (image=image,comments=comments,form=form)  def download(): import os
> > > path=os.path.join(request.folder,'uploads',request.args[0]) return
> > > response.stream(path)response._vars=response._caller(show)- Hide quoted 
> > > text -
>
> > - Show quoted text -- 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 ema

[web2py:28185] Vista a problem for web2py?

2009-08-07 Thread jayvandal

Could I have problems with Vista and web2py? I am having trouble in
WIKI in web2py manual  with the index as I had in IMAGES??
JIM
--~--~-~--~~~---~--~~
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:28186] Re: Images page 60 list index out of range

2009-08-07 Thread Yarko Tymciurak
I'm not sure how you deleted the database, but you could have a confused
web2py - it keeps track of the state of migrations / creations of the tables
in the databases directory of your application;  you wiill want to remocve
the *.table and *.log files from there;  If you are using sqlite - the
default db, you can just delete the contents of the databases directory, and
then run your app again (no need to re-enter the code).

There should be no problem with Vista.

- Yarko

On Fri, Aug 7, 2009 at 10:16 PM, jayvandal  wrote:

>
> I have been checking the code.It seemed to bethe first record. Ihad
> trouble trying to delete one record so ii DELETED THE DATABASE ising
> the delete  of default db. I reintered the database description  and
> entered two records. I deleted the  then tried to enter the comment
> records. I tried the update and go the IMAGE did not exist. I looked
> ate the SQL logand saw there were two instances of image and comment.
> Is that what is susposed to be?
> Thanks
> Jim
>
> On Aug 7, 12:54 pm, jayvandal  wrote:
> > Hi,
> > I tried your code an I got the same error. It pointed to the first
> > line of your code gave the same error ,
> > I guess the first record is 0 so the code is pointing to the first
> > record?
> > Thanks for your help
> > Jim
> > Error ticket for "images"
> > Ticket
> > 127.0.0.1.2009-08-07.11-47-01.0a2ffb3a-0bf3-4565-88e2-6c2c572178d0
> >
> > Error traceback
> > 1.2.3.4.5.6.7. Traceback (most recent call last):  File "gluon/
> > restricted.py", line 178, in restricted  File "C:/web2py_win(2)/web2py/
> > applications/images/controllers/default.py", line 24, in 
> > File "gluon/globals.py", line 101, in   File "C:/web2py_win(2)/
> > web2py/applications/images/controllers/default.py", line 6, in
> > showIndexError: list index out of range
> >
> > In file: C:\web2py_win(2)\web2py\applications\images/controllers/
> > default.py
> > 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25. def
> > index(): images=db().select(db.image.ALL,orderby=db.image.title)
> > return dict(images=images) def show(): images = db(db.image.id ==
> > request.args[1]).select()  if len(images) < 1:session.flash = T
> > ('No images to show!')image = images[0]  return dict()  image=db
> > (db.image.id==request.args[0]).select()[0] form=SQLFORM
> > (db.comment,fields=['author','email','body'])
> > form.vars.image_id=image.id if form.accepts(request.vars,session):
> > response.flash='your comment is posted' comments=db
> > (db.comment.image_id==image.id).select() return dict
> > (image=image,comments=comments,form=form)  def
> > ==
> > This is the images files showing two  records.
> > ==
> > customize me!
> > /images/default/index
> > Authentication
> > LoginRegisterLost PasswordMain Menu
> > IndexEdit This App
> > EditControllerViewLayoutStylesheetDB ModelMenu ModelDatabase
> >  images : image.id image.title image.file
> > 2 me and me file
> > 1 me and the shark file
> >
> > Current Images
> > •me and me
> > •me and the shark
> >
> > On Aug 7, 12:07 am, Yarko Tymciurak  wrote:
> >
> >
> >
> > > did you create an image with the admin interface, as shown on p. 56?
> >
> > > If you did not, then the select on line 6 would return NO records, and
> > > therefore select()[0] would create an
> > > index out of range.
> >
> > > You can check / change this by re-writing the select in the show()
> procedure
> > > to something like this (I have not tried, so it might not be quite
> right):
> >
> > > def show():
> > > images = db(db.image.id == request.args[0]).select()
> > > if len(images) < 1:
> > >session.flash = T('No images to show!')
> > >return dict()
> > > image = images[0]
> > > # the rest as is
> >
> > > Regards,
> > > - Yarko
> >
> > > On Fri, Aug 7, 2009 at 12:54 AM,jayvandal wrote:
> >
> > > > Error ticket for "images"
> > > > Ticket 127.0.0.1.2009-08-06.23-39-06.cf3dcbd3-ce73-4175-8d61-
> > > > ff5aca00c066
> >
> > > > Hello,
> > > > I am reworking the tutorials in the web2py manual. In this Images
> > > > 3.6 , I am following the  code and I am lost atthis point.
> > > > Thanks for any help
> > > > Jim
> >
> > > > Error traceback
> > > > 1.2.3.4.5.6.7. Traceback (most recent call last):  File "gluon/
> > > > restricted.py", line 178, in restricted  File
> "C:/web2py_win(2)/web2py/
> > > > applications/images/controllers/default.py", line 19, in 
> > > > File "gluon/globals.py", line 101, in   File
> "C:/web2py_win(2)/
> > > > web2py/applications/images/controllers/default.py", line 6, in
> > > > showIndexError: list index out of range
> >
> > > > In file: C:\web2py_win(2)\web2py\applications\images/controllers/
> > > > default.py
> > > > 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20. def index():
> > > > images=db().select(db.image.ALL,orderby=db.image.title) return dict
> > > > (images=images) def show(): image=db(db.image.id==request.args
> > > > [0]

[web2py:28187] Re: Web2py Plug-in system

2009-08-07 Thread waTR

What about starting a wiki on this? Just post everything that has been
achieved to-date re: specification ideas.



On Aug 6, 11:54 pm, mdipierro  wrote:
> We talk about this over and over but no progress. It is not an issue
> of coding. We define a plugin as a piece of an application stored in:
>
> models/plugin_[name].py
> controllers/plugin_[name].py
> views/plugin_[name]/*.html
> modules/plugin_[name]/*
> static/plugin_[name]/*
>
> We also need a convention for metadata about the exposed functions/
> urls. This was never done.
> Until we have clear specs we cannot say we have a decent plugin
> system.
>
> Massimo
>
> On Aug 6, 5:37 pm, b00m_chef  wrote:
>
> > Is this being worked on? Who is involved? Is there a specification
> > somewhere?
--~--~-~--~~~---~--~~
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:28188] Web2py.com down

2009-08-07 Thread b00m_chef

Just tried to access web2py.com and was not up.

Tried using a proxy (guardster), same result.
--~--~-~--~~~---~--~~
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:28189] Re: Web2py.com down

2009-08-07 Thread Yarko Tymciurak
try www.web2py.com

On Fri, Aug 7, 2009 at 11:33 PM, b00m_chef  wrote:

>
> Just tried to access web2py.com and was not up.
>
> Tried using a proxy (guardster), same result.
> >
>

--~--~-~--~~~---~--~~
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:28190] Ironpython

2009-08-07 Thread Ads

Has anybody here tried using IronPython with Web2py?  How did you get
it to work?  When I try it, it gives the following error:

Traceback (most recent call last):
  File "web2py.py", line 15, in web2py.py
  File "C:\web2py\gluon\widget.py", line 18, in C:\web2py\gluon
\widget.py
ImportError: No module named signal

Thanks,

ads

--~--~-~--~~~---~--~~
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:28191] Login, Auth and Fields and Custom

2009-08-07 Thread Dutch opera

Hi,

If I add the below I can login.

#Controller
def login:
return dict(form=auth.login())

#View
{{=form}}

I need to style the submit button and the email and username fields.

>From the controller..how to I add email and password as separate
fields and to custom submit button while keeping form validation?
E.g.


  Email
  



  Password
  


  
  
Log 
In

  



--~--~-~--~~~---~--~~
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:28192] Re: Web2py.com down

2009-08-07 Thread Bottiger

I'm using OpenDNS and it looks like the DNS records are messed up.

If you visit http://140.192.37.194 it will work fine as usual.

On Aug 7, 9:35 pm, Yarko Tymciurak  wrote:
> trywww.web2py.com
>
> On Fri, Aug 7, 2009 at 11:33 PM, b00m_chef  wrote:
>
> > Just tried to access web2py.com and was not up.
>
> > Tried using a proxy (guardster), same result.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---