Re: [web2py] Re: I fixed a bug in web2py!

2010-08-21 Thread Jason Brower
I did notice after looking at the change in the repository logs. I lthought 
about why you would concantinate the space and then it clicked. Dock that one 
for another intelligence point. 
Thanks,
jb
- Original message -
> I have to say, good catch, but bad fix from i18n point of view. Your
> "insert new " (one blank space at the end) string makes all current
> language translations for "insert new" become broken. As a general
> rule, please don't insert leading or trailing or any unnecessary space
> inside a T("blah") content.
> 
> Didn't you see the string concatenate code in the same line of source?
> The correct fix would be concatenate a space outside of the T("...").
> Like this:
>         A(str(T('insert new'))+' '+table, ...
> 
> Regards,
> Iceberg
> 
> On Aug 14, 12:52 am, Jason Brower  wrote:
> > It was 'insert new' and now it's 'insert new '
> > Small one, but important for that polished look.
> > BR,
> > Jason Brower
> > 
> > 
> > 
> > On Fri, 2010-08-13 at 09:39 -0700, mdipierro wrote:
> > > Sorry. I do not see the difference
> > 
> > > On Aug 13, 11:26 am, Jason Brower  wrote:
> > > > Oh yeah!  Haven't a clue how to do a patch file, but here is the
> > > > change...
> > > > Line 33 in the appadmin.html
> > > >       [ {{=A(str(T('insert
> > > > new'))+''+table,_href=URL(r=request,f='insert',args=[db,table]))}}
> > > > ] should be:
> > > >       [ {{=A(str(T('insert new
> > > > '))+''+table,_href=URL(r=request,f='insert',args=[db,table]))}} ]
> > > > Just a small formating issue. (: But it feels good to actual give
> > > > SOMETHING.
> > > > BR,
> > > > Jason Brower



Re: [web2py] Re: My editor ...

2010-08-21 Thread Stef Mientki
 On 21-08-2010 02:01, Michele Comitini wrote:
> pyQt:
>
> http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qtextedit.html
> http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qwebpage.html#details
switching from wxPython to QT is not an easy task,
and it's not possible for me,
because I'm not acquainted with QT.
btw QT has a weird license, you have to decide on forehand if your application 
is commercial or free.

> Also wxPython:
> http://docs.wxwidgets.org/stable/wx_wxview.html#wxview
>
don't know wxview, it's not included in the standard wxPython.
If my guess about who the author is, is right, this will take quit some time to 
be practical usefull.

thanks anyway for the suggestions.
cheers,
Stef


Re: [web2py] Re: My editor ...

2010-08-21 Thread Stef Mientki
 On 21-08-2010 04:31, mdipierro wrote:
> Anyway... some food for thought... the paned windows can be achieved
> with jQuery UI plugins. The auto completion features can be provided
> by the Amy Editor (which is already in web2py admin but disabled
> because not supported by all browsers).
>
> Long term it would be nice to port what Stef has done to the browser.
fully agree,
only advantages.
> Investing time to redo it Qt may not be the best course of action if
yes, it would be quit an investment.
To give you an impression of my efforts until now,
the whole code I wrote is just 12 pages large,
so that would be about 12*50 = 600 lines of code,
and the estimated time investment is about 40 - 60 hours, half of it to make 
changes some small
changes to my libraries

cheers,
Stef
> we could make if fully web based.
>
> Massimo
>



Re: [web2py] Re: My editor ...

2010-08-21 Thread Jason Brower
The QT licence can be gpl or lgpl. But it's free rest assured.

- Original message -
>   On 21-08-2010 02:01, Michele Comitini wrote:
> > pyQt:
> > 
> > http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qtextedit.html
> > http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qwebpage.html#details
> switching from wxPython to QT is not an easy task,
> and it's not possible for me,
> because I'm not acquainted with QT.
> btw QT has a weird license, you have to decide on forehand if your
> application is commercial or free.
> 
> > Also wxPython:
> > http://docs.wxwidgets.org/stable/wx_wxview.html#wxview
> > 
> don't know wxview, it's not included in the standard wxPython.
> If my guess about who the author is, is right, this will take quit some
> time to be practical usefull.
> 
> thanks anyway for the suggestions.
> cheers,
> Stef



Re: [web2py] Re: My editor ...

2010-08-21 Thread Stef Mientki
 On 21-08-2010 06:47, Jason Brower wrote:
> As much as I agree I don't.  I feel there are a lot of features we could
> implement in an editor built for Web2Py.  I would love to see features
> like the following:
> When in a method I can press a key and my browser (or the one built in)
> would jump to that page.
did you see the movie,
unless I misunderstand you it's there.
> Debug and stepping tools. (They exist, but they would be weird in a
> browser.)
Good point, did you see the buttons "Bps",
it stands for "Breakpoints".
But I've no idea yet how to make this work ;-)
> Live session and variable information. (It would be nice to see what
> users session information is at any moment without having to print it.
Good point,
no idea to implement that,
but I guess this should be in the browser server part ??
> A file browser that devides only the models, views, and controllers in a
> nice way.
you didn't like the tree division ?
> Graphical representation of links or pages that don't get linked to.
yep, but I guess this can only be done in the server / browser part
or maybe not ?

thanks for your input,
cheers,
Stef


Re: [web2py] Re: Should we have a feature freeze and stability maintenance period in future?

2010-08-21 Thread Phyo Arkar
thats good.

also what i saw at ipython mailing list , when they go into feature freeze ,
they call for all contributors / plugin contributors for bug-squishing and
stabillity fixes .Contributors of New features are asked if their works
confident  to included the stuff into main stable release.

On Sat, Aug 21, 2010 at 4:10 AM, mdipierro  wrote:

> yes and no.
>
> For example Michele just send me a new gluon/contrib/login_methods/
> oauth10_account.py which provides OAuth 1.0 authentication. It did not
> affect anything else in web2py and I see no reason from freezing
> adding features like this.
> Mariano is working on a PDF library for web2py. Same argument applies.
>
> I see a lot of value in
>
> - bug-squishing-contest ,
> - Stress test, Test everything , try to crash web2py etc.
> - fix bugs, fix performance issues , improve performance
> - code cleanup , documentation.
>
> we can set deadlines for that. This means we would stress test and
> improve features existing at a certain date and we would only add new
> features tagged as "experimental" that do not interfere with parts
> that are being stress tested. Makes sense?
>
> Massimo
>
> On Aug 20, 3:54 pm, Phyo Arkar  wrote:
> > Like some projects , (what i saw is KDE4) should we go into Feature
> Freeze
> > period?
> >
> > Well lets say , when web2py hit 1.90 version , stop developing about new
> > features and we will go into
> > -bug-squishing-contest ,
> > -Stress test, Test everything , try to crash web2py etc.
> > -fix bugs, fix performance issues , improve performance
> > -code cleanup , documentation.
> >
> > For a month (or any period)
> >
> > after that we will get a Stable (Production/Mature) version of web2py.
> >
> > how that sounds?
>


[web2py] component_http_referer in request would be usefull for LOAD

2010-08-21 Thread Jurgis Pralgauskis
hello,

when using LOAD, I can have several components on one page,
but that is a bit of problem, when I need to know, which component
called my new request..

in one case I just wanted to return the previous content (which I
could get with http_referer in traditional way),
but now request.env.http_referer gives the main page, not the
component from which request went.

It could be probably workarounded via session.var or  request.args ,
but probably would be usefull to have in general LOAD (or
web2py_component) "framework".


[web2py] Re: patch for auth to work with web2py_component ajaxing

2010-08-21 Thread Jurgis Pralgauskis
my patch would be litte simpler,
if response.flash would let have clickable links on it,
as now, if I try to hit the link (for login) (with chromium),
the flash just dissapears (as it is supposed to be in general)

On Aug 21, 12:45 am, mdipierro  wrote:
> I see the problem. Let me think about your solution.
>
> On Aug 20, 3:36 pm, Jurgis Pralgauskis 
> wrote:
>
>
>
> > hello, by default, if some function needs auth, w2p gives back some
> > text/html:
> > When I work with components ajax way, I don't want my content parts to
> > get mangled with it...
> > 1) if I am not logged in, it would flood my tiny content area with big
> > login page clone :)
> > 2) in my case, I want my current content (of target div) to stay in
> > place if I don't have permisions,  (and new  content should replace it
> > only if accessible).
>
> > so I made a small patch, You can test it 
> > hearhttps://web2py-gae-test.appspot.com/auth_for_web2py_components/defaul...
> > its default new app with several changes in
> > /controllers/default.py : user()
> > /views/web2py_ajax.html  : web2py_ajax_page()
>
> > is it a good way? or how would be better?
>
> > /controllers/default.py
>
> > def user():
> >     if request.ajax:
> >         result = auth()
> >         if not auth.user:
> >             return "ERROR" +" You should %s first \n" %
> > ( A('login',  _target="blank", _href=auth.settings.login_url).xml())
> >         if isinstance(result, str):
> >             response.flash = result
> >             return "ERROR"
> >         return result # no dict(form=result)
> >     else:
> >         return dict(form=auth())
>
> > /views/web2py_ajax.html
>
> >     'success': function(text) {
> >         if (text.startsWith( "ERROR" )) {
> >           jQuery('#'+target).prepend( text.substr( "ERROR".length ) );
> >         }
> >         else {
> >             jQuery('#'+target).html(text);
> >         }


[web2py] Plugin Rating

2010-08-21 Thread david.waldrop
When using the rating plug in I cannot get the following to work as I
expect:

{{extend 'layout.html'}}


 
  {{for r in results:}}
  
{{=r.name}}
{{=r.posted}}
{{=plugin_rating('meeting',r.id)}}
  {{pass}}
 



the rating is only displayed for the 1st record in results, nothing is
shown for the other records.  I looked at the slices code to try and
see how it worked, but it seesm to be using a different version of
ratings.  Any suggestions would be much appreciated.


[web2py] Re: patch for auth to work with web2py_component ajaxing

2010-08-21 Thread Jurgis Pralgauskis
one more issue with flash and components,
if the page is scrolled down, user won't see the flash, as it pops
somewhere outside viewport.

maybe we could ask jquery to pop it inside viewport (or maybe inside
the component div)

I'v searched around, and seems jquery doesn't have straight solution
but there are recipies:
http://forum.jquery.com/topic/centering-an-image-in-the-viewport
http://jsbin.com/ilafa/2/edit

On Aug 21, 1:49 pm, Jurgis Pralgauskis 
wrote:
> my patch would be litte simpler,
> if response.flash would let have clickable links on it,
> as now, if I try to hit the link (for login) (with chromium),
> the flash just dissapears (as it is supposed to be in general)
>
> On Aug 21, 12:45 am, mdipierro  wrote:
>
>
>
> > I see the problem. Let me think about your solution.
>
> > On Aug 20, 3:36 pm, Jurgis Pralgauskis 
> > wrote:
>
> > > hello, by default, if some function needs auth, w2p gives back some
> > > text/html:
> > > When I work with components ajax way, I don't want my content parts to
> > > get mangled with it...
> > > 1) if I am not logged in, it would flood my tiny content area with big
> > > login page clone :)
> > > 2) in my case, I want my current content (of target div) to stay in
> > > place if I don't have permisions,  (and new  content should replace it
> > > only if accessible).
>
> > > so I made a small patch, You can test it 
> > > hearhttps://web2py-gae-test.appspot.com/auth_for_web2py_components/defaul...
> > > its default new app with several changes in
> > > /controllers/default.py : user()
> > > /views/web2py_ajax.html  : web2py_ajax_page()
>
> > > is it a good way? or how would be better?
>
> > > /controllers/default.py
>
> > > def user():
> > >     if request.ajax:
> > >         result = auth()
> > >         if not auth.user:
> > >             return "ERROR" +" You should %s first \n" %
> > > ( A('login',  _target="blank", _href=auth.settings.login_url).xml())
> > >         if isinstance(result, str):
> > >             response.flash = result
> > >             return "ERROR"
> > >         return result # no dict(form=result)
> > >     else:
> > >         return dict(form=auth())
>
> > > /views/web2py_ajax.html
>
> > >     'success': function(text) {
> > >         if (text.startsWith( "ERROR" )) {
> > >           jQuery('#'+target).prepend( text.substr( "ERROR".length ) );
> > >         }
> > >         else {
> > >             jQuery('#'+target).html(text);
> > >         }


[web2py] Patch to add functional scalar/list accessors for request.vars

2010-08-21 Thread Kevin
Hi,

this is a proposed patch to add global functions for accessing values
from (in particular) request.vars and friends (any dictionary-like
object will work) in a way that (safely) satisfies the assumption that
the input vars for a given key are either singletons or lists.

The functions are rather simple:

Given the request: /a/b/c?x=abc
getfirst(request.vars, 'x') -> 'abc'
getlast(request.vars, 'x') -> 'abc'
getall(request.vars, 'x') -> ['abc']

Given the request: /a/b/c?x=abc&x=def
getfirst(request.vars, 'x') -> 'abc'
getlast(request.vars, 'x') -> 'def'
getall(request.vars, 'x') -> ['abc', 'def']

getall(request.vars, 'y') -> None
getall(request.vars, 'y') or [] -> []

If there is anything like this already, I certainly will retract my
suggestion.  The potentially controversial parts are that the
functions are defined in gluon.utils (I couldn't find a more logical
place to put them, and it makes no difference to me where they end
up), and they're loaded into the request environment, just like the
html helpers.

Patch can be found at: http://pastebin.com/g6Vs9PrU

Background/motivation:

This function group is inspired by the behavior of  and similar
functionality that other frameworks provide, and would be particularly
useful in cases where the client-side code is not managed by something
like web2py's FORM interface -- as of version 1.83.2, web2py prepares
a Storage instance such that:

/a/b/c?x=5 -> request.vars.x == '5'
/a/b/c?x=5&x=abc -> request.vars.x == ['5', 'abc']

This could lead to naive code like the following to fail with some
simple request fakery:

if request.vars.search.upper().startswith('FUZZY'): pass # some real
code here

It's possible that this kind of fakery could also lead to many of the
web2py validators failing in common cases (though I haven't looked
into that much).

However, it is often allowable that the first (or last) value passed
is authoritative, leading to a more robust system.


[web2py] Re: patch for auth to work with web2py_component ajaxing

2010-08-21 Thread Jurgis Pralgauskis


On Aug 21, 3:06 pm, Jurgis Pralgauskis 
wrote:
> one more issue with flash and components,
> if the page is scrolled down, user won't see the flash, as it pops
> somewhere outside viewport.
>
> maybe we could ask jquery to pop it inside viewport (or maybe inside
> the component div)
>
> I'v searched around, and seems jquery doesn't have straight solution
> but there are recipies:
> http://forum.jquery.com/topic/centering-an-image-in-the-viewport
> http://jsbin.com/ilafa/2/edit
or maybe
http://forum.jquery.com/topic/scrolling-toggled-elements-to-top-of-viewport



[web2py] Re: Should we have a feature freeze and stability maintenance period in future?

2010-08-21 Thread mdipierro
So we could do this for 1.84, the next release. If sombody is about to
submit a major patch let me know and we will wait for that.

On Aug 21, 4:55 am, Phyo Arkar  wrote:
> thats good.
>
> also what i saw at ipython mailing list , when they go into feature freeze ,
> they call for all contributors / plugin contributors for bug-squishing and
> stabillity fixes .Contributors of New features are asked if their works
> confident  to included the stuff into main stable release.
>
> On Sat, Aug 21, 2010 at 4:10 AM, mdipierro  wrote:
> > yes and no.
>
> > For example Michele just send me a new gluon/contrib/login_methods/
> > oauth10_account.py which provides OAuth 1.0 authentication. It did not
> > affect anything else in web2py and I see no reason from freezing
> > adding features like this.
> > Mariano is working on a PDF library for web2py. Same argument applies.
>
> > I see a lot of value in
>
> > - bug-squishing-contest ,
> > - Stress test, Test everything , try to crash web2py etc.
> > - fix bugs, fix performance issues , improve performance
> > - code cleanup , documentation.
>
> > we can set deadlines for that. This means we would stress test and
> > improve features existing at a certain date and we would only add new
> > features tagged as "experimental" that do not interfere with parts
> > that are being stress tested. Makes sense?
>
> > Massimo
>
> > On Aug 20, 3:54 pm, Phyo Arkar  wrote:
> > > Like some projects , (what i saw is KDE4) should we go into Feature
> > Freeze
> > > period?
>
> > > Well lets say , when web2py hit 1.90 version , stop developing about new
> > > features and we will go into
> > > -bug-squishing-contest ,
> > > -Stress test, Test everything , try to crash web2py etc.
> > > -fix bugs, fix performance issues , improve performance
> > > -code cleanup , documentation.
>
> > > For a month (or any period)
>
> > > after that we will get a Stable (Production/Mature) version of web2py.
>
> > > how that sounds?


[web2py] Re: component_http_referer in request would be usefull for LOAD

2010-08-21 Thread mdipierro
You can name your components

LOAD(,target="xyz")

and serverside check it:

if request.cid=="xyz"


On Aug 21, 5:38 am, Jurgis Pralgauskis 
wrote:
> hello,
>
> when using LOAD, I can have several components on one page,
> but that is a bit of problem, when I need to know, which component
> called my new request..
>
> in one case I just wanted to return the previous content (which I
> could get with http_referer in traditional way),
> but now request.env.http_referer gives the main page, not the
> component from which request went.
>
> It could be probably workarounded via session.var or  request.args ,
> but probably would be usefull to have in general LOAD (or
> web2py_component) "framework".


[web2py] Re: patch for auth to work with web2py_component ajaxing

2010-08-21 Thread Jurgis Pralgauskis
by the way - FF 3.6.6 seems to ignore request.ajax
as it behaves as if I haven't changed user() function at all ???

On Aug 20, 11:36 pm, Jurgis Pralgauskis 
wrote:
> hello, by default, if some function needs auth, w2p gives back some
> text/html:
> When I work with components ajax way, I don't want my content parts to
> get mangled with it...
> 1) if I am not logged in, it would flood my tiny content area with big
> login page clone :)
> 2) in my case, I want my current content (of target div) to stay in
> place if I don't have permisions,  (and new  content should replace it
> only if accessible).
>
> so I made a small patch, You can test it 
> hearhttps://web2py-gae-test.appspot.com/auth_for_web2py_components/defaul...
> its default new app with several changes in
> /controllers/default.py : user()
> /views/web2py_ajax.html  : web2py_ajax_page()
>
> is it a good way? or how would be better?
>
> /controllers/default.py
>
> def user():
>     if request.ajax:
>         result = auth()
>         if not auth.user:
>             return "ERROR" +" You should %s first \n" %
> ( A('login',  _target="blank", _href=auth.settings.login_url).xml())
>         if isinstance(result, str):
>             response.flash = result
>             return "ERROR"
>         return result # no dict(form=result)
>     else:
>         return dict(form=auth())
>
> /views/web2py_ajax.html
>
>     'success': function(text) {
>         if (text.startsWith( "ERROR" )) {
>           jQuery('#'+target).prepend( text.substr( "ERROR".length ) );
>         }
>         else {
>             jQuery('#'+target).html(text);
>         }


[web2py] Re: Patch to add functional scalar/list accessors for request.vars

2010-08-21 Thread mdipierro
I never needed this but I have no opposition to include them.
Could you provide a use case?
 What do other people think?

On Aug 21, 12:27 am, Kevin  wrote:
> Hi,
>
> this is a proposed patch to add global functions for accessing values
> from (in particular) request.vars and friends (any dictionary-like
> object will work) in a way that (safely) satisfies the assumption that
> the input vars for a given key are either singletons or lists.
>
> The functions are rather simple:
>
> Given the request: /a/b/c?x=abc
> getfirst(request.vars, 'x') -> 'abc'
> getlast(request.vars, 'x') -> 'abc'
> getall(request.vars, 'x') -> ['abc']
>
> Given the request: /a/b/c?x=abc&x=def
> getfirst(request.vars, 'x') -> 'abc'
> getlast(request.vars, 'x') -> 'def'
> getall(request.vars, 'x') -> ['abc', 'def']
>
> getall(request.vars, 'y') -> None
> getall(request.vars, 'y') or [] -> []
>
> If there is anything like this already, I certainly will retract my
> suggestion.  The potentially controversial parts are that the
> functions are defined in gluon.utils (I couldn't find a more logical
> place to put them, and it makes no difference to me where they end
> up), and they're loaded into the request environment, just like the
> html helpers.
>
> Patch can be found at:http://pastebin.com/g6Vs9PrU
>
> Background/motivation:
>
> This function group is inspired by the behavior of  pythonpaste.org/webob/reference.html#query-post-variables> and similar
> functionality that other frameworks provide, and would be particularly
> useful in cases where the client-side code is not managed by something
> like web2py's FORM interface -- as of version 1.83.2, web2py prepares
> a Storage instance such that:
>
> /a/b/c?x=5 -> request.vars.x == '5'
> /a/b/c?x=5&x=abc -> request.vars.x == ['5', 'abc']
>
> This could lead to naive code like the following to fail with some
> simple request fakery:
>
> if request.vars.search.upper().startswith('FUZZY'): pass # some real
> code here
>
> It's possible that this kind of fakery could also lead to many of the
> web2py validators failing in common cases (though I haven't looked
> into that much).
>
> However, it is often allowable that the first (or last) value passed
> is authoritative, leading to a more robust system.


[web2py] Re: patch for auth to work with web2py_component ajaxing

2010-08-21 Thread mdipierro
The flash issue can be solved with a change in CSS. I'd take a patch
to make the flash coordinates relative to the window.

On Aug 21, 7:06 am, Jurgis Pralgauskis 
wrote:
> one more issue with flash and components,
> if the page is scrolled down, user won't see the flash, as it pops
> somewhere outside viewport.
>
> maybe we could ask jquery to pop it inside viewport (or maybe inside
> the component div)
>
> I'v searched around, and seems jquery doesn't have straight solution
> but there are 
> recipies:http://forum.jquery.com/topic/centering-an-image-in-the-viewporthttp://jsbin.com/ilafa/2/edit
>
> On Aug 21, 1:49 pm, Jurgis Pralgauskis 
> wrote:
>
> > my patch would be litte simpler,
> > if response.flash would let have clickable links on it,
> > as now, if I try to hit the link (for login) (with chromium),
> > the flash just dissapears (as it is supposed to be in general)
>
> > On Aug 21, 12:45 am, mdipierro  wrote:
>
> > > I see the problem. Let me think about your solution.
>
> > > On Aug 20, 3:36 pm, Jurgis Pralgauskis 
> > > wrote:
>
> > > > hello, by default, if some function needs auth, w2p gives back some
> > > > text/html:
> > > > When I work with components ajax way, I don't want my content parts to
> > > > get mangled with it...
> > > > 1) if I am not logged in, it would flood my tiny content area with big
> > > > login page clone :)
> > > > 2) in my case, I want my current content (of target div) to stay in
> > > > place if I don't have permisions,  (and new  content should replace it
> > > > only if accessible).
>
> > > > so I made a small patch, You can test it 
> > > > hearhttps://web2py-gae-test.appspot.com/auth_for_web2py_components/defaul...
> > > > its default new app with several changes in
> > > > /controllers/default.py : user()
> > > > /views/web2py_ajax.html  : web2py_ajax_page()
>
> > > > is it a good way? or how would be better?
>
> > > > /controllers/default.py
>
> > > > def user():
> > > >     if request.ajax:
> > > >         result = auth()
> > > >         if not auth.user:
> > > >             return "ERROR" +" You should %s first \n" %
> > > > ( A('login',  _target="blank", _href=auth.settings.login_url).xml())
> > > >         if isinstance(result, str):
> > > >             response.flash = result
> > > >             return "ERROR"
> > > >         return result # no dict(form=result)
> > > >     else:
> > > >         return dict(form=auth())
>
> > > > /views/web2py_ajax.html
>
> > > >     'success': function(text) {
> > > >         if (text.startsWith( "ERROR" )) {
> > > >           jQuery('#'+target).prepend( text.substr( "ERROR".length ) );
> > > >         }
> > > >         else {
> > > >             jQuery('#'+target).html(text);
> > > >         }


Re: [web2py] Re: My editor ...

2010-08-21 Thread Stef Mientki

> Graphical representation of links or pages that don't get linked to.
I tried to test the links (with 2 algorithms, code below) in a generated 
webpage, but the result I
get are very weird.
Probably one you knows a better way ?

cheers,
Stef


from BeautifulSoup import BeautifulSoup
from urllibimport urlopen
from httplib   import HTTP
from urlparse  import urlparse

def Check_URL_1 ( URL ) :
  try:
fh = urlopen ( URL )
return fh.code == 200
  except :
return False

def Check_URL_2 ( URL ) :
  p = urlparse ( URL )
  h = HTTP ( p[1] )
  h.putrequest ( 'HEAD', p[2] )
  h.endheaders()
  if h.getreply()[0] == 200:
return True
  else:
return False

def Verify_Links ( URL ) :
  Parts   = URL.split('/')
  Site= '/'.join ( Parts [:3] )
  Current = '/'.join ( Parts [:-1] )

  fh = urlopen ( URL )
  lines = fh.read ()
  fh.close()

  Soup = BeautifulSoup ( lines )
  hrefs = lines = Soup.findAll ( 'a' )

  for href in hrefs :
href = href [ 'href' ] #[:-1] ## <== remove "#" to generate all errors

if href.startswith ( '/' ) :
  href = Site + href
elif href.startswith ('#' ) :
  href = URL + href
elif href.startswith ( 'http' ) :
  pass
else :
  href = Current + href

try:
  fh = urllib.urlopen ( href )
except :
  pass
print Check_URL_1 ( href ), Check_URL_2 ( href ), href

URL = 'http://127.0.0.1:8000/welcome/default/index'
fh = Verify_Links ( URL )


[web2py] How to setup apache to serve static content on webfaction?

2010-08-21 Thread Iceberg
Hi there,

I know there are some of us who are happy with webfaction share
server. Can someone give a clear instruction about how to setup apache
to serve static content on webfaction?

I already search the web before asking. The webfaction official
solution can work, but not feasible if I have many app.
http://docs.webfaction.com/software/static.html#serving-static-media

Some else looks simple but somehow I can not get it work. Quoted from
http://forum.webfaction.com/viewtopic.php?id=3215

SetHandler None


The other are between above two, but still no luck for me. Quoted from
http://forum.webfaction.com/viewtopic.php?id=29
For example:

  
SetHandler none
  

  
SetHandler None
  

  
SetHandler None
  

  
SetHandler None
  

  
SetHandler None
  

  
SetHandler None
  

  Alias /media /home2/pkenjora/lib/python2.4/django/contrib/admin/
media
  Alias /img /home2/pkenjora/webapps/django/arkayne/templates/images
  Alias /css /home2/pkenjora/webapps/django/arkayne/templates/css
  Alias /js /home2/pkenjora/webapps/django/arkayne/templates/js
  Alias /plugin /home2/pkenjora/webapps/django/arkayne/templates/
plugin


Regards,
Iceberg


[web2py] Re: My editor ...

2010-08-21 Thread mdipierro
what do you find that is strange?

On Aug 21, 7:32 am, Stef Mientki  wrote:
> > Graphical representation of links or pages that don't get linked to.
>
> I tried to test the links (with 2 algorithms, code below) in a generated 
> webpage, but the result I
> get are very weird.
> Probably one you knows a better way ?
>
> cheers,
> Stef
>
> from BeautifulSoup import BeautifulSoup
> from urllib        import urlopen
> from httplib       import HTTP
> from urlparse      import urlparse
>
> def Check_URL_1 ( URL ) :
>   try:
>     fh = urlopen ( URL )
>     return fh.code == 200
>   except :
>     return False
>
> def Check_URL_2 ( URL ) :
>   p = urlparse ( URL )
>   h = HTTP ( p[1] )
>   h.putrequest ( 'HEAD', p[2] )
>   h.endheaders()
>   if h.getreply()[0] == 200:
>     return True
>   else:
>     return False
>
> def Verify_Links ( URL ) :
>   Parts   = URL.split('/')
>   Site    = '/'.join ( Parts [:3] )
>   Current = '/'.join ( Parts [:-1] )
>
>   fh = urlopen ( URL )
>   lines = fh.read ()
>   fh.close()
>
>   Soup = BeautifulSoup ( lines )
>   hrefs = lines = Soup.findAll ( 'a' )
>
>   for href in hrefs :
>     href = href [ 'href' ] #[:-1]     ## <== remove "#" to generate all errors
>
>     if href.startswith ( '/' ) :
>       href = Site + href
>     elif href.startswith ('#' ) :
>       href = URL + href
>     elif href.startswith ( 'http' ) :
>       pass
>     else :
>       href = Current + href
>
>     try:
>       fh = urllib.urlopen ( href )
>     except :
>       pass
>     print Check_URL_1 ( href ), Check_URL_2 ( href ), href
>
> URL = 'http://127.0.0.1:8000/welcome/default/index'
> fh = Verify_Links ( URL )


[web2py] pending patches.... remind me.

2010-08-21 Thread mdipierro
If you have submitted a patch and it has not been applied without
response, please remind me.
Do not assume you are being ignored. Assume instead I accidentally
deleted your email or you have not got my reply.

Massimo


Re: [web2py] Re: My editor ...

2010-08-21 Thread Stef Mientki
 On 21-08-2010 14:46, mdipierro wrote:

> what do you find that is strange?
This is the result with the last letter removed, so all links should give an 
error,
but they differ with the 2 methods,
and some of them produce 200, while they are definitely wrong
404 500 http://127.0.0.1:8000/welcome/default/user/logi
404 500 http://127.0.0.1:8000/welcome/default/user/registe
404 500 http://127.0.0.1:8000/welcome/default/user/request_reset_passwor
200 500 http://127.0.0.1:8000/welcome/default
400 500 http://127.0.0.1:8000/welcome/default/inde
200 500 http://127.0.0.1:8000/admin/default/design/welcom
200 500 http://127.0.0.1:8000/admin/default/edit/welcome/controllers/default.p
200 500 http://127.0.0.1:8000/admin/default/edit/welcome/views/default/index.htm
200 500 http://127.0.0.1:8000/admin/default/edit/welcome/views/layout.htm
200 500 http://127.0.0.1:8000/admin/default/edit/welcome/static/base.cs
200 500 http://127.0.0.1:8000/admin/default/edit/welcome/models/db.p
200 500 http://127.0.0.1:8000/admin/default/edit/welcome/models/menu.p
400 500 http://127.0.0.1:8000/welcome/appadmin/inde
200 500 http://127.0.0.1:8000/admin/default/inde
400 400 http://127.0.0.1:8000/examples/default/inde
200 -1 http://web2py.co
400 400 http://web2py.com/boo
400 500 http://127.0.0.1:8000/welcome/default/inde
200 500 http://127.0.0.1:8000/welcome/default
200 500 http://127.0.0.1:8000/admin/default/peek/welcome/controllers/default.p
200 500 http://127.0.0.1:8000/admin/default/peek/welcome/views/default/index.htm
200 -1 http://www.web2py.co

This is the normal result
200 500 http://127.0.0.1:8000/welcome/default/user/login
200 500 http://127.0.0.1:8000/welcome/default/user/register
200 500 http://127.0.0.1:8000/welcome/default/user/request_reset_password
200 500 http://127.0.0.1:8000/welcome/default
200 500 http://127.0.0.1:8000/welcome/default/index
200 500 http://127.0.0.1:8000/admin/default/design/welcome
200 500 http://127.0.0.1:8000/admin/default/edit/welcome/controllers/default.py
200 500 
http://127.0.0.1:8000/admin/default/edit/welcome/views/default/index.html
200 500 http://127.0.0.1:8000/admin/default/edit/welcome/views/layout.html
200 500 http://127.0.0.1:8000/admin/default/edit/welcome/static/base.css
200 500 http://127.0.0.1:8000/admin/default/edit/welcome/models/db.py
200 500 http://127.0.0.1:8000/admin/default/edit/welcome/models/menu.py
200 500 http://127.0.0.1:8000/welcome/appadmin/index
200 500 http://127.0.0.1:8000/admin/default/index
200 200 http://127.0.0.1:8000/examples/default/index
200 200 http://web2py.com
200 500 http://web2py.com/book
200 500 http://127.0.0.1:8000/welcome/default/index
400 500 http://127.0.0.1:8000/welcome/default/index#
200 500 http://127.0.0.1:8000/admin/default/peek/welcome/controllers/default.py
200 500 
http://127.0.0.1:8000/admin/default/peek/welcome/views/default/index.html
200 200 http://www.web2py.com

So when is a URL valid ?

thanks,
Stef
> On Aug 21, 7:32 am, Stef Mientki  wrote:
>>> Graphical representation of links or pages that don't get linked to.
>> I tried to test the links (with 2 algorithms, code below) in a generated 
>> webpage, but the result I
>> get are very weird.
>> Probably one you knows a better way ?
>>
>> cheers,
>> Stef
>>
>> from BeautifulSoup import BeautifulSoup
>> from urllibimport urlopen
>> from httplib   import HTTP
>> from urlparse  import urlparse
>>
>> def Check_URL_1 ( URL ) :
>>   try:
>> fh = urlopen ( URL )
>> return fh.code == 200
>>   except :
>> return False
>>
>> def Check_URL_2 ( URL ) :
>>   p = urlparse ( URL )
>>   h = HTTP ( p[1] )
>>   h.putrequest ( 'HEAD', p[2] )
>>   h.endheaders()
>>   if h.getreply()[0] == 200:
>> return True
>>   else:
>> return False
>>
>> def Verify_Links ( URL ) :
>>   Parts   = URL.split('/')
>>   Site= '/'.join ( Parts [:3] )
>>   Current = '/'.join ( Parts [:-1] )
>>
>>   fh = urlopen ( URL )
>>   lines = fh.read ()
>>   fh.close()
>>
>>   Soup = BeautifulSoup ( lines )
>>   hrefs = lines = Soup.findAll ( 'a' )
>>
>>   for href in hrefs :
>> href = href [ 'href' ] #[:-1] ## <== remove "#" to generate all 
>> errors
>>
>> if href.startswith ( '/' ) :
>>   href = Site + href
>> elif href.startswith ('#' ) :
>>   href = URL + href
>> elif href.startswith ( 'http' ) :
>>   pass
>> else :
>>   href = Current + href
>>
>> try:
>>   fh = urllib.urlopen ( href )
>> except :
>>   pass
>> print Check_URL_1 ( href ), Check_URL_2 ( href ), href
>>
>> URL = 'http://127.0.0.1:8000/welcome/default/index'
>> fh = Verify_Links ( URL )



[web2py] Re: My editor ...

2010-08-21 Thread mdipierro
why are the urls in the first set truncated?

On Aug 21, 8:07 am, Stef Mientki  wrote:
>  On 21-08-2010 14:46, mdipierro wrote:
>
> > what do you find that is strange?
>
> This is the result with the last letter removed, so all links should give an 
> error,
> but they differ with the 2 methods,
> and some of them produce 200, while they are definitely wrong
> 404 500http://127.0.0.1:8000/welcome/default/user/logi
> 404 500http://127.0.0.1:8000/welcome/default/user/registe
> 404 500http://127.0.0.1:8000/welcome/default/user/request_reset_passwor
> 200 500http://127.0.0.1:8000/welcome/default
> 400 500http://127.0.0.1:8000/welcome/default/inde
> 200 500http://127.0.0.1:8000/admin/default/design/welcom
> 200 500http://127.0.0.1:8000/admin/default/edit/welcome/controllers/default.p
> 200 
> 500http://127.0.0.1:8000/admin/default/edit/welcome/views/default/index.htm
> 200 500http://127.0.0.1:8000/admin/default/edit/welcome/views/layout.htm
> 200 500http://127.0.0.1:8000/admin/default/edit/welcome/static/base.cs
> 200 500http://127.0.0.1:8000/admin/default/edit/welcome/models/db.p
> 200 500http://127.0.0.1:8000/admin/default/edit/welcome/models/menu.p
> 400 500http://127.0.0.1:8000/welcome/appadmin/inde
> 200 500http://127.0.0.1:8000/admin/default/inde
> 400 400http://127.0.0.1:8000/examples/default/inde
> 200 -1http://web2py.co
> 400 400http://web2py.com/boo
> 400 500http://127.0.0.1:8000/welcome/default/inde
> 200 500http://127.0.0.1:8000/welcome/default
> 200 500http://127.0.0.1:8000/admin/default/peek/welcome/controllers/default.p
> 200 
> 500http://127.0.0.1:8000/admin/default/peek/welcome/views/default/index.htm
> 200 -1http://www.web2py.co
>
> This is the normal result
> 200 500http://127.0.0.1:8000/welcome/default/user/login
> 200 500http://127.0.0.1:8000/welcome/default/user/register
> 200 500http://127.0.0.1:8000/welcome/default/user/request_reset_password
> 200 500http://127.0.0.1:8000/welcome/default
> 200 500http://127.0.0.1:8000/welcome/default/index
> 200 500http://127.0.0.1:8000/admin/default/design/welcome
> 200 500http://127.0.0.1:8000/admin/default/edit/welcome/controllers/default.py
> 200 
> 500http://127.0.0.1:8000/admin/default/edit/welcome/views/default/index
> 200 500http://127.0.0.1:8000/admin/default/edit/welcome/views/layout.html
> 200 500http://127.0.0.1:8000/admin/default/edit/welcome/static/base.css
> 200 500http://127.0.0.1:8000/admin/default/edit/welcome/models/db.py
> 200 500http://127.0.0.1:8000/admin/default/edit/welcome/models/menu.py
> 200 500http://127.0.0.1:8000/welcome/appadmin/index
> 200 500http://127.0.0.1:8000/admin/default/index
> 200 200http://127.0.0.1:8000/examples/default/index
> 200 200http://web2py.com
> 200 500http://web2py.com/book
> 200 500http://127.0.0.1:8000/welcome/default/index
> 400 500http://127.0.0.1:8000/welcome/default/index#
> 200 500http://127.0.0.1:8000/admin/default/peek/welcome/controllers/default.py
> 200 
> 500http://127.0.0.1:8000/admin/default/peek/welcome/views/default/index
> 200 200http://www.web2py.com
>
> So when is a URL valid ?
>
> thanks,
> Stef
>
> > On Aug 21, 7:32 am, Stef Mientki  wrote:
> >>> Graphical representation of links or pages that don't get linked to.
> >> I tried to test the links (with 2 algorithms, code below) in a generated 
> >> webpage, but the result I
> >> get are very weird.
> >> Probably one you knows a better way ?
>
> >> cheers,
> >> Stef
>
> >> from BeautifulSoup import BeautifulSoup
> >> from urllib        import urlopen
> >> from httplib       import HTTP
> >> from urlparse      import urlparse
>
> >> def Check_URL_1 ( URL ) :
> >>   try:
> >>     fh = urlopen ( URL )
> >>     return fh.code == 200
> >>   except :
> >>     return False
>
> >> def Check_URL_2 ( URL ) :
> >>   p = urlparse ( URL )
> >>   h = HTTP ( p[1] )
> >>   h.putrequest ( 'HEAD', p[2] )
> >>   h.endheaders()
> >>   if h.getreply()[0] == 200:
> >>     return True
> >>   else:
> >>     return False
>
> >> def Verify_Links ( URL ) :
> >>   Parts   = URL.split('/')
> >>   Site    = '/'.join ( Parts [:3] )
> >>   Current = '/'.join ( Parts [:-1] )
>
> >>   fh = urlopen ( URL )
> >>   lines = fh.read ()
> >>   fh.close()
>
> >>   Soup = BeautifulSoup ( lines )
> >>   hrefs = lines = Soup.findAll ( 'a' )
>
> >>   for href in hrefs :
> >>     href = href [ 'href' ] #[:-1]     ## <== remove "#" to generate all 
> >> errors
>
> >>     if href.startswith ( '/' ) :
> >>       href = Site + href
> >>     elif href.startswith ('#' ) :
> >>       href = URL + href
> >>     elif href.startswith ( 'http' ) :
> >>       pass
> >>     else :
> >>       href = Current + href
>
> >>     try:
> >>       fh = urllib.urlopen ( href )
> >>     except :
> >>       pass
> >>     print Check_URL_1 ( href ), Check_URL_2 ( href ), href
>
> >> URL = 'http://127.0.0.1:8000/welcome/default/index'
> >> fh = Verify_Links ( URL )


[web2py] Re: web2py 3rd edition available in PDF from LULU.com

2010-08-21 Thread ra3don
The 3rd edition was released on my birthday. Woohoo!
It just wouldn't be right if i didn't buy it.

On Aug 19, 5:04 pm, Christopher Steel  wrote:
> well worth the money!
>
> On Aug 19, 8:18 am, mdipierro  wrote:
>
>
>
> > 3 months of work on the book it also cost money. ;-)
>
> > On Aug 19, 1:37 am, Robby O'Connor  wrote:>   If 
> > I'm not out of line: Why not make the PDF available for free? Print
> > > costs money, i can understand charging for that...
>
> > > On 8/19/2010 1:44 AM, JorgeRpo wrote:
>
> > > > BOUGHT!!
> > > > ;)
>
> > > > On Aug 13, 2:46 am, mdipierro  wrote:
> > > >>http://www.lulu.com/product/ebook/official-web2py-manual/12196616
>
> > > >> This is the same content as the online book but converted to PDF.
> > > >> There are significant additions and changes compared to the 2nd
> > > >> edition.
>
> > > >> - new chapter on components, plugins and plugin_wiki example
> > > >> - many new DAL features including list:reference, list:integer,
> > > >> list:string, belongs, contains, computed fields, virtual fields,
> > > >> shortcuts
> > > >> - new custom login methods (including openid, oauth, prx)
> > > >> - new validators
> > > >> - new helpers (including markmin)
> > > >> - application-level routes and other routes customizations
> > > >> - description of new Auth and Crud settings/messages.
> > > >> - description of new default layout and how to change it
> > > >> - {{blocks}} in template
> > > >> - examples are revised to account for new features
> > > >> - running background processes
> > > >> - sending signed and encrypted emails
> > > >> - more info on GAE deployment
> > > >> - new screenshots
> > > >> - may bug fixes.
>
> > > >> It contains 537 pages.
>
> > > >> Thanks to Alvaro, Bruno, Denes, Felipe, Graham, Jonathan, Hans, Kyle,
> > > >> Mark, Michele, Richard, Robin, Roman, Scott, Shane, Sharriff, Sriram,
> > > >> Sterling, Stuart, Thadeus for proofreading this and previous versions
> > > >> of the book.
>
> > > >> It costs one dollar more than 2nd edition, I guess it is because of
> > > >> the increased number of pages. I actually reduced my cut.
>
> > > >> Hopefully it will be available in print soon.
>
> > > >> I will take some help in converting to ePub.
>
> > > >> Massimo


Re: [web2py] Re: My editor ...

2010-08-21 Thread Stef Mientki
 On 21-08-2010 15:26, mdipierro wrote:
> why are the urls in the first set truncated?
to create deliberately an error ;-)

cheers,
Stef


[web2py] Re: My editor ...

2010-08-21 Thread Martin.Mulone
I think is making an example, stef want to demostrate that web2py is
returning 200 instead of 400. Is this a bug?

On 21 ago, 10:26, mdipierro  wrote:
> why are the urls in the first set truncated?
>
> On Aug 21, 8:07 am, Stef Mientki  wrote:
>
>
>
> >  On 21-08-2010 14:46, mdipierro wrote:
>
> > > what do you find that is strange?
>
> > This is the result with the last letter removed, so all links should give 
> > an error,
> > but they differ with the 2 methods,
> > and some of them produce 200, while they are definitely wrong
> > 404 500http://127.0.0.1:8000/welcome/default/user/logi
> > 404 500http://127.0.0.1:8000/welcome/default/user/registe
> > 404 500http://127.0.0.1:8000/welcome/default/user/request_reset_passwor
> > 200 500http://127.0.0.1:8000/welcome/default
> > 400 500http://127.0.0.1:8000/welcome/default/inde
> > 200 500http://127.0.0.1:8000/admin/default/design/welcom
> > 200 
> > 500http://127.0.0.1:8000/admin/default/edit/welcome/controllers/default.p
> > 200 
> > 500http://127.0.0.1:8000/admin/default/edit/welcome/views/default/index.htm
> > 200 500http://127.0.0.1:8000/admin/default/edit/welcome/views/layout.htm
> > 200 500http://127.0.0.1:8000/admin/default/edit/welcome/static/base.cs
> > 200 500http://127.0.0.1:8000/admin/default/edit/welcome/models/db.p
> > 200 500http://127.0.0.1:8000/admin/default/edit/welcome/models/menu.p
> > 400 500http://127.0.0.1:8000/welcome/appadmin/inde
> > 200 500http://127.0.0.1:8000/admin/default/inde
> > 400 400http://127.0.0.1:8000/examples/default/inde
> > 200 -1http://web2py.co
> > 400 400http://web2py.com/boo
> > 400 500http://127.0.0.1:8000/welcome/default/inde
> > 200 500http://127.0.0.1:8000/welcome/default
> > 200 
> > 500http://127.0.0.1:8000/admin/default/peek/welcome/controllers/default.p
> > 200 
> > 500http://127.0.0.1:8000/admin/default/peek/welcome/views/default/index.htm
> > 200 -1http://www.web2py.co
>
> > This is the normal result
> > 200 500http://127.0.0.1:8000/welcome/default/user/login
> > 200 500http://127.0.0.1:8000/welcome/default/user/register
> > 200 500http://127.0.0.1:8000/welcome/default/user/request_reset_password
> > 200 500http://127.0.0.1:8000/welcome/default
> > 200 500http://127.0.0.1:8000/welcome/default/index
> > 200 500http://127.0.0.1:8000/admin/default/design/welcome
> > 200 
> > 500http://127.0.0.1:8000/admin/default/edit/welcome/controllers/default.py
> > 200 
> > 500http://127.0.0.1:8000/admin/default/edit/welcome/views/default/index
> > 200 500http://127.0.0.1:8000/admin/default/edit/welcome/views/layout.html
> > 200 500http://127.0.0.1:8000/admin/default/edit/welcome/static/base.css
> > 200 500http://127.0.0.1:8000/admin/default/edit/welcome/models/db.py
> > 200 500http://127.0.0.1:8000/admin/default/edit/welcome/models/menu.py
> > 200 500http://127.0.0.1:8000/welcome/appadmin/index
> > 200 500http://127.0.0.1:8000/admin/default/index
> > 200 200http://127.0.0.1:8000/examples/default/index
> > 200 200http://web2py.com
> > 200 500http://web2py.com/book
> > 200 500http://127.0.0.1:8000/welcome/default/index
> > 400 500http://127.0.0.1:8000/welcome/default/index#
> > 200 
> > 500http://127.0.0.1:8000/admin/default/peek/welcome/controllers/default.py
> > 200 
> > 500http://127.0.0.1:8000/admin/default/peek/welcome/views/default/index
> > 200 200http://www.web2py.com
>
> > So when is a URL valid ?
>
> > thanks,
> > Stef
>
> > > On Aug 21, 7:32 am, Stef Mientki  wrote:
> > >>> Graphical representation of links or pages that don't get linked to.
> > >> I tried to test the links (with 2 algorithms, code below) in a generated 
> > >> webpage, but the result I
> > >> get are very weird.
> > >> Probably one you knows a better way ?
>
> > >> cheers,
> > >> Stef
>
> > >> from BeautifulSoup import BeautifulSoup
> > >> from urllib        import urlopen
> > >> from httplib       import HTTP
> > >> from urlparse      import urlparse
>
> > >> def Check_URL_1 ( URL ) :
> > >>   try:
> > >>     fh = urlopen ( URL )
> > >>     return fh.code == 200
> > >>   except :
> > >>     return False
>
> > >> def Check_URL_2 ( URL ) :
> > >>   p = urlparse ( URL )
> > >>   h = HTTP ( p[1] )
> > >>   h.putrequest ( 'HEAD', p[2] )
> > >>   h.endheaders()
> > >>   if h.getreply()[0] == 200:
> > >>     return True
> > >>   else:
> > >>     return False
>
> > >> def Verify_Links ( URL ) :
> > >>   Parts   = URL.split('/')
> > >>   Site    = '/'.join ( Parts [:3] )
> > >>   Current = '/'.join ( Parts [:-1] )
>
> > >>   fh = urlopen ( URL )
> > >>   lines = fh.read ()
> > >>   fh.close()
>
> > >>   Soup = BeautifulSoup ( lines )
> > >>   hrefs = lines = Soup.findAll ( 'a' )
>
> > >>   for href in hrefs :
> > >>     href = href [ 'href' ] #[:-1]     ## <== remove "#" to generate all 
> > >> errors
>
> > >>     if href.startswith ( '/' ) :
> > >>       href = Site + href
> > >>     elif href.startswith ('#' ) :
> > >>       href = URL + href
> > >>     elif href.startswith ( 'http' ) :
> > >>       pass
> > >>     else :
> > >>       href = 

[web2py] Re: My editor ...

2010-08-21 Thread Mengu
Yes, Qt license can be GPL or LGPL. PyQt license can be GPL and there
is a price to pay for commercial apps.

On 21 Ağustos, 12:38, Jason Brower  wrote:
> The QT licence can be gpl or lgpl. But it's free rest assured.
>
>
>
> - Original message -
> >   On 21-08-2010 02:01, Michele Comitini wrote:
> > > pyQt:
>
> > >http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qtextedit
> > >http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qwebpage.h...
> > switching from wxPython to QT is not an easy task,
> > and it's not possible for me,
> > because I'm not acquainted with QT.
> > btw QT has a weird license, you have to decide on forehand if your
> > application is commercial or free.
>
> > > Also wxPython:
> > >http://docs.wxwidgets.org/stable/wx_wxview.html#wxview
>
> > don't know wxview, it's not included in the standard wxPython.
> > If my guess about who the author is, is right, this will take quit some
> > time to be practical usefull.
>
> > thanks anyway for the suggestions.
> > cheers,
> > Stef


[web2py] Re: My editor ...

2010-08-21 Thread mdipierro
There was a problem in trunk that may have caused this. The problem
was with the recent change in URL bahviour. I think I fixed it. Yet I
cannot run your code. I am getting a strange error

fh = urlopen ( URL )
return fh.getcode()
AttributeError: addinfourl instance has no attribute 'getcode'


On Aug 21, 8:07 am, Stef Mientki  wrote:
>  On 21-08-2010 14:46, mdipierro wrote:
>
> > what do you find that is strange?
>
> This is the result with the last letter removed, so all links should give an 
> error,
> but they differ with the 2 methods,
> and some of them produce 200, while they are definitely wrong
> 404 500http://127.0.0.1:8000/welcome/default/user/logi
> 404 500http://127.0.0.1:8000/welcome/default/user/registe
> 404 500http://127.0.0.1:8000/welcome/default/user/request_reset_passwor
> 200 500http://127.0.0.1:8000/welcome/default
> 400 500http://127.0.0.1:8000/welcome/default/inde
> 200 500http://127.0.0.1:8000/admin/default/design/welcom
> 200 500http://127.0.0.1:8000/admin/default/edit/welcome/controllers/default.p
> 200 
> 500http://127.0.0.1:8000/admin/default/edit/welcome/views/default/index.htm
> 200 500http://127.0.0.1:8000/admin/default/edit/welcome/views/layout.htm
> 200 500http://127.0.0.1:8000/admin/default/edit/welcome/static/base.cs
> 200 500http://127.0.0.1:8000/admin/default/edit/welcome/models/db.p
> 200 500http://127.0.0.1:8000/admin/default/edit/welcome/models/menu.p
> 400 500http://127.0.0.1:8000/welcome/appadmin/inde
> 200 500http://127.0.0.1:8000/admin/default/inde
> 400 400http://127.0.0.1:8000/examples/default/inde
> 200 -1http://web2py.co
> 400 400http://web2py.com/boo
> 400 500http://127.0.0.1:8000/welcome/default/inde
> 200 500http://127.0.0.1:8000/welcome/default
> 200 500http://127.0.0.1:8000/admin/default/peek/welcome/controllers/default.p
> 200 
> 500http://127.0.0.1:8000/admin/default/peek/welcome/views/default/index.htm
> 200 -1http://www.web2py.co
>
> This is the normal result
> 200 500http://127.0.0.1:8000/welcome/default/user/login
> 200 500http://127.0.0.1:8000/welcome/default/user/register
> 200 500http://127.0.0.1:8000/welcome/default/user/request_reset_password
> 200 500http://127.0.0.1:8000/welcome/default
> 200 500http://127.0.0.1:8000/welcome/default/index
> 200 500http://127.0.0.1:8000/admin/default/design/welcome
> 200 500http://127.0.0.1:8000/admin/default/edit/welcome/controllers/default.py
> 200 
> 500http://127.0.0.1:8000/admin/default/edit/welcome/views/default/index
> 200 500http://127.0.0.1:8000/admin/default/edit/welcome/views/layout.html
> 200 500http://127.0.0.1:8000/admin/default/edit/welcome/static/base.css
> 200 500http://127.0.0.1:8000/admin/default/edit/welcome/models/db.py
> 200 500http://127.0.0.1:8000/admin/default/edit/welcome/models/menu.py
> 200 500http://127.0.0.1:8000/welcome/appadmin/index
> 200 500http://127.0.0.1:8000/admin/default/index
> 200 200http://127.0.0.1:8000/examples/default/index
> 200 200http://web2py.com
> 200 500http://web2py.com/book
> 200 500http://127.0.0.1:8000/welcome/default/index
> 400 500http://127.0.0.1:8000/welcome/default/index#
> 200 500http://127.0.0.1:8000/admin/default/peek/welcome/controllers/default.py
> 200 
> 500http://127.0.0.1:8000/admin/default/peek/welcome/views/default/index
> 200 200http://www.web2py.com
>
> So when is a URL valid ?
>
> thanks,
> Stef
>
> > On Aug 21, 7:32 am, Stef Mientki  wrote:
> >>> Graphical representation of links or pages that don't get linked to.
> >> I tried to test the links (with 2 algorithms, code below) in a generated 
> >> webpage, but the result I
> >> get are very weird.
> >> Probably one you knows a better way ?
>
> >> cheers,
> >> Stef
>
> >> from BeautifulSoup import BeautifulSoup
> >> from urllib        import urlopen
> >> from httplib       import HTTP
> >> from urlparse      import urlparse
>
> >> def Check_URL_1 ( URL ) :
> >>   try:
> >>     fh = urlopen ( URL )
> >>     return fh.code == 200
> >>   except :
> >>     return False
>
> >> def Check_URL_2 ( URL ) :
> >>   p = urlparse ( URL )
> >>   h = HTTP ( p[1] )
> >>   h.putrequest ( 'HEAD', p[2] )
> >>   h.endheaders()
> >>   if h.getreply()[0] == 200:
> >>     return True
> >>   else:
> >>     return False
>
> >> def Verify_Links ( URL ) :
> >>   Parts   = URL.split('/')
> >>   Site    = '/'.join ( Parts [:3] )
> >>   Current = '/'.join ( Parts [:-1] )
>
> >>   fh = urlopen ( URL )
> >>   lines = fh.read ()
> >>   fh.close()
>
> >>   Soup = BeautifulSoup ( lines )
> >>   hrefs = lines = Soup.findAll ( 'a' )
>
> >>   for href in hrefs :
> >>     href = href [ 'href' ] #[:-1]     ## <== remove "#" to generate all 
> >> errors
>
> >>     if href.startswith ( '/' ) :
> >>       href = Site + href
> >>     elif href.startswith ('#' ) :
> >>       href = URL + href
> >>     elif href.startswith ( 'http' ) :
> >>       pass
> >>     else :
> >>       href = Current + href
>
> >>     try:
> >>       fh = urllib.urlopen ( href )
> >>     except :
> >>       pass
> >>     print Check_URL_1 ( 

Re: [web2py] Re: Should we have a feature freeze and stability maintenance period in future?

2010-08-21 Thread Jonathan Lundell
On Aug 20, 2010, at 2:40 PM, mdipierro wrote:

> I see a lot of value in
> 
> - bug-squishing-contest ,
> - Stress test, Test everything , try to crash web2py etc.
> - fix bugs, fix performance issues , improve performance
> - code cleanup , documentation.
> 
> we can set deadlines for that. This means we would stress test and
> improve features existing at a certain date and we would only add new
> features tagged as "experimental" that do not interfere with parts
> that are being stress tested. Makes sense?

I think so, as long as the terms are clear. In particular, it should be clear 
how the experimental features would move to stable (perhaps just a time limit 
on the stress test, or some more specific condition).

Perhaps in going through an exercise like this, we could also think about 
something like it could be incorporated into the normal development cycle, on 
an ongoing basis rather than as a one-shot project. 

Re: [web2py] Re: My editor ...

2010-08-21 Thread Stef Mientki
 On 21-08-2010 16:29, mdipierro wrote:
> There was a problem in trunk that may have caused this. The problem
> was with the recent change in URL bahviour. I think I fixed it. Yet I
> cannot run your code. I am getting a strange error
>
> fh = urlopen ( URL )
> return fh.getcode()
> AttributeError: addinfourl instance has no attribute 'getcode'
sorry that's absolutely above my knowledge.
Maybe a different urllib ?
I hope someone else has an idea.

btw, I read in the documentation that's better to use urllib2 instead of urllib 
(don't ask me why ;-)


cheers,
Stef



Re: [web2py] Re: Should we have a feature freeze and stability maintenance period in future?

2010-08-21 Thread Phyo Arkar
>
> I think so, as long as the terms are clear. In particular, it should be
> clear how the experimental features would move to stable (perhaps just a
> time limit on the stress test, or some more specific condition).
>
how about this?
Lets say , during  4 weeks of  bug-squishing period , all expermental
features will be also tested for bugs , if they exist they will be report to
the contributor of that feature , if the contributor or anyone send the
patch(and if contributor statify the patch if some other fixed) , that
feature will be included in main-stream , else they will tagged exprimental.

how about that sounds?

it should be exercised at every Stability level versions. lets say every
x.x5 (1.85 for example but any number that massimo wish) . As web2py is
aimed for Enterprise level , this should make development look and feel
"Enterprise".

On Sat, Aug 21, 2010 at 9:15 PM, Jonathan Lundell wrote:

> On Aug 20, 2010, at 2:40 PM, mdipierro wrote:
>
> > I see a lot of value in
> >
> > - bug-squishing-contest ,
> > - Stress test, Test everything , try to crash web2py etc.
> > - fix bugs, fix performance issues , improve performance
> > - code cleanup , documentation.
> >
> > we can set deadlines for that. This means we would stress test and
> > improve features existing at a certain date and we would only add new
> > features tagged as "experimental" that do not interfere with parts
> > that are being stress tested. Makes sense?
>
> I think so, as long as the terms are clear. In particular, it should be
> clear how the experimental features would move to stable (perhaps just a
> time limit on the stress test, or some more specific condition).
>
> Perhaps in going through an exercise like this, we could also think about
> something like it could be incorporated into the normal development cycle,
> on an ongoing basis rather than as a one-shot project.


[web2py] Re: Should we have a feature freeze and stability maintenance period in future?

2010-08-21 Thread mdipierro
How about we start testing with 1.84.1... and release 1.95.1 and the
end of the testing period?

On Aug 21, 12:00 pm, Phyo Arkar  wrote:
> > I think so, as long as the terms are clear. In particular, it should be
> > clear how the experimental features would move to stable (perhaps just a
> > time limit on the stress test, or some more specific condition).
>
> how about this?
> Lets say , during  4 weeks of  bug-squishing period , all expermental
> features will be also tested for bugs , if they exist they will be report to
> the contributor of that feature , if the contributor or anyone send the
> patch(and if contributor statify the patch if some other fixed) , that
> feature will be included in main-stream , else they will tagged exprimental.
>
> how about that sounds?
>
> it should be exercised at every Stability level versions. lets say every
> x.x5 (1.85 for example but any number that massimo wish) . As web2py is
> aimed for Enterprise level , this should make development look and feel
> "Enterprise".
>
> On Sat, Aug 21, 2010 at 9:15 PM, Jonathan Lundell wrote:
>
> > On Aug 20, 2010, at 2:40 PM, mdipierro wrote:
>
> > > I see a lot of value in
>
> > > - bug-squishing-contest ,
> > > - Stress test, Test everything , try to crash web2py etc.
> > > - fix bugs, fix performance issues , improve performance
> > > - code cleanup , documentation.
>
> > > we can set deadlines for that. This means we would stress test and
> > > improve features existing at a certain date and we would only add new
> > > features tagged as "experimental" that do not interfere with parts
> > > that are being stress tested. Makes sense?
>
> > I think so, as long as the terms are clear. In particular, it should be
> > clear how the experimental features would move to stable (perhaps just a
> > time limit on the stress test, or some more specific condition).
>
> > Perhaps in going through an exercise like this, we could also think about
> > something like it could be incorporated into the normal development cycle,
> > on an ongoing basis rather than as a one-shot project.


[web2py] Re: Patch to add functional scalar/list accessors for request.vars

2010-08-21 Thread Kevin
Yeah, use case might be as follows (let me know if there's already a
web2py pattern for this -- I just downloaded the framework a couple
days ago):

Perhaps a legacy RESTful API that is being porting to web2py -- it
uses HTTP conventions to query the server, and returns type-
appropriate content based on the request URL's file extension.

Thus the following would both work as expected when passed to the ,

/search?term=sir+robin&limit=3
/search.json?term=sir+robin&limit=3

def search():
  # We're assuming it's a string -- but it could be a list
  # point of failure.
  if not re.match('\d+$', request.vars.limit):
raise HTTP(400, "limit must be an integer")
  term = request.vars.term
  for row in db(db.topics.term.contains(term)).select(db.topics.ALL,
limitby=(0, int(limit))):
pass

However, the following URL would likely raise a TypeError (if not in
web2py code, at least in commonly-seen naive code):

/search.json?term=sir+robin&term=brave&limit=3

The boilerplate way of fixing the function would be as follows:

def search():
  limit = request.vars.limit
  if not isinstance(limit, basestring):
limit = limit[0]
  if not re.match('\d+$', limit):
raise HTTP(400, "limit must be an integer")
  term = request.vars.term
  if not isinstance(term, basestring):
term = term[0]
  for row in db(db.topics.term.contains(term)).select(db.topics.ALL,
limitby=(0, int(limit))):
pass

The shorthand way of fixing it would be as follows -- note, it also
trivially extends it to allow multiple terms which are AND'd together
(in fewer lines than the boiler-plate example):

def search():
  limit = getfirst(request.vars.limit)
  if not re.match('\d+$', limit):
raise HTTP(400, "limit must be an integer")
  query = db
  for term in getall(request.vars.term):
query = query(db.topics.term.contains(term))
  for row in query.select(db.topics.ALL, limitby=(0, int(limit))):
pass


Note that in these examples, I've modified the getfirst, getlast, and
getall functions so that they're specifically designed to work with
object attributes instead of dictionary keys, which allows for the
shorter syntax you see here (which is much more useful for working
with Storage objects, which as of 1.83.2 return None for non-existant
attributes).  Although it's less flexible, the abbreviated syntax
makes them much more handy for working with request.vars,
request.get_vars, and request.post_vars (from which you only
reasonably expect either lists, or non-lists). So in essence, these
act as 'scalarify' and 'listify' functions.

Note that "getall(request.vars.non_existant)" will return [] instead
of [None] (so it's not a 'strict' listify function).

The revised (still proposed patch) is at http://pastebin.com/8f9z4k6J.
Further examples of API use (in doctest format) are in the patch.
Also, I discovered that the *old* patch would have broken on strings
(so don't use that patch), which is what the code would've been
dealing about 100% of the time in real-world cases.

On Aug 21, 6:22 am, mdipierro  wrote:
> I never needed this but I have no opposition to include them.
> Could you provide a use case?
>  What do other people think?
>
> On Aug 21, 12:27 am, Kevin  wrote:
>
> > Hi,
>
> > this is a proposed patch to add global functions for accessing values
> > from (in particular) request.vars and friends (any dictionary-like
> > object will work) in a way that (safely) satisfies the assumption that
> > the input vars for a given key are either singletons or lists.
>
> > The functions are rather simple:
>
> > Given the request: /a/b/c?x=abc
> > getfirst(request.vars, 'x') -> 'abc'
> > getlast(request.vars, 'x') -> 'abc'
> > getall(request.vars, 'x') -> ['abc']
>
> > Given the request: /a/b/c?x=abc&x=def
> > getfirst(request.vars, 'x') -> 'abc'
> > getlast(request.vars, 'x') -> 'def'
> > getall(request.vars, 'x') -> ['abc', 'def']
>
> > getall(request.vars, 'y') -> None
> > getall(request.vars, 'y') or [] -> []
>
> > If there is anything like this already, I certainly will retract my
> > suggestion.  The potentially controversial parts are that the
> > functions are defined in gluon.utils (I couldn't find a more logical
> > place to put them, and it makes no difference to me where they end
> > up), and they're loaded into the request environment, just like the
> > html helpers.
>
> > Patch can be found at:http://pastebin.com/g6Vs9PrU
>
> > Background/motivation:
>
> > This function group is inspired by the behavior of  > pythonpaste.org/webob/reference.html#query-post-variables> and similar
> > functionality that other frameworks provide, and would be particularly
> > useful in cases where the client-side code is not managed by something
> > like web2py's FORM interface -- as of version 1.83.2, web2py prepares
> > a Storage instance such that:
>
> > /a/b/c?x=5 -> request.vars.x == '5'
> > /a/b/c?x=5&x=abc -> request.vars.x == ['5', 'abc']
>
> > This could lead to naive code like the following to fail with some
> > simple request fake

[web2py] Re: My editor ...

2010-08-21 Thread phipsico
PySide is Python for  QT . is LGPL.
Any of the three (QT -pyside-; GTK -pygtk-; WxWidget -wxPython-) is a
good choice. the most important thing is that you feel comfortable.
I think it is important to remove dependencies from Delphis.
And make sure it's multiplatform.


Re: [web2py] Re: Should we have a feature freeze and stability maintenance period in future?

2010-08-21 Thread Phyo Arkar
So thats mean during 1.84.1 - 1.95.1 new features which will need a patch to
web2py-core will be freezed and those wont need to touch web2py-core will be
put into experimental?

On Sat, Aug 21, 2010 at 11:44 PM, mdipierro  wrote:

> How about we start testing with 1.84.1... and release 1.95.1 and the
> end of the testing period?
>
> On Aug 21, 12:00 pm, Phyo Arkar  wrote:
> > > I think so, as long as the terms are clear. In particular, it should be
> > > clear how the experimental features would move to stable (perhaps just
> a
> > > time limit on the stress test, or some more specific condition).
> >
> > how about this?
> > Lets say , during  4 weeks of  bug-squishing period , all expermental
> > features will be also tested for bugs , if they exist they will be report
> to
> > the contributor of that feature , if the contributor or anyone send the
> > patch(and if contributor statify the patch if some other fixed) , that
> > feature will be included in main-stream , else they will tagged
> exprimental.
> >
> > how about that sounds?
> >
> > it should be exercised at every Stability level versions. lets say every
> > x.x5 (1.85 for example but any number that massimo wish) . As web2py is
> > aimed for Enterprise level , this should make development look and feel
> > "Enterprise".
> >
> > On Sat, Aug 21, 2010 at 9:15 PM, Jonathan Lundell  >wrote:
> >
> > > On Aug 20, 2010, at 2:40 PM, mdipierro wrote:
> >
> > > > I see a lot of value in
> >
> > > > - bug-squishing-contest ,
> > > > - Stress test, Test everything , try to crash web2py etc.
> > > > - fix bugs, fix performance issues , improve performance
> > > > - code cleanup , documentation.
> >
> > > > we can set deadlines for that. This means we would stress test and
> > > > improve features existing at a certain date and we would only add new
> > > > features tagged as "experimental" that do not interfere with parts
> > > > that are being stress tested. Makes sense?
> >
> > > I think so, as long as the terms are clear. In particular, it should be
> > > clear how the experimental features would move to stable (perhaps just
> a
> > > time limit on the stress test, or some more specific condition).
> >
> > > Perhaps in going through an exercise like this, we could also think
> about
> > > something like it could be incorporated into the normal development
> cycle,
> > > on an ongoing basis rather than as a one-shot project.
>


[web2py] redirect() cause errors since launchpad revision 2223

2010-08-21 Thread anton.mue...@gmx.de
Hello Everybody,

I will post the same code snippet twice to handle two completely
different questions.

Here:
Since I checked out revision 2223 (and later) from launchpad via
bazaar, I get errors whenever any call to the redirect(...) function
is invoked. The message is:

TypeError: 'XML' object is unsubscriptable

Look at the function index() in the posted controller snippet.
With revision  this redirects to test1 as expected.

Thanks for helping!

Best regards and greetings from sunny Bavaria,
Toni


And here comes the code:

8< HEAD OF CODE 

# One Issue: redirect does not work from launchpad revision 2223 on to
latest (2225)
def index():
session.flash = T('Welcome to my web2py page!')
redirect(URL(request.application,'test', f='test1'))


# And one Question: Validator IS_IN_SET(...) cannot handle language
specific special chars
#
# There allready were threads "Validators and non ASCII characters"
# 
http://groups.google.com/group/web2py/browse_frm/thread/db9dc637f15984c8/ea025f1d102698f2?hl=en&lnk=gst&q=umlaut#ea025f1d102698f2
#
# and "IS_IN_SET multiple=True with non-ASCII character failed"
#
http://groups.google.com/group/web2py/browse_frm/thread/545ccff33c370f9b/b779e15fd9ce6949?hl=en&lnk=gst&q=unicode+IS_IN_SET#b779e15fd9ce6949
#
# on groups.google.com. The second thread offered a solution, but it
seems to me not satisfying. Is there any other possibility to solve
this issue?
#
# What is the reason that the validators cannot handle non-ascii
characters (while python can...)?

# compare test1() to test2()

def test1():
job_locationOptions = [
u'Munich',
u'Germering',
u'Groebenzell',
]
formA = SQLFORM.factory(
Field('job_LOCATION',
  requires=IS_IN_SET(job_locationOptions),
  default = job_locationOptions[0]),
)
if formA.accepts(request.vars, session):
response.flash = 'form accepted'

return dict(form = formA)


def test2():
job_locationOptions = [
u'München',
u'Germering',
u'Gröbenzell',
]
formB = SQLFORM.factory(
Field('job_LOCATION',
  requires=IS_IN_SET(job_locationOptions),
  default = job_locationOptions[0]),
)

if formB.accepts(request.vars, session):
response.flash = 'form accepted'

return dict(form = formB)

8< TAIL OF CODE 


[web2py] How to handle non-ascii characters in validator IS_IN_SET(...)?

2010-08-21 Thread anton.mue...@gmx.de
Hello Everybody,

I will post the same code snippet twice to handle two completely
different questions.

In this thread I would like to as the following question:

The Validator IS_IN_SET(...) cannot handle language specific special
chars

There allready were threads "Validators and non ASCII characters"
http://groups.google.com/group/web2py/browse_frm/thread/db9dc637f15984c8/ea025f1d102698f2?hl=en&lnk=gst&q=umlaut#ea025f1d102698f2

and "IS_IN_SET multiple=True with non-ASCII character failed"
http://groups.google.com/group/web2py/browse_frm/thread/545ccff33c370f9b/b779e15fd9ce6949?hl=en&lnk=gst&q=unicode+IS_IN_SET#b779e15fd9ce6949

on groups.google.com. The second thread offered a solution, but it
seems to me not satisfying. Is there any other possibility to solve
this issue?

What is the reason that the validators cannot handle non-ascii
characters (while python can...)?

Thanks for helping!

Best regards and greetings from sunny Bavaria,
Toni


And here comes the code (again):

8< HEAD OF CODE 

# One Issue: redirect does not work from launchpad revision 2223 on to
latest (2225)
def index():
session.flash = T('Welcome to my web2py page!')
redirect(URL(request.application,'test', f='test1'))


# And one Question: Validator IS_IN_SET(...) cannot handle language
specific special chars
#
# There allready were threads "Validators and non ASCII characters"
# 
http://groups.google.com/group/web2py/browse_frm/thread/db9dc637f15984c8/ea025f1d102698f2?hl=en&lnk=gst&q=umlaut#ea025f1d102698f2
#
# and "IS_IN_SET multiple=True with non-ASCII character failed"
#
http://groups.google.com/group/web2py/browse_frm/thread/545ccff33c370f9b/b779e15fd9ce6949?hl=en&lnk=gst&q=unicode+IS_IN_SET#b779e15fd9ce6949
#
# on groups.google.com. The second thread offered a solution, but it
seems to me not satisfying. Is there any other possibility to solve
this issue?
#
# What is the reason that the validators cannot handle non-ascii
characters (while python can...)?

# compare test1() to test2()

def test1():
job_locationOptions = [
u'Munich',
u'Germering',
u'Groebenzell',
]
formA = SQLFORM.factory(
Field('job_LOCATION',
  requires=IS_IN_SET(job_locationOptions),
  default = job_locationOptions[0]),
)
if formA.accepts(request.vars, session):
response.flash = 'form accepted'

return dict(form = formA)


def test2():
job_locationOptions = [
u'München',
u'Germering',
u'Gröbenzell',
]
formB = SQLFORM.factory(
Field('job_LOCATION',
  requires=IS_IN_SET(job_locationOptions),
  default = job_locationOptions[0]),
)

if formB.accepts(request.vars, session):
response.flash = 'form accepted'

return dict(form = formB)

8< TAIL OF CODE 



Re: [web2py] Re: Should we have a feature freeze and stability maintenance period in future?

2010-08-21 Thread Michele Comitini
What about defining some milestones where new features are assigned?
Once a milestone completes freeze and branch on that branch bug
squeezing is done and tags for stable releases.
Meanwhile the trunk starts traveling to the next milestone.

I think whatever solution we find, Massimo needs to be relieved and
not aggravated with more tasks :D



2010/8/21 Phyo Arkar :
> So thats mean during 1.84.1 - 1.95.1 new features which will need a patch to
> web2py-core will be freezed and those wont need to touch web2py-core will be
> put into experimental?
>
> On Sat, Aug 21, 2010 at 11:44 PM, mdipierro  wrote:
>>
>> How about we start testing with 1.84.1... and release 1.95.1 and the
>> end of the testing period?
>>
>> On Aug 21, 12:00 pm, Phyo Arkar  wrote:
>> > > I think so, as long as the terms are clear. In particular, it should
>> > > be
>> > > clear how the experimental features would move to stable (perhaps just
>> > > a
>> > > time limit on the stress test, or some more specific condition).
>> >
>> > how about this?
>> > Lets say , during  4 weeks of  bug-squishing period , all expermental
>> > features will be also tested for bugs , if they exist they will be
>> > report to
>> > the contributor of that feature , if the contributor or anyone send the
>> > patch(and if contributor statify the patch if some other fixed) , that
>> > feature will be included in main-stream , else they will tagged
>> > exprimental.
>> >
>> > how about that sounds?
>> >
>> > it should be exercised at every Stability level versions. lets say every
>> > x.x5 (1.85 for example but any number that massimo wish) . As web2py is
>> > aimed for Enterprise level , this should make development look and feel
>> > "Enterprise".
>> >
>> > On Sat, Aug 21, 2010 at 9:15 PM, Jonathan Lundell
>> > wrote:
>> >
>> > > On Aug 20, 2010, at 2:40 PM, mdipierro wrote:
>> >
>> > > > I see a lot of value in
>> >
>> > > > - bug-squishing-contest ,
>> > > > - Stress test, Test everything , try to crash web2py etc.
>> > > > - fix bugs, fix performance issues , improve performance
>> > > > - code cleanup , documentation.
>> >
>> > > > we can set deadlines for that. This means we would stress test and
>> > > > improve features existing at a certain date and we would only add
>> > > > new
>> > > > features tagged as "experimental" that do not interfere with parts
>> > > > that are being stress tested. Makes sense?
>> >
>> > > I think so, as long as the terms are clear. In particular, it should
>> > > be
>> > > clear how the experimental features would move to stable (perhaps just
>> > > a
>> > > time limit on the stress test, or some more specific condition).
>> >
>> > > Perhaps in going through an exercise like this, we could also think
>> > > about
>> > > something like it could be incorporated into the normal development
>> > > cycle,
>> > > on an ongoing basis rather than as a one-shot project.
>


Re: [web2py] Re: Should we have a feature freeze and stability maintenance period in future?

2010-08-21 Thread Phyo Arkar
>
> I think whatever solution we find, Massimo needs to be relieved and
> not aggravated with more tasks :D
>

Yeah thats true , but all the bug hunting , stress  and stability testes
should be focused by us(community)

On Sun, Aug 22, 2010 at 1:45 AM, Michele Comitini <
michele.comit...@gmail.com> wrote:

> What about defining some milestones where new features are assigned?
> Once a milestone completes freeze and branch on that branch bug
> squeezing is done and tags for stable releases.
> Meanwhile the trunk starts traveling to the next milestone.
>
> I think whatever solution we find, Massimo needs to be relieved and
> not aggravated with more tasks :D
>
>
>
> 2010/8/21 Phyo Arkar :
> > So thats mean during 1.84.1 - 1.95.1 new features which will need a patch
> to
> > web2py-core will be freezed and those wont need to touch web2py-core will
> be
> > put into experimental?
> >
> > On Sat, Aug 21, 2010 at 11:44 PM, mdipierro 
> wrote:
> >>
> >> How about we start testing with 1.84.1... and release 1.95.1 and the
> >> end of the testing period?
> >>
> >> On Aug 21, 12:00 pm, Phyo Arkar  wrote:
> >> > > I think so, as long as the terms are clear. In particular, it should
> >> > > be
> >> > > clear how the experimental features would move to stable (perhaps
> just
> >> > > a
> >> > > time limit on the stress test, or some more specific condition).
> >> >
> >> > how about this?
> >> > Lets say , during  4 weeks of  bug-squishing period , all expermental
> >> > features will be also tested for bugs , if they exist they will be
> >> > report to
> >> > the contributor of that feature , if the contributor or anyone send
> the
> >> > patch(and if contributor statify the patch if some other fixed) , that
> >> > feature will be included in main-stream , else they will tagged
> >> > exprimental.
> >> >
> >> > how about that sounds?
> >> >
> >> > it should be exercised at every Stability level versions. lets say
> every
> >> > x.x5 (1.85 for example but any number that massimo wish) . As web2py
> is
> >> > aimed for Enterprise level , this should make development look and
> feel
> >> > "Enterprise".
> >> >
> >> > On Sat, Aug 21, 2010 at 9:15 PM, Jonathan Lundell
> >> > wrote:
> >> >
> >> > > On Aug 20, 2010, at 2:40 PM, mdipierro wrote:
> >> >
> >> > > > I see a lot of value in
> >> >
> >> > > > - bug-squishing-contest ,
> >> > > > - Stress test, Test everything , try to crash web2py etc.
> >> > > > - fix bugs, fix performance issues , improve performance
> >> > > > - code cleanup , documentation.
> >> >
> >> > > > we can set deadlines for that. This means we would stress test and
> >> > > > improve features existing at a certain date and we would only add
> >> > > > new
> >> > > > features tagged as "experimental" that do not interfere with parts
> >> > > > that are being stress tested. Makes sense?
> >> >
> >> > > I think so, as long as the terms are clear. In particular, it should
> >> > > be
> >> > > clear how the experimental features would move to stable (perhaps
> just
> >> > > a
> >> > > time limit on the stress test, or some more specific condition).
> >> >
> >> > > Perhaps in going through an exercise like this, we could also think
> >> > > about
> >> > > something like it could be incorporated into the normal development
> >> > > cycle,
> >> > > on an ongoing basis rather than as a one-shot project.
> >
>


[web2py] Re: redirect() cause errors since launchpad revision 2223

2010-08-21 Thread mdipierro
was fixed in 225 today

On Aug 21, 1:50 pm, "anton.mue...@gmx.de"  wrote:
> Hello Everybody,
>
> I will post the same code snippet twice to handle two completely
> different questions.
>
> Here:
> Since I checked out revision 2223 (and later) from launchpad via
> bazaar, I get errors whenever any call to the redirect(...) function
> is invoked. The message is:
>
> TypeError: 'XML' object is unsubscriptable
>
> Look at the function index() in the posted controller snippet.
> With revision  this redirects to test1 as expected.
>
> Thanks for helping!
>
> Best regards and greetings from sunny Bavaria,
> Toni
>
> And here comes the code:
>
> 8< HEAD OF CODE 
>
> # One Issue: redirect does not work from launchpad revision 2223 on to
> latest (2225)
> def index():
>     session.flash = T('Welcome to my web2py page!')
>     redirect(URL(request.application,'test', f='test1'))
>
> # And one Question: Validator IS_IN_SET(...) cannot handle language
> specific special chars
> #
> # There allready were threads "Validators and non ASCII characters"
> #http://groups.google.com/group/web2py/browse_frm/thread/db9dc637f1598...
> #
> # and "IS_IN_SET multiple=True with non-ASCII character failed"
> #http://groups.google.com/group/web2py/browse_frm/thread/545ccff33c370...
> #
> # on groups.google.com. The second thread offered a solution, but it
> seems to me not satisfying. Is there any other possibility to solve
> this issue?
> #
> # What is the reason that the validators cannot handle non-ascii
> characters (while python can...)?
>
> # compare test1() to test2()
>
> def test1():
>     job_locationOptions = [
>         u'Munich',
>         u'Germering',
>         u'Groebenzell',
>         ]
>     formA = SQLFORM.factory(
>         Field('job_LOCATION',
>               requires=IS_IN_SET(job_locationOptions),
>               default = job_locationOptions[0]),
>         )
>     if formA.accepts(request.vars, session):
>         response.flash = 'form accepted'
>
>     return dict(form = formA)
>
> def test2():
>     job_locationOptions = [
>         u'München',
>         u'Germering',
>         u'Gröbenzell',
>         ]
>     formB = SQLFORM.factory(
>         Field('job_LOCATION',
>               requires=IS_IN_SET(job_locationOptions),
>               default = job_locationOptions[0]),
>         )
>
>     if formB.accepts(request.vars, session):
>         response.flash = 'form accepted'
>
>     return dict(form = formB)
>
> 8< TAIL OF CODE 


[web2py] Re: How to handle non-ascii characters in validator IS_IN_SET(...)?

2010-08-21 Thread mdipierro
They can but you have to use utf8, not unicode. This is because the
GET and POST vars are bytes not uncode.

On Aug 21, 1:51 pm, "anton.mue...@gmx.de"  wrote:
> Hello Everybody,
>
> I will post the same code snippet twice to handle two completely
> different questions.
>
> In this thread I would like to as the following question:
>
> The Validator IS_IN_SET(...) cannot handle language specific special
> chars
>
> There allready were threads "Validators and non ASCII 
> characters"http://groups.google.com/group/web2py/browse_frm/thread/db9dc637f1598...
>
> and "IS_IN_SET multiple=True with non-ASCII character 
> failed"http://groups.google.com/group/web2py/browse_frm/thread/545ccff33c370...
>
> on groups.google.com. The second thread offered a solution, but it
> seems to me not satisfying. Is there any other possibility to solve
> this issue?
>
> What is the reason that the validators cannot handle non-ascii
> characters (while python can...)?
>
> Thanks for helping!
>
> Best regards and greetings from sunny Bavaria,
> Toni
>
> And here comes the code (again):
>
> 8< HEAD OF CODE 
>
> # One Issue: redirect does not work from launchpad revision 2223 on to
> latest (2225)
> def index():
>     session.flash = T('Welcome to my web2py page!')
>     redirect(URL(request.application,'test', f='test1'))
>
> # And one Question: Validator IS_IN_SET(...) cannot handle language
> specific special chars
> #
> # There allready were threads "Validators and non ASCII characters"
> #http://groups.google.com/group/web2py/browse_frm/thread/db9dc637f1598...
> #
> # and "IS_IN_SET multiple=True with non-ASCII character failed"
> #http://groups.google.com/group/web2py/browse_frm/thread/545ccff33c370...
> #
> # on groups.google.com. The second thread offered a solution, but it
> seems to me not satisfying. Is there any other possibility to solve
> this issue?
> #
> # What is the reason that the validators cannot handle non-ascii
> characters (while python can...)?
>
> # compare test1() to test2()
>
> def test1():
>     job_locationOptions = [
>         u'Munich',
>         u'Germering',
>         u'Groebenzell',
>         ]
>     formA = SQLFORM.factory(
>         Field('job_LOCATION',
>               requires=IS_IN_SET(job_locationOptions),
>               default = job_locationOptions[0]),
>         )
>     if formA.accepts(request.vars, session):
>         response.flash = 'form accepted'
>
>     return dict(form = formA)
>
> def test2():
>     job_locationOptions = [
>         u'München',
>         u'Germering',
>         u'Gröbenzell',
>         ]
>     formB = SQLFORM.factory(
>         Field('job_LOCATION',
>               requires=IS_IN_SET(job_locationOptions),
>               default = job_locationOptions[0]),
>         )
>
>     if formB.accepts(request.vars, session):
>         response.flash = 'form accepted'
>
>     return dict(form = formB)
>
> 8< TAIL OF CODE 


[web2py] Newbie needs help

2010-08-21 Thread Michele Alzetta
Dear web2py-users,

I tried to create the database schema of my application by adding the
following code in db.py ; I am pasting the entire code, but in fact
the problem appears already at the first table definition, because te
ticket I get is the following:

Traceback (most recent call last):
  File "/home/mike/web2py/gluon/restricted.py", line 186, in
restricted
exec ccode in environment
  File "/home/mike/web2py/applications/TurniPS/models/db.py", line 28,
in 
Field('OrarioSett','integer',default='38'))
  File "/home/mike/web2py/gluon/sql.py", line 1359, in define_table
t._create(migrate=migrate, fake_migrate=fake_migrate)
  File "/home/mike/web2py/gluon/sql.py", line 1845, in _create
fake_migrate=fake_migrate)
  File "/home/mike/web2py/gluon/sql.py", line 1914, in _migrate
self._db._execute(sub_query)
  File "/home/mike/web2py/gluon/sql.py", line 947, in 
self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
OperationalError: duplicate column name: lnott

This is the code, of course there is no duplicate column name...

... so - is this a silly mistake (missing bracket or apostrophe =
better use an editor instead of the web interface to develop)
... is it a crass error (young man, if you had read the manual on page
n, you would know that field definitions whatever)
... or what ? And how would it be best to go about debugging this sort
of error ?

Thank you for any suggestions. Here follows the code:

# Tabella 1 - dati personali dei medici

db.define_table('Medici',
 
Field('SiglaMedico','string',required=True,length=5,notnull=True,unique=True),
 
Field('NomeCognome','string',length=5,required=True,notnull=True,unique=True),
  Field('Email'),
  Field('LNott','boolean',default=True),
  Field('LPref','boolean',default=True),
  Field('LFest','boolean',default=True),
  Field('OrarioSett','integer',default='38'))

db.Medici.Email.requires=IS_EMAIL(error_message=T('Indirizzo email
invalido!'))
db.Medici.OrarioSett.requires=IS_INT_IN_RANGE(0,40)

# Tabella 2 - periodi di assenza dei medici

db.define_table('Assenze',
Field('Medici_id',db.Medici),
Field('Inizio','datetime'),
Field('Fine','datetime'),
Field('PesoMotivazione','integer'),
Field('Motivazione','string'))

db.Assenze.Inizio.requires=IS_DATETIME()
db.Assenze.Fine.requires=IS_DATETIME()
db.Assenze.PesoMotivazione.requires=IS_INT_IN_RANGE(0,10)

# Tabella 3 - tipi di servizio

db.define_table('Servizi',
 
Field('SiglaServizio','string',length=5,required=True,notnull=True,unique=True),
Field('TipoServizio','string'))

# Tabella 4 - tipi di turno

db.define_table('Turni',
 
Field('SiglaTurno','string',length=5,required=True,notnull=True,unique=True),
Field('OraInizio','time'),
Field('OraFine','time'),
Field('DescizioneTurno','string'))

db.Turni.OraInizio.requires=IS_TIME()
db.Turni.OraFine.requires=IS_TIME()

# Tabella 5 - associamo i diversi tipi di turno a diversi tipi di
servizio

db.define_table('ServiziTurno',
Field('Servizi_id',db.Servizi),
Field('Turni_id',db.Turni))

# Tabella 6 - associamo ogni medico a diversi tipi di servizio

db.define_table('ServiziMedici',
Field('Servizi_id',db.Servizi),
Field('Medici_id',db.Medici),
Field('Preferenza','integer'))

db.ServiziMedici.Preferenza.requires=IS_INT_IN_RANGE(0,10)

# Tabella 7 - infine il nostro schema turni !

db.define_table('SchemaTurni',
Field('Data','date'),
Field('Turni_id',db.Turni),
Field('Medici_id',db.Medici),
Field('Gettone','boolean',default=False),
Field('OreServizo','integer'),
Field('Festivo','boolean'),
Field('Preferenza','integer'))

db.SchemaTurni.Data.requires=IS_DATE()
db.SchemaTurni.OreServizio.requires=IS_INT_IN_RANGE(0,12)
db.SchemaTurni.Preferenza.requires=IS_INT_IN_RANGE(0,10)


[web2py] Re: Newbie needs help

2010-08-21 Thread mdipierro
My guess is that this is a problem with sqlite. You had the field, you
removed it (but sqlite does not support drop), then you put it back
(and web2py tried to define it again).

Delete everything in applications//databases then run it
again.

You have a typo

db.define_table('SchemaTurni',
...
Field('OreServizo','integer'), 

On Aug 21, 5:01 pm, Michele Alzetta  wrote:
> Dear web2py-users,
>
> I tried to create the database schema of my application by adding the
> following code in db.py ; I am pasting the entire code, but in fact
> the problem appears already at the first table definition, because te
> ticket I get is the following:
>
> Traceback (most recent call last):
>   File "/home/mike/web2py/gluon/restricted.py", line 186, in
> restricted
>     exec ccode in environment
>   File "/home/mike/web2py/applications/TurniPS/models/db.py", line 28,
> in 
>     Field('OrarioSett','integer',default='38'))
>   File "/home/mike/web2py/gluon/sql.py", line 1359, in define_table
>     t._create(migrate=migrate, fake_migrate=fake_migrate)
>   File "/home/mike/web2py/gluon/sql.py", line 1845, in _create
>     fake_migrate=fake_migrate)
>   File "/home/mike/web2py/gluon/sql.py", line 1914, in _migrate
>     self._db._execute(sub_query)
>   File "/home/mike/web2py/gluon/sql.py", line 947, in 
>     self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
> OperationalError: duplicate column name: lnott
>
> This is the code, of course there is no duplicate column name...
>
> ... so - is this a silly mistake (missing bracket or apostrophe =
> better use an editor instead of the web interface to develop)
> ... is it a crass error (young man, if you had read the manual on page
> n, you would know that field definitions whatever)
> ... or what ? And how would it be best to go about debugging this sort
> of error ?
>
> Thank you for any suggestions. Here follows the code:
>
> # Tabella 1 - dati personali dei medici
>
> db.define_table('Medici',
>
> Field('SiglaMedico','string',required=True,length=5,notnull=True,unique=True),
>
> Field('NomeCognome','string',length=5,required=True,notnull=True,unique=True),
>   Field('Email'),
>   Field('LNott','boolean',default=True),
>   Field('LPref','boolean',default=True),
>   Field('LFest','boolean',default=True),
>   Field('OrarioSett','integer',default='38'))
>
> db.Medici.Email.requires=IS_EMAIL(error_message=T('Indirizzo email
> invalido!'))
> db.Medici.OrarioSett.requires=IS_INT_IN_RANGE(0,40)
>
> # Tabella 2 - periodi di assenza dei medici
>
> db.define_table('Assenze',
>     Field('Medici_id',db.Medici),
>     Field('Inizio','datetime'),
>     Field('Fine','datetime'),
>     Field('PesoMotivazione','integer'),
>     Field('Motivazione','string'))
>
> db.Assenze.Inizio.requires=IS_DATETIME()
> db.Assenze.Fine.requires=IS_DATETIME()
> db.Assenze.PesoMotivazione.requires=IS_INT_IN_RANGE(0,10)
>
> # Tabella 3 - tipi di servizio
>
> db.define_table('Servizi',
>
> Field('SiglaServizio','string',length=5,required=True,notnull=True,unique=True),
>     Field('TipoServizio','string'))
>
> # Tabella 4 - tipi di turno
>
> db.define_table('Turni',
>
> Field('SiglaTurno','string',length=5,required=True,notnull=True,unique=True),
>     Field('OraInizio','time'),
>     Field('OraFine','time'),
>     Field('DescizioneTurno','string'))
>
> db.Turni.OraInizio.requires=IS_TIME()
> db.Turni.OraFine.requires=IS_TIME()
>
> # Tabella 5 - associamo i diversi tipi di turno a diversi tipi di
> servizio
>
> db.define_table('ServiziTurno',
>     Field('Servizi_id',db.Servizi),
>     Field('Turni_id',db.Turni))
>
> # Tabella 6 - associamo ogni medico a diversi tipi di servizio
>
> db.define_table('ServiziMedici',
>     Field('Servizi_id',db.Servizi),
>     Field('Medici_id',db.Medici),
>     Field('Preferenza','integer'))
>
> db.ServiziMedici.Preferenza.requires=IS_INT_IN_RANGE(0,10)
>
> # Tabella 7 - infine il nostro schema turni !
>
> db.define_table('SchemaTurni',
>     Field('Data','date'),
>     Field('Turni_id',db.Turni),
>     Field('Medici_id',db.Medici),
>     Field('Gettone','boolean',default=False),
>     Field('OreServizo','integer'),
>     Field('Festivo','boolean'),
>     Field('Preferenza','integer'))
>
> db.SchemaTurni.Data.requires=IS_DATE()
> db.SchemaTurni.OreServizio.requires=IS_INT_IN_RANGE(0,12)
> db.SchemaTurni.Preferenza.requires=IS_INT_IN_RANGE(0,10)


Re: [web2py] Facebook oauth

2010-08-21 Thread Michele Comitini
Ok found a way to fix the problem with redirection (_next parameter).
Massimo pls look if the following is correct!


diff -r 9261ce4eda7f gluon/tools.py
--- a/gluon/tools.pyThu Aug 19 04:13:54 2010 +0200
+++ b/gluon/tools.pySun Aug 22 00:08:25 2010 +0200
@@ -982,7 +983,7 @@
 request = self.environment.request
 args = request.args
 if not args:
-redirect(self.url(args='login'))
+redirect(self.url(args='login', vars=request.vars))
 elif args[0] in self.settings.actions_disabled:
 raise HTTP(404)
 if args[0] == 'login':


2010/8/20 Michele Comitini :
> Hello Narendran,
>
> Do not use that it is old..
>
> now facebook is supported inside web2py distribution with oauth20_account.py
> you can find an example app here:
> http://code.google.com/r/michelecomitini-facebookaccess/source/browse/#hg/applications/helloFacebook
>
> for a simple example usage of graph api look here:
> http://code.google.com/r/michelecomitini-facebookaccess/source/browse/applications/helloFacebook/models/grafb.py
> http://code.google.com/r/michelecomitini-facebookaccess/source/browse/applications/helloFacebook/controllers/graph.py
> http://code.google.com/r/michelecomitini-facebookaccess/source/browse/#hg/applications/helloFacebook/views/graph
>
>
> for the redirection after login I am investigating...
>
> mic
>
> 2010/8/20 Narendran :
>> Hello all,
>> I picked the Facebook oauth submitted by mcm from
>> https://code.google.com/r/michelecomitini-facebookaccess/source/browse/gluon/contrib/login_methods/facebook_account.py
>>  (referred in this thread:
>> http://groups.google.com/group/web2py/browse_thread/thread/be441047bf237f9/6ea33cf0d4bfba63?lnk=gst&q=facebook+oauth#6ea33cf0d4bfba63)
>>
>> I am facing one isse:
>> 1. I've placed require_login decoration on a method say a(). After the
>> authentication is complete, the page always gets redirected to default/
>> index, whereas the ideal behaviour would be to go to a(). It works as
>> intended if I use default auth instead of Facebook auth.
>>
>> Also, is there any plugin/package that would provide full-fledged
>> support for using Facebook Graph API with web2py?
>>
>> --
>> Thanks
>> Narendran
>


Re: [web2py] Facebook oauth

2010-08-21 Thread Michele Comitini
in tools.py line 1436:
next = URL(r=request) + '?_next=' + next
should be like this?
next = self.url('user', args='login') + '?_next=' + next


2010/8/22 Michele Comitini :
> Ok found a way to fix the problem with redirection (_next parameter).
> Massimo pls look if the following is correct!
>
>
> diff -r 9261ce4eda7f gluon/tools.py
> --- a/gluon/tools.py    Thu Aug 19 04:13:54 2010 +0200
> +++ b/gluon/tools.py    Sun Aug 22 00:08:25 2010 +0200
> @@ -982,7 +983,7 @@
>         request = self.environment.request
>         args = request.args
>         if not args:
> -            redirect(self.url(args='login'))
> +            redirect(self.url(args='login', vars=request.vars))
>         elif args[0] in self.settings.actions_disabled:
>             raise HTTP(404)
>         if args[0] == 'login':
>
>
> 2010/8/20 Michele Comitini :
>> Hello Narendran,
>>
>> Do not use that it is old..
>>
>> now facebook is supported inside web2py distribution with oauth20_account.py
>> you can find an example app here:
>> http://code.google.com/r/michelecomitini-facebookaccess/source/browse/#hg/applications/helloFacebook
>>
>> for a simple example usage of graph api look here:
>> http://code.google.com/r/michelecomitini-facebookaccess/source/browse/applications/helloFacebook/models/grafb.py
>> http://code.google.com/r/michelecomitini-facebookaccess/source/browse/applications/helloFacebook/controllers/graph.py
>> http://code.google.com/r/michelecomitini-facebookaccess/source/browse/#hg/applications/helloFacebook/views/graph
>>
>>
>> for the redirection after login I am investigating...
>>
>> mic
>>
>> 2010/8/20 Narendran :
>>> Hello all,
>>> I picked the Facebook oauth submitted by mcm from
>>> https://code.google.com/r/michelecomitini-facebookaccess/source/browse/gluon/contrib/login_methods/facebook_account.py
>>>  (referred in this thread:
>>> http://groups.google.com/group/web2py/browse_thread/thread/be441047bf237f9/6ea33cf0d4bfba63?lnk=gst&q=facebook+oauth#6ea33cf0d4bfba63)
>>>
>>> I am facing one isse:
>>> 1. I've placed require_login decoration on a method say a(). After the
>>> authentication is complete, the page always gets redirected to default/
>>> index, whereas the ideal behaviour would be to go to a(). It works as
>>> intended if I use default auth instead of Facebook auth.
>>>
>>> Also, is there any plugin/package that would provide full-fledged
>>> support for using Facebook Graph API with web2py?
>>>
>>> --
>>> Thanks
>>> Narendran
>>
>


[web2py] Re: redirect() cause errors since launchpad revision 2223

2010-08-21 Thread Jose


On 21 ago, 18:30, mdipierro  wrote:
> was fixed in 225 today

Still broken, I just updated and still gives the same error.

Jose


Re: [web2py] Facebook oauth

2010-08-21 Thread Michele Comitini
Massimo here is the full patch with modifications for
oauth*_account.py login_methods

tnx!

2010/8/22 Michele Comitini :
> in tools.py line 1436:
>                next = URL(r=request) + '?_next=' + next
> should be like this?
>                next = self.url('user', args='login') + '?_next=' + next
>
>
> 2010/8/22 Michele Comitini :
>> Ok found a way to fix the problem with redirection (_next parameter).
>> Massimo pls look if the following is correct!
>>
>>
>> diff -r 9261ce4eda7f gluon/tools.py
>> --- a/gluon/tools.py    Thu Aug 19 04:13:54 2010 +0200
>> +++ b/gluon/tools.py    Sun Aug 22 00:08:25 2010 +0200
>> @@ -982,7 +983,7 @@
>>         request = self.environment.request
>>         args = request.args
>>         if not args:
>> -            redirect(self.url(args='login'))
>> +            redirect(self.url(args='login', vars=request.vars))
>>         elif args[0] in self.settings.actions_disabled:
>>             raise HTTP(404)
>>         if args[0] == 'login':
>>
>>
>> 2010/8/20 Michele Comitini :
>>> Hello Narendran,
>>>
>>> Do not use that it is old..
>>>
>>> now facebook is supported inside web2py distribution with oauth20_account.py
>>> you can find an example app here:
>>> http://code.google.com/r/michelecomitini-facebookaccess/source/browse/#hg/applications/helloFacebook
>>>
>>> for a simple example usage of graph api look here:
>>> http://code.google.com/r/michelecomitini-facebookaccess/source/browse/applications/helloFacebook/models/grafb.py
>>> http://code.google.com/r/michelecomitini-facebookaccess/source/browse/applications/helloFacebook/controllers/graph.py
>>> http://code.google.com/r/michelecomitini-facebookaccess/source/browse/#hg/applications/helloFacebook/views/graph
>>>
>>>
>>> for the redirection after login I am investigating...
>>>
>>> mic
>>>
>>> 2010/8/20 Narendran :
 Hello all,
 I picked the Facebook oauth submitted by mcm from
 https://code.google.com/r/michelecomitini-facebookaccess/source/browse/gluon/contrib/login_methods/facebook_account.py
  (referred in this thread:
 http://groups.google.com/group/web2py/browse_thread/thread/be441047bf237f9/6ea33cf0d4bfba63?lnk=gst&q=facebook+oauth#6ea33cf0d4bfba63)

 I am facing one isse:
 1. I've placed require_login decoration on a method say a(). After the
 authentication is complete, the page always gets redirected to default/
 index, whereas the ideal behaviour would be to go to a(). It works as
 intended if I use default auth instead of Facebook auth.

 Also, is there any plugin/package that would provide full-fledged
 support for using Facebook Graph API with web2py?

 --
 Thanks
 Narendran
>>>
>>
>
# HG changeset patch
# User michele.comit...@gmail.com
# Date 1282431532 -7200
# Node ID 38ac5690519fb20f98d7ab51f02775b0cdae4482
# Parent  9261ce4eda7f5fb93f3cd5e717be99bfdeb086f9
Modification to keep the action flow after authentication.

diff -r 9261ce4eda7f -r 38ac5690519f app.yaml
--- a/app.yaml	Thu Aug 19 04:13:54 2010 +0200
+++ b/app.yaml	Sun Aug 22 00:58:52 2010 +0200
@@ -1,5 +1,5 @@
 application: grafbook
-version: 1.1
+version: 2
 api_version: 1
 runtime: python
 
diff -r 9261ce4eda7f -r 38ac5690519f applications/helloFacebook/controllers/graph.py
--- a/applications/helloFacebook/controllers/graph.py	Thu Aug 19 04:13:54 2010 +0200
+++ b/applications/helloFacebook/controllers/graph.py	Sun Aug 22 00:58:52 2010 +0200
@@ -1,6 +1,5 @@
 # -*- coding: utf-8 -*-
-import simplejson as json
-from facebook import GraphAPI
+from facebook import GraphAPI, GraphAPIError
 
 @auth.requires_login()
 def index():
@@ -12,7 +11,12 @@
 fb_id = 'me'
 
 graph = getGraph()
-fb_obj = graph.get_object(fb_id, metadata=1)
+try:
+fb_obj = graph.get_object(fb_id, metadata=1)
+except GraphAPIError, e:
+print("%s: %s " % (__name__, e))
+redirect(auth.url(f='user', args='logout'))
+
 response.menu = [[k, False, URL(r=request, f='connection', args=[fb_id,k])] for k,v in  fb_obj['metadata']['connections'].items()]
 return dict(message=T('You are at  %(fb_id)s', dict(fb_id=fb_id)))
 
@@ -23,7 +27,13 @@
 return None
 fb_id = request.args[0]
 fb_connection_name = request.args[1]
-connections = getGraph().get_connections(fb_id, fb_connection_name)
+try:
+connections = getGraph().get_connections(fb_id, fb_connection_name)
+except GraphAPIError, e:
+print("%s: %s " % (__name__, e))
+redirect(auth.url(f='user', args='logout'))
+
+
 print connections
 response.menu=[[v['name'], False, URL(r=request, f='index', args=['id', v['id']])]  for v in connections['data']]
 return dict(message=T('Looking list of %(conn_name)s of %(id)s', dict(conn_name=fb_connection_name, id=fb_id)))
diff -r 9261ce4eda7f -r 38ac5690519f applications/helloFacebook/languages/it-it.py
--- a/applications/helloFacebook/languages/it-it.py	Thu Aug 19 04:13:54 2010 +0200
+++ b/applications/helloF

[web2py] Re: patch for auth to work with web2py_component ajaxing

2010-08-21 Thread mdipierro
I modified web2py_ajax.html (in trunk) so that it now takes a new

response.headers['web2py-component-content']

which can be 'prepend', 'append' or 'hide' and you can do

def index():
return dict(check=LOAD('default','test.load',ajax=True))

@auth.requires_login()
def test(): return "hello world"

def user():
if request.extension=='load' and not auth.user:
response.flash = 'hey! login please'
response.headers['web2py-component-content']='prepend'
return 'oops, you must login'
return dict(form=auth())

Is this acceptable?




On Aug 20, 3:36 pm, Jurgis Pralgauskis 
wrote:
> hello, by default, if some function needs auth, w2p gives back some
> text/html:
> When I work with components ajax way, I don't want my content parts to
> get mangled with it...
> 1) if I am not logged in, it would flood my tiny content area with big
> login page clone :)
> 2) in my case, I want my current content (of target div) to stay in
> place if I don't have permisions,  (and new  content should replace it
> only if accessible).
>
> so I made a small patch, You can test it 
> hearhttps://web2py-gae-test.appspot.com/auth_for_web2py_components/defaul...
> its default new app with several changes in
> /controllers/default.py : user()
> /views/web2py_ajax.html  : web2py_ajax_page()
>
> is it a good way? or how would be better?
>
> /controllers/default.py
>
> def user():
>     if request.ajax:
>         result = auth()
>         if not auth.user:
>             return "ERROR" +" You should %s first \n" %
> ( A('login',  _target="blank", _href=auth.settings.login_url).xml())
>         if isinstance(result, str):
>             response.flash = result
>             return "ERROR"
>         return result # no dict(form=result)
>     else:
>         return dict(form=auth())
>
> /views/web2py_ajax.html
>
>     'success': function(text) {
>         if (text.startsWith( "ERROR" )) {
>           jQuery('#'+target).prepend( text.substr( "ERROR".length ) );
>         }
>         else {
>             jQuery('#'+target).html(text);
>         }


[web2py] lazy virtualfields

2010-08-21 Thread Niphlod
so, I read the docs and.

I think either there's a bug or I'm doing something wrong

in db.py

---
.

db.define_table('test',
Field('name', length=5)
)

class TestLazy:
def lazy_test_field(self):
def lazy(self=self):
return self.test.name
return lazy

class TestNotLazy:
def not_lazy_test_field(self):
return self.test.name

db.test.virtualfields.append(TestLazy())
db.test.virtualfields.append(TestNotLazy())



Testing in the shell

web2py Shell Version 1.83.2 (2010-08-15 08:16:30)
In[0]:  set = db(db.test.id>0).select()

Out[0]:
In[1]:  set.as_dict()

Out[1]: {1: {'name': 'miao', 'id': 1, 'not_lazy_test_field': 'miao'},
2: {'name': 'bau', 'id': 2, 'not_lazy_test_field': 'bau'}}

In[2]:for row in set:
print row.id, row.name, row.not_lazy_test_field

Out[2]:
1 miao miao
2 bau bau

In[3]:
for row in set:
print row.id, row.name, row.not_lazy_test_field,
row.lazy_test_field

Out[3]:
1 miao miao 
2 bau bau 

In[4]:
for row in set:
print row.id, row.name, row.not_lazy_test_field,
row.lazy_test_field()

Out[4]:
1 miao miao bau
2 bau bau bau


sorry for the unmeaning data in the set, but...seems that lazy
virtualfield is evaluated every line (different hash function when you
try to print row.lazy_test_field without parenthesis, In[3]) but it
returns data computed for the last line in the set...in all the rows
of the set itself (In[4])

Can somebody point me in the right direction ?
Thanks



[web2py] Fwd: strange problem

2010-08-21 Thread Richard Vézina
Don't see my mail in the list!!


-- Forwarded message --
From: Richard Vézina 
Date: 2010/8/20
Subject: strange problem
To: web2py@googlegroups.com


Hello Massimo,

I face a new problem. I have a postgresql text field that serves to store a
multiple referenced id. I don't use jquery plugin or anything else in my
form to make the selection of the element (only CTRL+mouse clic over the
representation of the id in the nav). No problem when the field is populated
by web2py form... I am getting |1|2| in my text field and when I crud.update
over the record I get my selected ID representation highligthed. *But when I
update manually the field at the postgresql database level I loose the
highligthed ID representation on crud.update.*

For example

UPDATE mytab
SET othertab_id='|529|'

I hope I am clear.

Thanks

Richard


[web2py] Fwd: strange problem

2010-08-21 Thread Richard Vézina
-- Forwarded message --
From: Richard Vézina 
Date: 2010/8/20
Subject: Re: strange problem
To: web2py@googlegroups.com


Wrong report... I made some other test and I don't get anymore the
highlighted multiselection with crud.update...

I change of version recently (1.81.4 -> 1.83.2). I look in my older app
version and I have the highlighted multiselection with crud.update...

Not sure if it comes from my app or the web2py update... I look further.

Richard

2010/8/20 Richard Vézina 

> Hello Massimo,
>
> I face a new problem. I have a postgresql text field that serves to store
> a
> multiple referenced id. I don't use jquery plugin or anything else in my
> form to make the selection of the element (only CTRL+mouse clic over the
> representation of the id in the nav). No problem when the field is populated
> by web2py form... I am getting |1|2| in my text field and when I crud.update
> over the record I get my selected ID representation highligthed. *But when
> I update manually the field at the postgresql database level I loose the
> highligthed ID representation on crud.update.*
>
> For example
>
> UPDATE mytab
> SET othertab_id='|529|'
>
> I hope I am clear.
>
> Thanks
>
> Richard
>


[web2py] Fwd: strange problem

2010-08-21 Thread Richard Vézina
-- Forwarded message --
From: Richard Vézina 
Date: 2010/8/20
Subject: Re: strange problem
To: web2py@googlegroups.com


Ok, I made a few more check and I am pretty sure it coming from web2py
version... Do we lost this cause of list:integer, list:reference, etc.??

Richard

2010/8/20 Richard Vézina 

> Wrong report... I made some other test and I don't get anymore the
> highlighted multiselection with crud.update...
>
> I change of version recently (1.81.4 -> 1.83.2). I look in my older app
> version and I have the highlighted multiselection with crud.update...
>
> Not sure if it comes from my app or the web2py update... I look further.
>
> Richard
>
> 2010/8/20 Richard Vézina 
>
>> Hello Massimo,
>>
>> I face a new problem. I have a postgresql text field that serves to store
>> a
>> multiple referenced id. I don't use jquery plugin or anything else in my
>> form to make the selection of the element (only CTRL+mouse clic over the
>> representation of the id in the nav). No problem when the field is populated
>> by web2py form... I am getting |1|2| in my text field and when I crud.update
>> over the record I get my selected ID representation highligthed. *But
>> when I update manually the field at the postgresql database level I loose
>> the highligthed ID representation on crud.update.*
>>
>> For example
>>
>> UPDATE mytab
>> SET othertab_id='|529|'
>>
>> I hope I am clear.
>>
>> Thanks
>>
>> Richard
>>
>
>


[web2py] cube2py not working on GAE

2010-08-21 Thread smoggy
Hi there,

I'm trying to get cube2py working on GAE(locally) without sucess.

The browser loads the login page well :
http://127.0.0.1:8080/cube2py/default/user/login

but when i try to login and the url changes to :
http://127.0.0.1:8080/cube2py/plugin_wiki/page/home

I get a :
404 NOT FOUND

What am i doing wrong ?

I'm using web2py revision 800 from mercurial and the latest cube2py.

Thanks in advance.


[web2py] Re: strange problem

2010-08-21 Thread mdipierro
sorry Richard,

I do not fully understand the problem. Please list a number of steps
to reproduce. Describe what you see and what you expect.

Massimo

On Aug 20, 10:19 am, Richard Vézina 
wrote:
> Ok, I made a few more check and I am pretty sure it coming from web2py
> version... Do we lost this cause of list:integer, list:reference, etc.??
>
> Richard
>
> 2010/8/20 Richard Vézina 
>
> > Wrong report... I made some other test and I don't get anymore the
> > highlighted multiselection with crud.update...
>
> > I change of version recently (1.81.4 -> 1.83.2). I look in my older app
> > version and I have the highlighted multiselection with crud.update...
>
> > Not sure if it comes from my app or the web2py update... I look further.
>
> > Richard
>
> > 2010/8/20 Richard Vézina 
>
> >> Hello Massimo,
>
> >> I face a new problem. I have a postgresql text field that serves to store
> >> a
> >> multiple referenced id. I don't use jquery plugin or anything else in my
> >> form to make the selection of the element (only CTRL+mouse clic over the
> >> representation of the id in the nav). No problem when the field is 
> >> populated
> >> by web2py form... I am getting |1|2| in my text field and when I 
> >> crud.update
> >> over the record I get my selected ID representation highligthed. *But
> >> when I update manually the field at the postgresql database level I loose
> >> the highligthed ID representation on crud.update.*
>
> >> For example
>
> >> UPDATE mytab
> >> SET othertab_id='|529|'
>
> >> I hope I am clear.
>
> >> Thanks
>
> >> Richard


Re: [web2py] cube2py not working on GAE

2010-08-21 Thread Bruno Rocha
I got same problem on Locally GAE, but when I deployed the app to
GAE(online) , everything worked ok.

http://web2pybrasil.appspot.com


2010/8/21 smoggy 

> Hi there,
>
> I'm trying to get cube2py working on GAE(locally) without sucess.
>
> The browser loads the login page well :
> http://127.0.0.1:8080/cube2py/default/user/login
>
> but when i try to login and the url changes to :
> http://127.0.0.1:8080/cube2py/plugin_wiki/page/home
>
> I get a :
> 404 NOT FOUND
>
> What am i doing wrong ?
>
> I'm using web2py revision 800 from mercurial and the latest cube2py.
>
> Thanks in advance.




-- 

http://rochacbruno.com.br


[web2py] TypeError: 'XML' object is unsubscriptable

2010-08-21 Thread Jose
Hi,

(I can not find the thread where it was this error)

>From admin create a new application: apptest

go to:
http://127.0.0.1:8000/apptest

produces the following error:

TypeError: 'XML' object is unsubscriptable

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

exec ccode in environment

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


[web2py] Re: cube2py not working on GAE

2010-08-21 Thread mdipierro
Do you get a traceback in the console?

On Aug 21, 7:03 pm, smoggy  wrote:
> Hi there,
>
> I'm trying to get cube2py working on GAE(locally) without sucess.
>
> The browser loads the login page well 
> :http://127.0.0.1:8080/cube2py/default/user/login
>
> but when i try to login and the url changes to 
> :http://127.0.0.1:8080/cube2py/plugin_wiki/page/home
>
> I get a :
> 404 NOT FOUND
>
> What am i doing wrong ?
>
> I'm using web2py revision 800 from mercurial and the latest cube2py.
>
> Thanks in advance.


[web2py] Re: TypeError: 'XML' object is unsubscriptable

2010-08-21 Thread mdipierro
Which version. If not web2py stable, please check latest trunk.

On Aug 21, 8:33 pm, Jose  wrote:
> Hi,
>
> (I can not find the thread where it was this error)
>
> From admin create a new application: apptest
>
> go to:http://127.0.0.1:8000/apptest
>
> produces the following error:
>
> TypeError: 'XML' object is unsubscriptable
>
> if type(code) == types.CodeType:
>             ccode = code
>         else:
>             ccode = compile2(code,layer)
>
> exec ccode in environment
>
>     except HTTP:
>         raise
>     except Exception:
>         # XXX Show exception in Wing IDE if running in debugger


[web2py] Re: SQLFORM.factory

2010-08-21 Thread DenesL


On 20 ago, 02:16, Kenneth Lundström 
wrote:
> My view looks like:
> {{extend 'layout.html'}}
> 
> {{=T('Sellers in this campaign')}}
> {{for person in person_data:}}
> 
>        {{=A(str(person.name + " " + person.surname),
> _href=URL(r=request, f='edit_seller', args=[troop.id, person.id,
> person.troop_group]))}}
> {{=groups[person.troop_group]['name']}}
> 
> {{pass}}
> 
> {{=T('Insert old user to this campaign')}}
> {{=form}}
> {{=form_new_person}}
> 
> {{=T('Troop groups')}}
> {{for group in group_data:}}
> {{=A(group.name, _href=URL(r=request, f='edit_group',
> args=[troop.id, campaign.id, group.id]))}}
> 
> {{pass}}
> 
> 
> {{=form_new_group}}
>
> Controller:
> form = SQLFORM.factory(Field('new_seller',
> requires=IS_IN_SET(['kalle','ville'])), label=str(T('New seller')), **args)

The problem is the double closing parenthesis before label, it should
be:

requires=IS_IN_SET(['kalle','ville']), label=T('New seller')), **args)

otherwise the label is not part of the Field definition.

>      form['_formname'] = 'add_seller'
>
>
> I changed the IS_IS_DB to IS_IN_SET but that didn t help either.
>
> What part of the view do I need to look at.
>
> Kenneth
>


[web2py] Re: TypeError: 'XML' object is unsubscriptable

2010-08-21 Thread mr.freeze
I get the same thing on a newly created app when running from trunk:

Traceback (most recent call last):
  File "C:\web2py\gluon\restricted.py", line 188, in restricted
exec ccode in environment
  File "C:\web2py\applications\crashtest/views\default/index.html",
line 27, in 
TypeError: 'XML' object is unsubscriptable

On Aug 21, 9:58 pm, mdipierro  wrote:
> Which version. If not web2py stable, please check latest trunk.
>
> On Aug 21, 8:33 pm, Jose  wrote:
>
> > Hi,
>
> > (I can not find the thread where it was this error)
>
> > From admin create a new application: apptest
>
> > go to:http://127.0.0.1:8000/apptest
>
> > produces the following error:
>
> > TypeError: 'XML' object is unsubscriptable
>
> > if type(code) == types.CodeType:
> >             ccode = code
> >         else:
> >             ccode = compile2(code,layer)
>
> > exec ccode in environment
>
> >     except HTTP:
> >         raise
> >     except Exception:
> >         # XXX Show exception in Wing IDE if running in debugger


Re: [web2py] Should we have a feature freeze and stability maintenance period in future?

2010-08-21 Thread Andrew Thompson

 On 8/20/2010 4:54 PM, Phyo Arkar wrote:

-bug-squishing-contest ,
-Stress test, Test everything , try to crash web2py etc.


Could we build an app to act as a test harness?

Or a script to build an app per a test case, evaluate it, then destroy 
that app, loop etc.


Turning bug reports into test cases causes regressions to be noticed 
quicker I would think.


--
Andrew Thompson
http://aktzero.com/



Re: [web2py] Should we have a feature freeze and stability maintenance period in future?

2010-08-21 Thread Jason Brower
Again I think we have more pressure for testing tools.  Which I agree
on.
BR,
Jason

On Sun, 2010-08-22 at 00:32 -0400, Andrew Thompson wrote: 
> On 8/20/2010 4:54 PM, Phyo Arkar wrote:
> > -bug-squishing-contest ,
> > -Stress test, Test everything , try to crash web2py etc.
> 
> Could we build an app to act as a test harness?
> 
> Or a script to build an app per a test case, evaluate it, then destroy 
> that app, loop etc.
> 
> Turning bug reports into test cases causes regressions to be noticed 
> quicker I would think.
> 




[web2py] Re: TypeError: 'XML' object is unsubscriptable

2010-08-21 Thread mdipierro
Did you try 819?

Massimo

On Aug 21, 11:01 pm, "mr.freeze"  wrote:
> I get the same thing on a newly created app when running from trunk:
>
> Traceback (most recent call last):
>   File "C:\web2py\gluon\restricted.py", line 188, in restricted
>     exec ccode in environment
>   File "C:\web2py\applications\crashtest/views\default/index.html",
> line 27, in 
> TypeError: 'XML' object is unsubscriptable
>
> On Aug 21, 9:58 pm, mdipierro  wrote:
>
> > Which version. If not web2py stable, please check latest trunk.
>
> > On Aug 21, 8:33 pm, Jose  wrote:
>
> > > Hi,
>
> > > (I can not find the thread where it was this error)
>
> > > From admin create a new application: apptest
>
> > > go to:http://127.0.0.1:8000/apptest
>
> > > produces the following error:
>
> > > TypeError: 'XML' object is unsubscriptable
>
> > > if type(code) == types.CodeType:
> > >             ccode = code
> > >         else:
> > >             ccode = compile2(code,layer)
>
> > > exec ccode in environment
>
> > >     except HTTP:
> > >         raise
> > >     except Exception:
> > >         # XXX Show exception in Wing IDE if running in debugger


[web2py] Date field represent not respected when for validation fails

2010-08-21 Thread RipRyness
I am trying to use a "m/d/" format for a date field.  I've also
created a custom widget for the field.  Everything seems to be working
fine except when a form is submitted with validation errors.  The
returned form value for the date reverts back to "-dd-mm", even
when the form was submitted with a date value in 'm/d/' format and
the validation error was caused by another field. Perhaps I'm doing
something wrong.  However I was able to fix the problem by adding two
lines to sqlhtml.py.

It seems that this line (942):
>>   widget = field.widget(field, value)
would return my custom widget markup with an input value with correct
date format
but line 944:
>>   self.field_parent[row_id]._traverse(False,hideerror)
would change the input's value to a date format of '-dd-mm'

The lines I added to fix this became 944 and 945:
>>   if field.represent and self.field_parent[row_id].vars.get(field.name, 
>> False):
>>  self.field_parent[row_id].vars[field.name] = 
>> field.represent(self.field_parent[row_id].vars[field.name])

I don't really want to fork this so if I could get some feedback as to
what I may be doing wrong or whether this fix are something equivalent
will make it into the trunk, that would be greatly appreciated.

FYI, I've got a week's experience in web2py and python so take it easy
on me :)



[web2py] Re: Date field represent not respected when for validation fails

2010-08-21 Thread mdipierro
You should not use represent for this purpose. You should use
internationalization. If your language is en, create an en language
files and translated the date formats. There are 4 of them.

On Aug 21, 11:33 pm, RipRyness  wrote:
> I am trying to use a "m/d/" format for a date field.  I've also
> created a custom widget for the field.  Everything seems to be working
> fine except when a form is submitted with validation errors.  The
> returned form value for the date reverts back to "-dd-mm", even
> when the form was submitted with a date value in 'm/d/' format and
> the validation error was caused by another field. Perhaps I'm doing
> something wrong.  However I was able to fix the problem by adding two
> lines to sqlhtml.py.
>
> It seems that this line (942):>>   widget = field.widget(field, value)
>
> would return my custom widget markup with an input value with correct
> date format
> but line 944:>>   self.field_parent[row_id]._traverse(False,hideerror)
>
> would change the input's value to a date format of '-dd-mm'
>
> The lines I added to fix this became 944 and 945:
>
> >>   if field.represent and self.field_parent[row_id].vars.get(field.name, 
> >> False):
> >>      self.field_parent[row_id].vars[field.name] = 
> >> field.represent(self.field_parent[row_id].vars[field.name])
>
> I don't really want to fork this so if I could get some feedback as to
> what I may be doing wrong or whether this fix are something equivalent
> will make it into the trunk, that would be greatly appreciated.
>
> FYI, I've got a week's experience in web2py and python so take it easy
> on me :)


Re: [web2py] Re: TypeError: 'XML' object is unsubscriptable

2010-08-21 Thread Jonathan Lundell
On Aug 21, 2010, at 10:02 PM, mdipierro wrote:

> Did you try 819?

I think XML needs this:

def __getitem__(self, key):
return str(self).__getitem__(key)




> 
> Massimo
> 
> On Aug 21, 11:01 pm, "mr.freeze"  wrote:
>> I get the same thing on a newly created app when running from trunk:
>> 
>> Traceback (most recent call last):
>>   File "C:\web2py\gluon\restricted.py", line 188, in restricted
>> exec ccode in environment
>>   File "C:\web2py\applications\crashtest/views\default/index.html",
>> line 27, in 
>> TypeError: 'XML' object is unsubscriptable
>> 
>> On Aug 21, 9:58 pm, mdipierro  wrote:
>> 
>>> Which version. If not web2py stable, please check latest trunk.
>> 
>>> On Aug 21, 8:33 pm, Jose  wrote:
>> 
 Hi,
>> 
 (I can not find the thread where it was this error)
>> 
 From admin create a new application: apptest
>> 
 go to:http://127.0.0.1:8000/apptest
>> 
 produces the following error:
>> 
 TypeError: 'XML' object is unsubscriptable
>> 
 if type(code) == types.CodeType:
 ccode = code
 else:
 ccode = compile2(code,layer)
>> 
 exec ccode in environment
>> 
 except HTTP:
 raise
 except Exception:
 # XXX Show exception in Wing IDE if running in debugger




[web2py] Re: TypeError: 'XML' object is unsubscriptable

2010-08-21 Thread mdipierro
I had it, together with __getslice__, I thought I pushed in 819 but
perhaps I did not. Pushing again.

On Aug 22, 12:17 am, Jonathan Lundell  wrote:
> On Aug 21, 2010, at 10:02 PM, mdipierro wrote:
>
> > Did you try 819?
>
> I think XML needs this:
>
>     def __getitem__(self, key):
>         return str(self).__getitem__(key)
>
>
>
> > Massimo
>
> > On Aug 21, 11:01 pm, "mr.freeze"  wrote:
> >> I get the same thing on a newly created app when running from trunk:
>
> >> Traceback (most recent call last):
> >>   File "C:\web2py\gluon\restricted.py", line 188, in restricted
> >>     exec ccode in environment
> >>   File "C:\web2py\applications\crashtest/views\default/index.html",
> >> line 27, in 
> >> TypeError: 'XML' object is unsubscriptable
>
> >> On Aug 21, 9:58 pm, mdipierro  wrote:
>
> >>> Which version. If not web2py stable, please check latest trunk.
>
> >>> On Aug 21, 8:33 pm, Jose  wrote:
>
>  Hi,
>
>  (I can not find the thread where it was this error)
>
>  From admin create a new application: apptest
>
>  go to:http://127.0.0.1:8000/apptest
>
>  produces the following error:
>
>  TypeError: 'XML' object is unsubscriptable
>
>  if type(code) == types.CodeType:
>              ccode = code
>          else:
>              ccode = compile2(code,layer)
>
>  exec ccode in environment
>
>      except HTTP:
>          raise
>      except Exception:
>          # XXX Show exception in Wing IDE if running in debugger


Re: [web2py] Re: TypeError: 'XML' object is unsubscriptable

2010-08-21 Thread Jonathan Lundell
On Aug 21, 2010, at 10:41 PM, mdipierro wrote:

> I had it, together with __getslice__, I thought I pushed in 819 but
> perhaps I did not. Pushing again.

That's better.

> 
> On Aug 22, 12:17 am, Jonathan Lundell  wrote:
>> On Aug 21, 2010, at 10:02 PM, mdipierro wrote:
>> 
>>> Did you try 819?
>> 
>> I think XML needs this:
>> 
>> def __getitem__(self, key):
>> return str(self).__getitem__(key)
>> 
>> 
>> 
>>> Massimo
>> 
>>> On Aug 21, 11:01 pm, "mr.freeze"  wrote:
 I get the same thing on a newly created app when running from trunk:
>> 
 Traceback (most recent call last):
   File "C:\web2py\gluon\restricted.py", line 188, in restricted
 exec ccode in environment
   File "C:\web2py\applications\crashtest/views\default/index.html",
 line 27, in 
 TypeError: 'XML' object is unsubscriptable
>> 
 On Aug 21, 9:58 pm, mdipierro  wrote:
>> 
> Which version. If not web2py stable, please check latest trunk.
>> 
> On Aug 21, 8:33 pm, Jose  wrote:
>> 
>> Hi,
>> 
>> (I can not find the thread where it was this error)
>> 
>> From admin create a new application: apptest
>> 
>> go to:http://127.0.0.1:8000/apptest
>> 
>> produces the following error:
>> 
>> TypeError: 'XML' object is unsubscriptable
>> 
>> if type(code) == types.CodeType:
>> ccode = code
>> else:
>> ccode = compile2(code,layer)
>> 
>> exec ccode in environment
>> 
>> except HTTP:
>> raise
>> except Exception:
>> # XXX Show exception in Wing IDE if running in debugger




Re: [web2py] Re: SQLFORM.factory

2010-08-21 Thread Kenneth Lundström
 > The problem is the double closing parenthesis before label, it 
should be:

requires=IS_IN_SET(['kalle','ville']), label=T('New seller')), **args)
otherwise the label is not part of the Field definition.

OK, no I see the problem. Thank you very many.


Kenneth



  form['_formname'] = 'add_seller'


I changed the IS_IS_DB to IS_IN_SET but that didn t help either.

What part of the view do I need to look at.

Kenneth