[web2py] getting started with fbconnect

2010-04-19 Thread Rohan
Hi All,

I want to use fbconnect with web2py. I found couple of threads in this
group
1. 
http://groups.google.com/group/web2py/browse_frm/thread/84f27e0a06312da2/df12a6fac159242e?lnk=gst&q=fbconnect#df12a6fac159242e
2. 
http://groups.google.com/group/web2py/browse_frm/thread/31e9149ad731067d/938e04f705533026?lnk=gst&q=fbconnect#938e04f705533026

but I am not able to find any document to get started with using
fbconnect with web2py. I have already obtained API key from facebook.
Can someone please share any doc for using fbconnect with web2py?

Thanks


[web2py] Re: Creating a new auth session

2010-04-19 Thread Rohan
hi Jon,

Can you please share updates on integration between fbconnect and
auth.user()?

Thanks

On Feb 2, 4:34 pm, Jon Romero  wrote:
> But then how auth.user is updated?
>
>
>
>
>
> >All auth does on successful login is:
> >from gluon.storage import Storage
> >session.auth=Storage()
> >session.auth.user = db(db.auth_user.id==logged_in_user_id).select
> ().first()
> >session.auth.user_id = session.auth.user.id
> >session.auth.last_visit = request.now
> >set session.auth=None on logout.
>
> > >>> So, how can Icreatea new session programmatically (like the login
> > >>> page does)?
>
> > >> --
> > >> Alejandro Fanjul Fdez.
> > >> alex.fan...@gmail.comwww.mhproject.org
>
> > --
> > Alejandro Fanjul Fdez.
> > alex.fan...@gmail.comwww.mhproject.org


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Customizing Retrieve password process

2010-04-19 Thread Rohan
Hi All,

Currently my retrieve password application sends new password directly
to user. Anyone can reset password of any other user as long as they
know the email id. So I want to customize the process and want to send
a mail to user asking user to verify email and reset password from
some link provided in that page something like verification of email
while registering.

Any pointers?

Thanks
Rohan


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] storing sessions for auth users

2010-04-19 Thread selecta
I wonder what is the best way to store session of auth users

What I want is to retrieve an old session of a user when he loges in
again (restoring all his customizations etc)
To achieve this I could
A) store the session in a table once the user loges out, but then I
would loose changes if the session just expires because the user never
logged out (right?)
B) I could modify the session object to save itself in the database as
soon as it is changed

B) sounds nicer, but how to do that, maybe somebody already did that?
some help would be nice


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] storing sessions for auth users

2010-04-19 Thread Jason Brower
On the same lines, I wonder if someone could simply pickle everything is
session and save it in teh database under there user id.
BR,
Jason
On Mon, 2010-04-19 at 03:18 -0700, selecta wrote: 
> I wonder what is the best way to store session of auth users
> 
> What I want is to retrieve an old session of a user when he loges in
> again (restoring all his customizations etc)
> To achieve this I could
> A) store the session in a table once the user loges out, but then I
> would loose changes if the session just expires because the user never
> logged out (right?)
> B) I could modify the session object to save itself in the database as
> soon as it is changed
> 
> B) sounds nicer, but how to do that, maybe somebody already did that?
> some help would be nice
> 
> 




-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Trouble starting web2py

2010-04-19 Thread szimszon
Is there now a quick way to start web2py without removing simplejson
from debian?

Tnx.

On ápr. 11, 16:23, mdipierro  wrote:
> What's your advice about this?
>
> Out r version of simplejson is patched to serialize dates. We could
> upgrade to the latest and re-patch and for now this problem will go
> away but this is not a long term solution. Clearly we must change
> something in the way simplejson is imported to avoid conflict.
>
> Massimo
>
> On Apr 11, 4:30 am, muybay  wrote:
>
>
>
> > I have the issue also. I am going to try this suggestion and possibly
> > diff the two versions (upgraded vs web2py simplejson).
>
> > On Apr 8, 8:00 am, mdipierro  wrote:
>
> > > One solution is to upgrade thesimplejsonthat comes with web2py. The
> > > problem is that the one we use has been modified to handle dates.
>
> > > On Apr 8, 4:27 am, Johann Spies  wrote:
>
> > > > Removing Debian's python-simplejsonhelped me to start web2py again -
> > > > and broke some other stuff on Debian.
>
> > > > Regards
> > > > Johann
> > > > --
> > > >        "Every good gift and every perfect gift is from above,
> > > >       and cometh down from the Father of lights, with whom
> > > >       is no variableness, neither shadow of turning."
> > > >                              James 1:17


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: Trouble starting web2py

2010-04-19 Thread Mathieu Clabaut
I use virtualenvwrapper
http://www.doughellmann.com/docs/virtualenvwrapper/ which
seems to work like a charm.

export WORKON_HOME=$HOME/.virtualenvs
source /usr/bin/virtualenvwrapper.sh # put those 2 lines in your
$HOME/.bashrc
mkvirtualenv web2py

>From here, you just have to type :
workon web2py

berfore launching web2py.

It is not a web2py solution, but it may help in the meanwhile.

-Mathieu



On Mon, Apr 19, 2010 at 13:15, szimszon  wrote:

> Is there now a quick way to start web2py without removing simplejson
> from debian?
>
> Tnx.
>
> On ápr. 11, 16:23, mdipierro  wrote:
> > What's your advice about this?
> >
> > Out r version of simplejson is patched to serialize dates. We could
> > upgrade to the latest and re-patch and for now this problem will go
> > away but this is not a long term solution. Clearly we must change
> > something in the way simplejson is imported to avoid conflict.
> >
> > Massimo
> >
> > On Apr 11, 4:30 am, muybay  wrote:
> >
> >
> >
> > > I have the issue also. I am going to try this suggestion and possibly
> > > diff the two versions (upgraded vs web2py simplejson).
> >
> > > On Apr 8, 8:00 am, mdipierro  wrote:
> >
> > > > One solution is to upgrade thesimplejsonthat comes with web2py. The
> > > > problem is that the one we use has been modified to handle dates.
> >
> > > > On Apr 8, 4:27 am, Johann Spies  wrote:
> >
> > > > > Removing Debian's python-simplejsonhelped me to start web2py again
> -
> > > > > and broke some other stuff on Debian.
> >
> > > > > Regards
> > > > > Johann
> > > > > --
> > > > >"Every good gift and every perfect gift is from above,
> > > > >   and cometh down from the Father of lights, with whom
> > > > >   is no variableness, neither shadow of turning."
> > > > >  James 1:17
>
>
> --
> Subscription settings:
> http://groups.google.com/group/web2py/subscribe?hl=en
>


[web2py] Re: Trouble starting web2py

2010-04-19 Thread szimszon
I got the some traceback as before :(

>>> sys.path
['', '/home/szimszon/.virtualenvs/web2py/lib/python2.5/site-packages/
setuptools-0.6c11-py2.5.egg', '/usr/lib/pymodules/python2.5', '/home/
szimszon/.virtualenvs/web2py/lib/python2.5', '/home/
szimszon/.virtualenvs/web2py/lib/python2.5/plat-linux2', '/home/
szimszon/.virtualenvs/web2py/lib/python2.5/lib-tk', '/home/
szimszon/.virtualenvs/web2py/lib/python2.5/lib-dynload', '/usr/lib/
python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-
tk', '/home/szimszon/.virtualenvs/web2py/lib/python2.5/site-packages',
'/usr/local/lib/python2.5/site-packages', '/usr/lib/python2.5/site-
packages', '/usr/lib/python2.5/site-packages/PIL', '/usr/lib/python2.5/
site-packages/gst-0.10', '/usr/lib/pymodules/python2.5/gtk-2.0', '/usr/
lib/python2.5/site-packages/wx-2.6-gtk2-unicode']


On ápr. 19, 13:30, Mathieu Clabaut  wrote:
> I use 
> virtualenvwrapperhttp://www.doughellmann.com/docs/virtualenvwrapper/which
> seems to work like a charm.
>
> export WORKON_HOME=$HOME/.virtualenvs
> source /usr/bin/virtualenvwrapper.sh # put those 2 lines in your
> $HOME/.bashrc
> mkvirtualenv web2py
>
> From here, you just have to type :
> workon web2py
>
> berfore launching web2py.
>
> It is not a web2py solution, but it may help in the meanwhile.
>
> -Mathieu
>
>
>
> On Mon, Apr 19, 2010 at 13:15, szimszon  wrote:
> > Is there now a quick way to start web2py without removing simplejson
> > from debian?
>
> > Tnx.
>
> > On ápr. 11, 16:23, mdipierro  wrote:
> > > What's your advice about this?
>
> > > Out r version of simplejson is patched to serialize dates. We could
> > > upgrade to the latest and re-patch and for now this problem will go
> > > away but this is not a long term solution. Clearly we must change
> > > something in the way simplejson is imported to avoid conflict.
>
> > > Massimo
>
> > > On Apr 11, 4:30 am, muybay  wrote:
>
> > > > I have the issue also. I am going to try this suggestion and possibly
> > > > diff the two versions (upgraded vs web2py simplejson).
>
> > > > On Apr 8, 8:00 am, mdipierro  wrote:
>
> > > > > One solution is to upgrade thesimplejsonthat comes with web2py. The
> > > > > problem is that the one we use has been modified to handle dates.
>
> > > > > On Apr 8, 4:27 am, Johann Spies  wrote:
>
> > > > > > Removing Debian's python-simplejsonhelped me to start web2py again
> > -
> > > > > > and broke some other stuff on Debian.
>
> > > > > > Regards
> > > > > > Johann
> > > > > > --
> > > > > >        "Every good gift and every perfect gift is from above,
> > > > > >       and cometh down from the Father of lights, with whom
> > > > > >       is no variableness, neither shadow of turning."
> > > > > >                              James 1:17
>
> > --
> > Subscription settings:
> >http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] creating links to '#blah'

2010-04-19 Thread G. Clifford Williams
I'm trying to figure out how to get links created in web2py that point to an 
anchor name here is the code I'm using: 

{{=DIV(SPAN(gripe.created_on, _class='gripe-date'), 
A(SPAN(SPAN('Comments:'),
SPAN(gripe.comments, _class='comment-number'),
_class='comment-count'),
_href=URL(r=request, f='gripe',
args=[gripe.id,  
XML('#comments')] )),
_class='gripe-footer')}}
 

from this I was hoping to get a link like: 
http://localhost:8081/init/default/gripe/9/#comments

but instead I got :
http://localhost:8081/init/default/gripe/9/%23comments


I should mention that this is on GAE SDK and I have not tried it standalone 
(yet). 

Any help would be appreciated




-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: storing sessions for auth users

2010-04-19 Thread selecta
that should work

On Apr 19, 1:06 pm, Jason Brower  wrote:
> On the same lines, I wonder if someone could simply pickle everything is
> session and save it in teh database under there user id.
> BR,
> Jason
>
>
>
>
>
> On Mon, 2010-04-19 at 03:18 -0700, selecta wrote:
> > I wonder what is the best way to store session of auth users
>
> > What I want is to retrieve an old session of a user when he loges in
> > again (restoring all his customizations etc)
> > To achieve this I could
> > A) store the session in a table once the user loges out, but then I
> > would loose changes if the session just expires because the user never
> > logged out (right?)
> > B) I could modify the session object to save itself in the database as
> > soon as it is changed
>
> > B) sounds nicer, but how to do that, maybe somebody already did that?
> > some help would be nice
>
> --
> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Proposing a web2py Community spring.

2010-04-19 Thread Albert Abril
Hi there!

It's known that other communities like rails and django do sprints.
Not sure if here has been one time ago, but for what i read i think that no.

I would to ask here to the web2py like to do a sprint.
We could suggest subjects to focus, as:

   -  fixing bugs
   -  making improvement and new features
   -  develop apps (a better cms, twitter clones..)
   -  write howto's at your blogs

What do you think?

Regards!


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Proposing a web2py Community spring.

2010-04-19 Thread Jason Brower
+1 if you can pick the day soon enough.
On Mon, 2010-04-19 at 15:14 +0200, Albert Abril wrote:
> Hi there!
> 
> It's known that other communities like rails and django do sprints.
> Not sure if here has been one time ago, but for what i read i think
> that no.
> 
> I would to ask here to the web2py like to do a sprint. 
> We could suggest subjects to focus, as: 
>   *  fixing bugs 
>   *  making improvement and new features 
>   *  develop apps (a better cms, twitter clones..) 
>   *  write howto's at your blogs 
> What do you think?
> 
> Regards!
> 
> 




-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] creating links to '#blah'

2010-04-19 Thread Thadeus Burgess
You probably want,

XML('#comments', sanitize=False)


--
Thadeus





On Mon, Apr 19, 2010 at 7:38 AM, G. Clifford Williams
 wrote:
> I'm trying to figure out how to get links created in web2py that point to an 
> anchor name here is the code I'm using:
>
>            {{=DIV(SPAN(gripe.created_on, _class='gripe-date'),
>                    A(SPAN(SPAN('Comments:'),
>                            SPAN(gripe.comments, _class='comment-number'),
>                            _class='comment-count'),
>                            _href=URL(r=request, f='gripe',
>                                                args=[gripe.id,  
> XML('#comments')] )),
>                    _class='gripe-footer')}}
>
>
> from this I was hoping to get a link like:
> http://localhost:8081/init/default/gripe/9/#comments
>
> but instead I got :
> http://localhost:8081/init/default/gripe/9/%23comments
>
>
> I should mention that this is on GAE SDK and I have not tried it standalone 
> (yet).
>
> Any help would be appreciated
>
>
>
>
> --
> Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en
>


[web2py] Re: can I hook my code to db.connect() ?

2010-04-19 Thread mdipierro
There is no hook for this, but should this not be always the default?
If so I am happy to add it to trunk. Any counterindication?

On Apr 19, 12:32 am, Alexey Nezhdanov  wrote:
> Hi.
> Sometimes I have to execute this line prior to making a query:
>     oradb.executesql("ALTER SESSION set NLS_DATE_FORMAT = '-MM-DD
> HH24:MI:SS';")
>
> That is because Oracle by default uses different date format that causes my
> queries to fail.
> The problem is that doing that in model is incorrect - this should be
> executed just once for each db connection.
> Doing that just prior to query is inconvenient and still incorrect - I am
> probably reusing same connection.
> Can I somehow tell web2py to execute this sql right after calling connect()?
>
> Regards
> Alexey
>
> --
> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: Session id gets re-used

2010-04-19 Thread Thadeus Burgess
The session ID is only unique between your web browser and your application.

Try this test using two different web browsers.

--
Thadeus





On Mon, Apr 19, 2010 at 1:21 AM, Adi  wrote:
> Update:
>
> This seems to work in user():
>
>  if request.args(0) == 'login':
>      session.clear()
>
> Am I doing something wrong or unnecessary?
>
> On Apr 19, 10:57 am, Adi  wrote:
>> Hi all,
>>
>> In my application, the session id seems to be getting re-used across
>> different sessions.
>>
>> To explain:
>>
>> Login 1:
>> ---
>> print str(session) on user/logout shows the following:
>>
>> > bcba-25bc46eac3ce', '_formkey[login]': '2af20030-f787-4623-851d-
>> e823988a4df2', '_formkey[client_create]': 'd4f4a845-f6e1-403a-9e11-
>> b92d2da1b023', '_formkey[job_create]':
>> 'c3325e1c-3f1d-409d-875b-240a8026f168', 'flash': None, 'auth':
>> > 'registration_key': '', 'incorrect_login_count': 0, 'email':
>> 'aditya.sa...@gmail.com', 'reset_password_key': '',
>> 'last_password_change': datetime.datetime(2010, 4, 1, 15, 16, 13),
>> 'password':
>> '9db266ab73d140f31b9ba732110c956673c5c9de84918842fd5f3759206508ea437fd7ad90 
>> 242cf185b52b0f0bc53593b408b729b735f2bb8305963de8386c93',
>> 'account_locked': False, 'id': 1}>, 'last_visit':
>> datetime.datetime(2010, 4, 19, 11, 18, 37, 417024), 'remember': False}
>>
>> >}>
>>
>> Login 2:
>> 
>> > bcba-25bc46eac3ce', '_formkey[login]': '9e0813ad-41f5-4c1d-8634-
>> b6aa6dd6faf2', '_formkey[client_create]': 'd4f4a845-f6e1-403a-9e11-
>> b92d2da1b023', '_formkey[job_create]': '1424bef4-2a3e-43d2-8a6f-
>> be6d91098e88', 'flash': None, 'auth': > 'user': > '9db266ab73d140f31b9ba732110c956673c5c9de84918842fd5f3759206508ea437fd7ad90 
>> 242cf185b52b0f0bc53593b408b729b735f2bb8305963de8386c93',
>> 'incorrect_login_count': 0, 'id': 1, 'reset_password_key': '',
>> 'last_password_change': datetime.datetime(2010, 4, 1, 15, 16, 13),
>> 'registration_key': '', 'account_locked': False, 'email':
>> 'aditya.sa...@gmail.com'}>, 'last_visit': datetime.datetime(2010, 4,
>> 19, 11, 20, 1, 154791), 'remember': False}>}>
>>
>> Now I have set expiration auth.settings.expire=600 . Now someone
>> reviewing security of my application said that having the same session
>> id can allow someone to "hijack" the session. How can I cause a
>> completely different session id for a user after every new login?
>>
>> Sorry my knowledge of this is quite limited. Would appreciate any
>> insights here.
>>
>> Thanks,
>> Aditya
>>
>> --
>> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en
>


[web2py] Re: Session id gets re-used

2010-04-19 Thread mdipierro
This is a feature. The web2py session (mapped to a file or db record)
is one thing, the auth session (logical) is another. The web2py
session is linked to your browser session. The auth session affects
whether you are logged in or not. You may want the server to remember
you or not whether you are logged in or not.

On Apr 19, 12:57 am, Adi  wrote:
> Hi all,
>
> In my application, the session id seems to be getting re-used across
> different sessions.
>
> To explain:
>
> Login 1:
> ---
> print str(session) on user/logout shows the following:
>
>  bcba-25bc46eac3ce', '_formkey[login]': '2af20030-f787-4623-851d-
> e823988a4df2', '_formkey[client_create]': 'd4f4a845-f6e1-403a-9e11-
> b92d2da1b023', '_formkey[job_create]':
> 'c3325e1c-3f1d-409d-875b-240a8026f168', 'flash': None, 'auth':
>  'registration_key': '', 'incorrect_login_count': 0, 'email':
> 'aditya.sa...@gmail.com', 'reset_password_key': '',
> 'last_password_change': datetime.datetime(2010, 4, 1, 15, 16, 13),
> 'password':
> '9db266ab73d140f31b9ba732110c956673c5c9de84918842fd5f3759206508ea437fd7ad90242cf185b52b0f0bc53593b408b729b735f2bb8305963de8386c93',
> 'account_locked': False, 'id': 1}>, 'last_visit':
> datetime.datetime(2010, 4, 19, 11, 18, 37, 417024), 'remember': False}
>
> >}>
>
> Login 2:
> 
>  bcba-25bc46eac3ce', '_formkey[login]': '9e0813ad-41f5-4c1d-8634-
> b6aa6dd6faf2', '_formkey[client_create]': 'd4f4a845-f6e1-403a-9e11-
> b92d2da1b023', '_formkey[job_create]': '1424bef4-2a3e-43d2-8a6f-
> be6d91098e88', 'flash': None, 'auth':  'user':  '9db266ab73d140f31b9ba732110c956673c5c9de84918842fd5f3759206508ea437fd7ad90242cf185b52b0f0bc53593b408b729b735f2bb8305963de8386c93',
> 'incorrect_login_count': 0, 'id': 1, 'reset_password_key': '',
> 'last_password_change': datetime.datetime(2010, 4, 1, 15, 16, 13),
> 'registration_key': '', 'account_locked': False, 'email':
> 'aditya.sa...@gmail.com'}>, 'last_visit': datetime.datetime(2010, 4,
> 19, 11, 20, 1, 154791), 'remember': False}>}>
>
> Now I have set expiration auth.settings.expire=600 . Now someone
> reviewing security of my application said that having the same session
> id can allow someone to "hijack" the session. How can I cause a
> completely different session id for a user after every new login?
>
> Sorry my knowledge of this is quite limited. Would appreciate any
> insights here.
>
> Thanks,
> Aditya
>
> --
> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Creating a new auth session

2010-04-19 Thread mdipierro
fbconnect has not been integrated with Auth. It would be easy to do
but has not been done yet.

On Apr 19, 2:42 am, Rohan  wrote:
> hi Jon,
>
> Can you please share updates on integration between fbconnect and
> auth.user()?
>
> Thanks
>
> On Feb 2, 4:34 pm, Jon Romero  wrote:
>
>
>
> > But then how auth.user is updated?
>
> > >All auth does on successful login is:
> > >from gluon.storage import Storage
> > >session.auth=Storage()
> > >session.auth.user = db(db.auth_user.id==logged_in_user_id).select
> > ().first()
> > >session.auth.user_id = session.auth.user.id
> > >session.auth.last_visit = request.now
> > >set session.auth=None on logout.
>
> > > >>> So, how can Icreatea new session programmatically (like the login
> > > >>> page does)?
>
> > > >> --
> > > >> Alejandro Fanjul Fdez.
> > > >> alex.fan...@gmail.comwww.mhproject.org
>
> > > --
> > > Alejandro Fanjul Fdez.
> > > alex.fan...@gmail.comwww.mhproject.org
>
> --
> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Customizing Retrieve password process

2010-04-19 Thread mdipierro
Yes.

auth.settings.reset_password_requires_verification = True

On Apr 19, 5:10 am, Rohan  wrote:
> Hi All,
>
> Currently my retrieve password application sends new password directly
> to user. Anyone can reset password of any other user as long as they
> know the email id. So I want to customize the process and want to send
> a mail to user asking user to verify email and reset password from
> some link provided in that page something like verification of email
> while registering.
>
> Any pointers?
>
> Thanks
> Rohan
>
> --
> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Creating a new auth session

2010-04-19 Thread Jon Romero
actually it is :) I just haven't got the time to upgrade the code :\

You can see that is FULLY integrated on this site: http://beyourstar.gr

After facebook login, you get an auth.user :D

On Apr 19, 5:21 pm, mdipierro  wrote:
> fbconnect has not been integrated with Auth. It would be easy to do
> but has not been done yet.
>
> On Apr 19, 2:42 am, Rohan  wrote:
>
>
>
> > hi Jon,
>
> > Can you please share updates on integration between fbconnect and
> > auth.user()?
>
> > Thanks
>
> > On Feb 2, 4:34 pm, Jon Romero  wrote:
>
> > > But then how auth.user is updated?
>
> > > >All auth does on successful login is:
> > > >from gluon.storage import Storage
> > > >session.auth=Storage()
> > > >session.auth.user = db(db.auth_user.id==logged_in_user_id).select
> > > ().first()
> > > >session.auth.user_id = session.auth.user.id
> > > >session.auth.last_visit = request.now
> > > >set session.auth=None on logout.
>
> > > > >>> So, how can Icreatea new session programmatically (like the login
> > > > >>> page does)?
>
> > > > >> --
> > > > >> Alejandro Fanjul Fdez.
> > > > >> alex.fan...@gmail.comwww.mhproject.org
>
> > > > --
> > > > Alejandro Fanjul Fdez.
> > > > alex.fan...@gmail.comwww.mhproject.org
>
> > --
> > Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Proposing a web2py Community spring.

2010-04-19 Thread mdipierro
I am all for it but I would focus on

>-  develop apps (a better cms, twitter clones..)
>-  write howto's at your blogs

and not on

>-  fixing bugs

Because bugs are normally fixed within 24 hours anyway and I would not
want people to fix things that they think are bugs but may not be.

>-  making improvement and new features

Here the issue is not coding but design.

Massimo


On Apr 19, 8:14 am, Albert Abril  wrote:
> Hi there!
>
> It's known that other communities like rails and django do sprints.
> Not sure if here has been one time ago, but for what i read i think that no.
>
> I would to ask here to the web2py like to do a sprint.
> We could suggest subjects to focus, as:
>
>    -  fixing bugs
>    -  making improvement and new features
>    -  develop apps (a better cms, twitter clones..)
>    -  write howto's at your blogs
>
> What do you think?
>
> Regards!
>
> --
> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: creating links to '#blah'

2010-04-19 Thread mdipierro
NOO!

URL(r=request, f='gripe',anchor=comments,args=gripe.id)



On Apr 19, 9:12 am, Thadeus Burgess  wrote:
> You probably want,
>
> XML('#comments', sanitize=False)
>
> --
> Thadeus
>
> On Mon, Apr 19, 2010 at 7:38 AM, G. Clifford Williams
>
>  wrote:
> > I'm trying to figure out how to get links created in web2py that point to 
> > an anchor name here is the code I'm using:
>
> >            {{=DIV(SPAN(gripe.created_on, _class='gripe-date'),
> >                    A(SPAN(SPAN('Comments:'),
> >                            SPAN(gripe.comments, _class='comment-number'),
> >                            _class='comment-count'),
> >                            _href=URL(r=request, f='gripe',
> >                                                args=[gripe.id,  
> > XML('#comments')] )),
> >                    _class='gripe-footer')}}
>
> > from this I was hoping to get a link like:
> >http://localhost:8081/init/default/gripe/9/#comments
>
> > but instead I got :
> >http://localhost:8081/init/default/gripe/9/%23comments
>
> > I should mention that this is on GAE SDK and I have not tried it standalone 
> > (yet).
>
> > Any help would be appreciated
>
> > --
> > Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Uploaded file streaming

2010-04-19 Thread Dragonfyre13
That's much better. Thanks!

On Apr 16, 2:04 pm, mdipierro  wrote:
> never hardcode a path:
>
> import os
>
> return
> response.stream(os.path.join(request.application,'uploads',rows[0].filedata 
> ),'rb'))
>
> response stream makes sure that RANGE request are also supported.
>
> On Apr 16, 12:57 pm, Dragonfyre13  wrote:
>
>
>
> > updated that one line to this, but it's not any better, just slightly
> > more portable. Any insights?
>
> > return open("./applications/" + request.application + "/uploads/" +
> > rows[0].filedata).read()
>
> > On Apr 16, 12:49 pm, Dragonfyre13  wrote:
>
> > > I want to be able to stream a file that's uploaded via an upload
> > > field. So far, I haven't really found a way to do this, beyond
> > > grabbing the file name out of filedata, and then sticking static
> > > directory path on the front, which is both kludgy, and I have to think
> > > the wrong way of going about it. Here's what I've got:
>
> > > def play():
> > >     response.headers["Content-Type"] = "audio/x-vox"
> > >     response.headers["Content-Disposition"] = "attachment; filename="
> > > + request.args[0] + '.vox'
> > >     rows = db(db.audio_files.playname ==
> > > request.args[0]).select(db.audio_files.ALL)
> > >     if len(rows):
> > >         return open("/opt/web2py/applications/myapp/uploads/" +
> > > rows[0].filedata).read()
> > >     else:
> > >         raise ValueError, "Passed incorrect playname: " +
> > > str(request.args[0])
>
> > > Essentially, I have another controller uploading to the DB under
> > > audio_files, and sticking a "playname" in the database as a reference
> > > to that file. I can then pass the "playfile" name into this function
> > > in order to get it to return the data out of that file handed back.
>
> > > Here's the problem. Right now, I've got the directory path prepended
> > > statically. That's bad in a big way. Second, there's no sanitation,
> > > and minimal error handling. That will be cleaned up once I get it
> > > working with an actual solution, rather than this hackish thing.
>
> > > Basically, I expect that there's something other than
> > > response.download that will give me the actual data for a file. I
> > > tried response.download, but it doesn't let me set the content-type,
> > > or content-disposition (that's all set by it, overriding my header
> > > info). There has to be something that says "take the data from this
> > > database entry, as a file object", I'm just looking for what that is.
>
> > > I then want to be able to store back into it, but that's another point
> > > not covered above, and I would assume I can just overwrite the old
> > > file data, or just update the field in the DB. Perhaps if someone is
> > > tackling the previous question, they can give this one a go too?
>
> > > --
> > > Subscription 
> > > settings:http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: storing sessions for auth users

2010-04-19 Thread Thadeus Burgess
Or have a "settings" table that is linked by user id? They only get
the site customizations if they are logged in?

--
Thadeus





On Mon, Apr 19, 2010 at 8:01 AM, selecta  wrote:
> that should work
>
> On Apr 19, 1:06 pm, Jason Brower  wrote:
>> On the same lines, I wonder if someone could simply pickle everything is
>> session and save it in teh database under there user id.
>> BR,
>> Jason
>>
>>
>>
>>
>>
>> On Mon, 2010-04-19 at 03:18 -0700, selecta wrote:
>> > I wonder what is the best way to store session of auth users
>>
>> > What I want is to retrieve an old session of a user when he loges in
>> > again (restoring all his customizations etc)
>> > To achieve this I could
>> > A) store the session in a table once the user loges out, but then I
>> > would loose changes if the session just expires because the user never
>> > logged out (right?)
>> > B) I could modify the session object to save itself in the database as
>> > soon as it is changed
>>
>> > B) sounds nicer, but how to do that, maybe somebody already did that?
>> > some help would be nice
>>
>> --
>> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en
>


[web2py] Re: Creating a new auth session

2010-04-19 Thread mdipierro
wow? Is this implemented as a gluon/contrib/login_method?

On Apr 19, 9:26 am, Jon Romero  wrote:
> actually it is :) I just haven't got the time to upgrade the code :\
>
> You can see that is FULLY integrated on this site:http://beyourstar.gr
>
> After facebook login, you get an auth.user :D
>
> On Apr 19, 5:21 pm, mdipierro  wrote:
>
> > fbconnect has not been integrated with Auth. It would be easy to do
> > but has not been done yet.
>
> > On Apr 19, 2:42 am, Rohan  wrote:
>
> > > hi Jon,
>
> > > Can you please share updates on integration between fbconnect and
> > > auth.user()?
>
> > > Thanks
>
> > > On Feb 2, 4:34 pm, Jon Romero  wrote:
>
> > > > But then how auth.user is updated?
>
> > > > >All auth does on successful login is:
> > > > >from gluon.storage import Storage
> > > > >session.auth=Storage()
> > > > >session.auth.user = db(db.auth_user.id==logged_in_user_id).select
> > > > ().first()
> > > > >session.auth.user_id = session.auth.user.id
> > > > >session.auth.last_visit = request.now
> > > > >set session.auth=None on logout.
>
> > > > > >>> So, how can Icreatea new session programmatically (like the login
> > > > > >>> page does)?
>
> > > > > >> --
> > > > > >> Alejandro Fanjul Fdez.
> > > > > >> alex.fan...@gmail.comwww.mhproject.org
>
> > > > > --
> > > > > Alejandro Fanjul Fdez.
> > > > > alex.fan...@gmail.comwww.mhproject.org
>
> > > --
> > > Subscription 
> > > settings:http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] creating links to '#blah'

2010-04-19 Thread Jonathan Lundell
On Apr 19, 2010, at 5:38 AM, G. Clifford Williams wrote:

> I'm trying to figure out how to get links created in web2py that point to an 
> anchor name here is the code I'm using: 
> 
>{{=DIV(SPAN(gripe.created_on, _class='gripe-date'), 
>A(SPAN(SPAN('Comments:'),
>SPAN(gripe.comments, _class='comment-number'),
>_class='comment-count'),
>_href=URL(r=request, f='gripe',
>args=[gripe.id,  
> XML('#comments')] )),
>_class='gripe-footer')}}
> 
> 
> from this I was hoping to get a link like: 
> http://localhost:8081/init/default/gripe/9/#comments
> 
> but instead I got :
> http://localhost:8081/init/default/gripe/9/%23comments

Try

   _href=URL(r=request, f='gripe',
   args=[gripe.id], 
anchor='comments' )),

Which should get you something like this (note no slash before the anchor):

http://localhost:8081/init/default/gripe/9#comments

-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: Uploaded file streaming

2010-04-19 Thread Thadeus Burgess
Also, you can set the X-Sendfile header if your webserver supports it.

Basically, you set this header as the location of the file you want to
serve, the webserver will then discard everything in response.body,
and serve the file itself. You get the benefits of back-end
authorization, and the speed of your web server doing the streaming.

--
Thadeus





On Mon, Apr 19, 2010 at 9:31 AM, Dragonfyre13  wrote:
> That's much better. Thanks!
>
> On Apr 16, 2:04 pm, mdipierro  wrote:
>> never hardcode a path:
>>
>> import os
>>
>> return
>> response.stream(os.path.join(request.application,'uploads',rows[0].filedata 
>> ),'rb'))
>>
>> response stream makes sure that RANGE request are also supported.
>>
>> On Apr 16, 12:57 pm, Dragonfyre13  wrote:
>>
>>
>>
>> > updated that one line to this, but it's not any better, just slightly
>> > more portable. Any insights?
>>
>> > return open("./applications/" + request.application + "/uploads/" +
>> > rows[0].filedata).read()
>>
>> > On Apr 16, 12:49 pm, Dragonfyre13  wrote:
>>
>> > > I want to be able to stream a file that's uploaded via an upload
>> > > field. So far, I haven't really found a way to do this, beyond
>> > > grabbing the file name out of filedata, and then sticking static
>> > > directory path on the front, which is both kludgy, and I have to think
>> > > the wrong way of going about it. Here's what I've got:
>>
>> > > def play():
>> > >     response.headers["Content-Type"] = "audio/x-vox"
>> > >     response.headers["Content-Disposition"] = "attachment; filename="
>> > > + request.args[0] + '.vox'
>> > >     rows = db(db.audio_files.playname ==
>> > > request.args[0]).select(db.audio_files.ALL)
>> > >     if len(rows):
>> > >         return open("/opt/web2py/applications/myapp/uploads/" +
>> > > rows[0].filedata).read()
>> > >     else:
>> > >         raise ValueError, "Passed incorrect playname: " +
>> > > str(request.args[0])
>>
>> > > Essentially, I have another controller uploading to the DB under
>> > > audio_files, and sticking a "playname" in the database as a reference
>> > > to that file. I can then pass the "playfile" name into this function
>> > > in order to get it to return the data out of that file handed back.
>>
>> > > Here's the problem. Right now, I've got the directory path prepended
>> > > statically. That's bad in a big way. Second, there's no sanitation,
>> > > and minimal error handling. That will be cleaned up once I get it
>> > > working with an actual solution, rather than this hackish thing.
>>
>> > > Basically, I expect that there's something other than
>> > > response.download that will give me the actual data for a file. I
>> > > tried response.download, but it doesn't let me set the content-type,
>> > > or content-disposition (that's all set by it, overriding my header
>> > > info). There has to be something that says "take the data from this
>> > > database entry, as a file object", I'm just looking for what that is.
>>
>> > > I then want to be able to store back into it, but that's another point
>> > > not covered above, and I would assume I can just overwrite the old
>> > > file data, or just update the field in the DB. Perhaps if someone is
>> > > tackling the previous question, they can give this one a go too?
>>
>> > > --
>> > > Subscription 
>> > > settings:http://groups.google.com/group/web2py/subscribe?hl=en
>


Re: [web2py] Re: Proposing a web2py Community spring.

2010-04-19 Thread Albert Abril
I agree with bugs, because the naturallity of opensource, it was only as
proposal of finding bugs as others communities do.
In all the points, personally my favourite is on dev apps.
Also, I understand that write howto's, or making great layouts (design)
would be so much useful too.

Maybe something like: "web2py app dev weekend" (or some fancy tittle).

What do you think, people?



On Mon, Apr 19, 2010 at 4:28 PM, mdipierro  wrote:

> I am all for it but I would focus on
>
> >-  develop apps (a better cms, twitter clones..)
> >-  write howto's at your blogs
>
> and not on
>
> >-  fixing bugs
>
> Because bugs are normally fixed within 24 hours anyway and I would not
> want people to fix things that they think are bugs but may not be.
>
> >-  making improvement and new features
>
> Here the issue is not coding but design.
>
> Massimo
>
>
> On Apr 19, 8:14 am, Albert Abril  wrote:
> > Hi there!
> >
> > It's known that other communities like rails and django do sprints.
> > Not sure if here has been one time ago, but for what i read i think that
> no.
> >
> > I would to ask here to the web2py like to do a sprint.
> > We could suggest subjects to focus, as:
> >
> >-  fixing bugs
> >-  making improvement and new features
> >-  develop apps (a better cms, twitter clones..)
> >-  write howto's at your blogs
> >
> > What do you think?
> >
> > Regards!
> >
> > --
> > Subscription settings:
> http://groups.google.com/group/web2py/subscribe?hl=en
>


[web2py] Re: Creating a new auth session

2010-04-19 Thread Jon Romero
sadly no :(

Take a look at it here:
http://codepad.org/tadGosTd

I am using my prototype activerecord for some database calls (that
should explain the find_by_id).

On Apr 19, 5:31 pm, mdipierro  wrote:
> wow? Is this implemented as a gluon/contrib/login_method?
>
> On Apr 19, 9:26 am, Jon Romero  wrote:
>
>
>
> > actually it is :) I just haven't got the time to upgrade the code :\
>
> > You can see that is FULLY integrated on this site:http://beyourstar.gr
>
> > After facebook login, you get an auth.user :D
>
> > On Apr 19, 5:21 pm, mdipierro  wrote:
>
> > > fbconnect has not been integrated with Auth. It would be easy to do
> > > but has not been done yet.
>
> > > On Apr 19, 2:42 am, Rohan  wrote:
>
> > > > hi Jon,
>
> > > > Can you please share updates on integration between fbconnect and
> > > > auth.user()?
>
> > > > Thanks
>
> > > > On Feb 2, 4:34 pm, Jon Romero  wrote:
>
> > > > > But then how auth.user is updated?
>
> > > > > >All auth does on successful login is:
> > > > > >from gluon.storage import Storage
> > > > > >session.auth=Storage()
> > > > > >session.auth.user = db(db.auth_user.id==logged_in_user_id).select
> > > > > ().first()
> > > > > >session.auth.user_id = session.auth.user.id
> > > > > >session.auth.last_visit = request.now
> > > > > >set session.auth=None on logout.
>
> > > > > > >>> So, how can Icreatea new session programmatically (like the 
> > > > > > >>> login
> > > > > > >>> page does)?
>
> > > > > > >> --
> > > > > > >> Alejandro Fanjul Fdez.
> > > > > > >> alex.fan...@gmail.comwww.mhproject.org
>
> > > > > > --
> > > > > > Alejandro Fanjul Fdez.
> > > > > > alex.fan...@gmail.comwww.mhproject.org
>
> > > > --
> > > > Subscription 
> > > > settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] 1.77.1 is OUT

2010-04-19 Thread mdipierro
#1.77.1
Replaced CherryPy with Rocket web server, thanks Tim
CacheOnDisk allows to specify a folder
IS_DATE/DATETIME can handle any year since 0
SQLTABLE(...,headers='fieldname:capitalize')
Field().with_alias, thanks Nathan and Mengu
has_membership(group=...,role=...), thank Jonathan
db.define_table(username=True), thanks Jonathan
gluon.tools.prettydate
can specify hostname in routes_out (same syntax as routes in), thanks
Martin
db.table.bulk_insert([...records...]) now works on GAE, thanks Jon
IS_EMAIL validates on 'localhost', thanks Jonathan
welcome/views/layout.html uses ez.css, thanks Yarko
mail attachments support utf8, thanks szimszon
works with PyPy, thanks Joe
better Firebird support, thanks Jose
better Oracle support, thanks Gabriele
cron supports days of week
SQLFORM(...,formstyle="table3cols") or "table2cols" or "divs" or "ul"
crud.settings.formstyle
web2py.py -f folder allows to specify locations of applications,
thanks Iceberg
better/faster regex in template works in Jython
fixed lots of small bugs


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Creating a new auth session

2010-04-19 Thread mdipierro
I do not see this using db.auth_user at all. Did you rename it
db.users?

On Apr 19, 9:50 am, Jon Romero  wrote:
> sadly no :(
>
> Take a look at it here:http://codepad.org/tadGosTd
>
> I am using my prototype activerecord for some database calls (that
> should explain the find_by_id).
>
> On Apr 19, 5:31 pm, mdipierro  wrote:
>
> > wow? Is this implemented as a gluon/contrib/login_method?
>
> > On Apr 19, 9:26 am, Jon Romero  wrote:
>
> > > actually it is :) I just haven't got the time to upgrade the code :\
>
> > > You can see that is FULLY integrated on this site:http://beyourstar.gr
>
> > > After facebook login, you get an auth.user :D
>
> > > On Apr 19, 5:21 pm, mdipierro  wrote:
>
> > > > fbconnect has not been integrated with Auth. It would be easy to do
> > > > but has not been done yet.
>
> > > > On Apr 19, 2:42 am, Rohan  wrote:
>
> > > > > hi Jon,
>
> > > > > Can you please share updates on integration between fbconnect and
> > > > > auth.user()?
>
> > > > > Thanks
>
> > > > > On Feb 2, 4:34 pm, Jon Romero  wrote:
>
> > > > > > But then how auth.user is updated?
>
> > > > > > >All auth does on successful login is:
> > > > > > >from gluon.storage import Storage
> > > > > > >session.auth=Storage()
> > > > > > >session.auth.user = db(db.auth_user.id==logged_in_user_id).select
> > > > > > ().first()
> > > > > > >session.auth.user_id = session.auth.user.id
> > > > > > >session.auth.last_visit = request.now
> > > > > > >set session.auth=None on logout.
>
> > > > > > > >>> So, how can Icreatea new session programmatically (like the 
> > > > > > > >>> login
> > > > > > > >>> page does)?
>
> > > > > > > >> --
> > > > > > > >> Alejandro Fanjul Fdez.
> > > > > > > >> alex.fan...@gmail.comwww.mhproject.org
>
> > > > > > > --
> > > > > > > Alejandro Fanjul Fdez.
> > > > > > > alex.fan...@gmail.comwww.mhproject.org
>
> > > > > --
> > > > > Subscription 
> > > > > settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Creating a new auth session

2010-04-19 Thread Jon Romero
yes, sorry :)

db.define_table('users',
Field('username', 'string', unique=True, label="Username [*]"),
Field('password', 'password', requires=CRYPT(), readable=False,
label="Password [*]"),
Field('registration_key',length=128, writable=False, readable=False),
Field('first_name', default=None, length=128, writable=False,
readable=False),
Field('last_name', default=None, length=128, writable=False,
readable=False),
Field('email', length=128, unique=True, label="Email [*]"),
Field('age', 'integer',  default=18),
Field('name', length=32, default="Anonymous"),
Field('fb_id', 'integer', default=0, writable=False, readable=False),

 and so on.

When I find some time, I have to make a proper slice.


On Apr 19, 5:56 pm, mdipierro  wrote:
> I do not see this using db.auth_user at all. Did you rename it
> db.users?
>
> On Apr 19, 9:50 am, Jon Romero  wrote:
>
>
>
> > sadly no :(
>
> > Take a look at it here:http://codepad.org/tadGosTd
>
> > I am using my prototype activerecord for some database calls (that
> > should explain the find_by_id).
>
> > On Apr 19, 5:31 pm, mdipierro  wrote:
>
> > > wow? Is this implemented as a gluon/contrib/login_method?
>
> > > On Apr 19, 9:26 am, Jon Romero  wrote:
>
> > > > actually it is :) I just haven't got the time to upgrade the code :\
>
> > > > You can see that is FULLY integrated on this site:http://beyourstar.gr
>
> > > > After facebook login, you get an auth.user :D
>
> > > > On Apr 19, 5:21 pm, mdipierro  wrote:
>
> > > > > fbconnect has not been integrated with Auth. It would be easy to do
> > > > > but has not been done yet.
>
> > > > > On Apr 19, 2:42 am, Rohan  wrote:
>
> > > > > > hi Jon,
>
> > > > > > Can you please share updates on integration between fbconnect and
> > > > > > auth.user()?
>
> > > > > > Thanks
>
> > > > > > On Feb 2, 4:34 pm, Jon Romero  wrote:
>
> > > > > > > But then how auth.user is updated?
>
> > > > > > > >All auth does on successful login is:
> > > > > > > >from gluon.storage import Storage
> > > > > > > >session.auth=Storage()
> > > > > > > >session.auth.user = db(db.auth_user.id==logged_in_user_id).select
> > > > > > > ().first()
> > > > > > > >session.auth.user_id = session.auth.user.id
> > > > > > > >session.auth.last_visit = request.now
> > > > > > > >set session.auth=None on logout.
>
> > > > > > > > >>> So, how can Icreatea new session programmatically (like the 
> > > > > > > > >>> login
> > > > > > > > >>> page does)?
>
> > > > > > > > >> --
> > > > > > > > >> Alejandro Fanjul Fdez.
> > > > > > > > >> alex.fan...@gmail.comwww.mhproject.org
>
> > > > > > > > --
> > > > > > > > Alejandro Fanjul Fdez.
> > > > > > > > alex.fan...@gmail.comwww.mhproject.org
>
> > > > > > --
> > > > > > Subscription 
> > > > > > settings:http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: Proposing a web2py Community spring.

2010-04-19 Thread Albert Abril
Of course, where i told *spring* i would mean *sprint*.
Sorry for my.. (not agile) english.

On Mon, Apr 19, 2010 at 4:39 PM, Albert Abril wrote:

> I agree with bugs, because the naturallity of opensource, it was only as
> proposal of finding bugs as others communities do.
> In all the points, personally my favourite is on dev apps.
> Also, I understand that write howto's, or making great layouts (design)
> would be so much useful too.
>
> Maybe something like: "web2py app dev weekend" (or some fancy tittle).
>
> What do you think, people?
>
>
>
>
> On Mon, Apr 19, 2010 at 4:28 PM, mdipierro wrote:
>
>> I am all for it but I would focus on
>>
>> >-  develop apps (a better cms, twitter clones..)
>> >-  write howto's at your blogs
>>
>> and not on
>>
>> >-  fixing bugs
>>
>> Because bugs are normally fixed within 24 hours anyway and I would not
>> want people to fix things that they think are bugs but may not be.
>>
>> >-  making improvement and new features
>>
>> Here the issue is not coding but design.
>>
>> Massimo
>>
>>
>> On Apr 19, 8:14 am, Albert Abril  wrote:
>> > Hi there!
>> >
>> > It's known that other communities like rails and django do sprints.
>> > Not sure if here has been one time ago, but for what i read i think that
>> no.
>> >
>> > I would to ask here to the web2py like to do a sprint.
>> > We could suggest subjects to focus, as:
>> >
>> >-  fixing bugs
>> >-  making improvement and new features
>> >-  develop apps (a better cms, twitter clones..)
>> >-  write howto's at your blogs
>> >
>> > What do you think?
>> >
>> > Regards!
>> >
>> > --
>> > Subscription settings:
>> http://groups.google.com/group/web2py/subscribe?hl=en
>>
>
>


Re: [web2py] Customizing Retrieve password process

2010-04-19 Thread Abdul R. Gani
Same weakness exists.


On Mon, Apr 19, 2010 at 12:10 PM, Rohan  wrote:
> Hi All,
>
> Currently my retrieve password application sends new password directly
> to user. Anyone can reset password of any other user as long as they
> know the email id. So I want to customize the process and want to send
> a mail to user asking user to verify email and reset password from
> some link provided in that page something like verification of email
> while registering.
>
> Any pointers?
>
> Thanks
> Rohan
>
>
> --
> Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en
>



-- 
--
InfoStream Technologies
ab...@infostream.co.za
+27-82-888-1193
http://www.infostream.co.za


[web2py] Re: Customizing Retrieve password process

2010-04-19 Thread mdipierro
What link are you using?

You should be using

http:///user/request_reset_password

and you should

auth.settings.actions_disabled=['retrieve_password']

On Apr 19, 9:22 am, "Abdul R. Gani"  wrote:
> Same weakness exists.
>
>
>
> On Mon, Apr 19, 2010 at 12:10 PM, Rohan  wrote:
> > Hi All,
>
> > Currently my retrieve password application sends new password directly
> > to user. Anyone can reset password of any other user as long as they
> > know the email id. So I want to customize the process and want to send
> > a mail to user asking user to verify email and reset password from
> > some link provided in that page something like verification of email
> > while registering.
>
> > Any pointers?
>
> > Thanks
> > Rohan
>
> > --
> > Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en
>
> --
> --
> InfoStream Technologies
> ab...@infostream.co.za
> +27-82-888-1193http://www.infostream.co.za


[web2py] Re: Creating a new auth session

2010-04-19 Thread mdipierro
OK. when you make the slice please call it auth_user. ;-)

On Apr 19, 10:00 am, Jon Romero  wrote:
> yes, sorry :)
>
> db.define_table('users',
>         Field('username', 'string', unique=True, label="Username [*]"),
>         Field('password', 'password', requires=CRYPT(), readable=False,
> label="Password [*]"),
>         Field('registration_key',length=128, writable=False, readable=False),
>         Field('first_name', default=None, length=128, writable=False,
> readable=False),
>         Field('last_name', default=None, length=128, writable=False,
> readable=False),
>         Field('email', length=128, unique=True, label="Email [*]"),
>         Field('age', 'integer',  default=18),
>         Field('name', length=32, default="Anonymous"),
>         Field('fb_id', 'integer', default=0, writable=False, readable=False),
>
>      and so on.
>
> When I find some time, I have to make a proper slice.
>
> On Apr 19, 5:56 pm, mdipierro  wrote:
>
> > I do not see this using db.auth_user at all. Did you rename it
> > db.users?
>
> > On Apr 19, 9:50 am, Jon Romero  wrote:
>
> > > sadly no :(
>
> > > Take a look at it here:http://codepad.org/tadGosTd
>
> > > I am using my prototype activerecord for some database calls (that
> > > should explain the find_by_id).
>
> > > On Apr 19, 5:31 pm, mdipierro  wrote:
>
> > > > wow? Is this implemented as a gluon/contrib/login_method?
>
> > > > On Apr 19, 9:26 am, Jon Romero  wrote:
>
> > > > > actually it is :) I just haven't got the time to upgrade the code :\
>
> > > > > You can see that is FULLY integrated on this site:http://beyourstar.gr
>
> > > > > After facebook login, you get an auth.user :D
>
> > > > > On Apr 19, 5:21 pm, mdipierro  wrote:
>
> > > > > > fbconnect has not been integrated with Auth. It would be easy to do
> > > > > > but has not been done yet.
>
> > > > > > On Apr 19, 2:42 am, Rohan  wrote:
>
> > > > > > > hi Jon,
>
> > > > > > > Can you please share updates on integration between fbconnect and
> > > > > > > auth.user()?
>
> > > > > > > Thanks
>
> > > > > > > On Feb 2, 4:34 pm, Jon Romero  wrote:
>
> > > > > > > > But then how auth.user is updated?
>
> > > > > > > > >All auth does on successful login is:
> > > > > > > > >from gluon.storage import Storage
> > > > > > > > >session.auth=Storage()
> > > > > > > > >session.auth.user = 
> > > > > > > > >db(db.auth_user.id==logged_in_user_id).select
> > > > > > > > ().first()
> > > > > > > > >session.auth.user_id = session.auth.user.id
> > > > > > > > >session.auth.last_visit = request.now
> > > > > > > > >set session.auth=None on logout.
>
> > > > > > > > > >>> So, how can Icreatea new session programmatically (like 
> > > > > > > > > >>> the login
> > > > > > > > > >>> page does)?
>
> > > > > > > > > >> --
> > > > > > > > > >> Alejandro Fanjul Fdez.
> > > > > > > > > >> alex.fan...@gmail.comwww.mhproject.org
>
> > > > > > > > > --
> > > > > > > > > Alejandro Fanjul Fdez.
> > > > > > > > > alex.fan...@gmail.comwww.mhproject.org
>
> > > > > > > --
> > > > > > > Subscription 
> > > > > > > settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Creating a new auth session

2010-04-19 Thread Jon Romero
Will do :D

On Apr 19, 6:10 pm, mdipierro  wrote:
> OK. when you make the slice please call it auth_user. ;-)
>
> On Apr 19, 10:00 am, Jon Romero  wrote:
>
>
>
> > yes, sorry :)
>
> > db.define_table('users',
> >         Field('username', 'string', unique=True, label="Username [*]"),
> >         Field('password', 'password', requires=CRYPT(), readable=False,
> > label="Password [*]"),
> >         Field('registration_key',length=128, writable=False, 
> > readable=False),
> >         Field('first_name', default=None, length=128, writable=False,
> > readable=False),
> >         Field('last_name', default=None, length=128, writable=False,
> > readable=False),
> >         Field('email', length=128, unique=True, label="Email [*]"),
> >         Field('age', 'integer',  default=18),
> >         Field('name', length=32, default="Anonymous"),
> >         Field('fb_id', 'integer', default=0, writable=False, 
> > readable=False),
>
> >      and so on.
>
> > When I find some time, I have to make a proper slice.
>
> > On Apr 19, 5:56 pm, mdipierro  wrote:
>
> > > I do not see this using db.auth_user at all. Did you rename it
> > > db.users?
>
> > > On Apr 19, 9:50 am, Jon Romero  wrote:
>
> > > > sadly no :(
>
> > > > Take a look at it here:http://codepad.org/tadGosTd
>
> > > > I am using my prototype activerecord for some database calls (that
> > > > should explain the find_by_id).
>
> > > > On Apr 19, 5:31 pm, mdipierro  wrote:
>
> > > > > wow? Is this implemented as a gluon/contrib/login_method?
>
> > > > > On Apr 19, 9:26 am, Jon Romero  wrote:
>
> > > > > > actually it is :) I just haven't got the time to upgrade the code :\
>
> > > > > > You can see that is FULLY integrated on this 
> > > > > > site:http://beyourstar.gr
>
> > > > > > After facebook login, you get an auth.user :D
>
> > > > > > On Apr 19, 5:21 pm, mdipierro  wrote:
>
> > > > > > > fbconnect has not been integrated with Auth. It would be easy to 
> > > > > > > do
> > > > > > > but has not been done yet.
>
> > > > > > > On Apr 19, 2:42 am, Rohan  wrote:
>
> > > > > > > > hi Jon,
>
> > > > > > > > Can you please share updates on integration between fbconnect 
> > > > > > > > and
> > > > > > > > auth.user()?
>
> > > > > > > > Thanks
>
> > > > > > > > On Feb 2, 4:34 pm, Jon Romero  wrote:
>
> > > > > > > > > But then how auth.user is updated?
>
> > > > > > > > > >All auth does on successful login is:
> > > > > > > > > >from gluon.storage import Storage
> > > > > > > > > >session.auth=Storage()
> > > > > > > > > >session.auth.user = 
> > > > > > > > > >db(db.auth_user.id==logged_in_user_id).select
> > > > > > > > > ().first()
> > > > > > > > > >session.auth.user_id = session.auth.user.id
> > > > > > > > > >session.auth.last_visit = request.now
> > > > > > > > > >set session.auth=None on logout.
>
> > > > > > > > > > >>> So, how can Icreatea new session programmatically (like 
> > > > > > > > > > >>> the login
> > > > > > > > > > >>> page does)?
>
> > > > > > > > > > >> --
> > > > > > > > > > >> Alejandro Fanjul Fdez.
> > > > > > > > > > >> alex.fan...@gmail.comwww.mhproject.org
>
> > > > > > > > > > --
> > > > > > > > > > Alejandro Fanjul Fdez.
> > > > > > > > > > alex.fan...@gmail.comwww.mhproject.org
>
> > > > > > > > --
> > > > > > > > Subscription 
> > > > > > > > settings:http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: can I hook my code to db.connect() ?

2010-04-19 Thread Alexey Nezhdanov
No, I'm all for it. Actually it sounds more like bugfix since atm web2py
can't make datetime queries on Oracle.

On Mon, Apr 19, 2010 at 6:16 PM, mdipierro  wrote:

> There is no hook for this, but should this not be always the default?
> If so I am happy to add it to trunk. Any counterindication?
>
> On Apr 19, 12:32 am, Alexey Nezhdanov  wrote:
> > Hi.
> > Sometimes I have to execute this line prior to making a query:
> > oradb.executesql("ALTER SESSION set NLS_DATE_FORMAT = '-MM-DD
> > HH24:MI:SS';")
> >
> > That is because Oracle by default uses different date format that causes
> my
> > queries to fail.
> > The problem is that doing that in model is incorrect - this should be
> > executed just once for each db connection.
> > Doing that just prior to query is inconvenient and still incorrect - I am
> > probably reusing same connection.
> > Can I somehow tell web2py to execute this sql right after calling
> connect()?
> >
> > Regards
> > Alexey
> >
> > --
> > Subscription settings:
> http://groups.google.com/group/web2py/subscribe?hl=en
>


[web2py] Re: can I hook my code to db.connect() ?

2010-04-19 Thread mdipierro
taking a second look at the source code

self._execute("ALTER SESSION SET NLS_DATE_FORMAT = '-
MM-DD';")
self._execute("ALTER SESSION SET NLS_TIMESTAMP_FORMAT =
'-MM-DD HH24:MI:SS';")

Now you propose adding:

self._execute("ALTER SESSION set NLS_DATE_FORMAT = '-
MM-DD HH24:MI:SS';")

But date does not have HH224, MI, SS, only timestamp does.

On Apr 19, 11:19 am, Alexey Nezhdanov  wrote:
> No, I'm all for it. Actually it sounds more like bugfix since atm web2py
> can't make datetime queries on Oracle.
>
> On Mon, Apr 19, 2010 at 6:16 PM, mdipierro  wrote:
> > There is no hook for this, but should this not be always the default?
> > If so I am happy to add it to trunk. Any counterindication?
>
> > On Apr 19, 12:32 am, Alexey Nezhdanov  wrote:
> > > Hi.
> > > Sometimes I have to execute this line prior to making a query:
> > >     oradb.executesql("ALTER SESSION set NLS_DATE_FORMAT = '-MM-DD
> > > HH24:MI:SS';")
>
> > > That is because Oracle by default uses different date format that causes
> > my
> > > queries to fail.
> > > The problem is that doing that in model is incorrect - this should be
> > > executed just once for each db connection.
> > > Doing that just prior to query is inconvenient and still incorrect - I am
> > > probably reusing same connection.
> > > Can I somehow tell web2py to execute this sql right after calling
> > connect()?
>
> > > Regards
> > > Alexey
>
> > > --
> > > Subscription settings:
> >http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] time data type and sql forms

2010-04-19 Thread dave
Since upgrading to latest version (from prior version)  I can't enter
a time into the sql form using either the time helper object or
manually by typing.  The field back ground show red like an error.

I'm using mysql 5.1.45 with tables using engine=innodb, and a table
definition shown below:

db.define_table('mytable'
 ,Field('aint', 'integer',requires=[IS_INT_IN_RANGE(0, 100)])
 ,Field('adate', 'date')
 ,Field('atime', 'time',notnull=True)
 ,Field('adatetime', 'datetime')
 )

Also the date and datetime helpers are working, but pop up behind the
form instead of on top of the form.

Thanks, Dave


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] http://www.web2py.com doesnt load

2010-04-19 Thread Pystar
Hello guys,
I have noticed for sometime now that I can no longer access
web2py.com. i live in Lagos, Nigeria, and this never used to be a
problem for me. I want to download the current version of web2py
(1.77.1) but cant do so due to this problem. Can anyone please direct
me to any alternative download site for this?
Thanks
Pystar


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] http://www.web2py.com doesnt load

2010-04-19 Thread Thadeus Burgess
Most likely your IP has been blocked by Massimo's aggressive security script.

Until yall can figure out what happened, I have mirrored 1.77.1 here:

http://static.thadeusb.com/web2py%201.77.1/

--
Thadeus





On Mon, Apr 19, 2010 at 1:50 PM, Pystar  wrote:
> Hello guys,
> I have noticed for sometime now that I can no longer access
> web2py.com. i live in Lagos, Nigeria, and this never used to be a
> problem for me. I want to download the current version of web2py
> (1.77.1) but cant do so due to this problem. Can anyone please direct
> me to any alternative download site for this?
> Thanks
> Pystar
>
>
> --
> Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en
>


Re: [web2py] http://www.web2py.com doesnt load

2010-04-19 Thread Cody Harlow
Try from Google Code. It's the dev version though.

http://code.google.com/p/web2py/

On Mon, Apr 19, 2010 at 2:50 PM, Pystar  wrote:

> Hello guys,
> I have noticed for sometime now that I can no longer access
> web2py.com. i live in Lagos, Nigeria, and this never used to be a
> problem for me. I want to download the current version of web2py
> (1.77.1) but cant do so due to this problem. Can anyone please direct
> me to any alternative download site for this?
> Thanks
> Pystar
>
>
> --
> Subscription settings:
> http://groups.google.com/group/web2py/subscribe?hl=en
>


[web2py] web2py 1.77.2 is OUT

2010-04-19 Thread mdipierro
There was a bug in 1.77.1:

the new layout uses ez.css and it changes the z-index of the content.
As a result the date/datetime/time popup appear under the windows.

I have not fixed this but please check it under IE since I did not get
a chance to try that. z-index in IE behaves funny.

Massimo


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: time data type and sql forms

2010-04-19 Thread mdipierro
good catch. fixed in 1.77.2


On Apr 19, 12:14 pm, dave  wrote:
> Since upgrading to latest version (from prior version)  I can't enter
> a time into the sql form using either the time helper object or
> manually by typing.  The field back ground show red like an error.
>
> I'm using mysql 5.1.45 with tables using engine=innodb, and a table
> definition shown below:
>
> db.define_table('mytable'
>      ,Field('aint', 'integer',requires=[IS_INT_IN_RANGE(0, 100)])
>      ,Field('adate', 'date')
>      ,Field('atime', 'time',notnull=True)
>      ,Field('adatetime', 'datetime')
>      )
>
> Also the date and datetime helpers are working, but pop up behind the
> form instead of on top of the form.
>
> Thanks, Dave
>
> --
> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Trouble starting web2py

2010-04-19 Thread szimszon
I can't run it (1.77.1) even if I installed the simplejson 1.9.2 in
virtualenv:

>>> sys.path
['', '/home/szimszon/.virtualenvs/web2py/lib/python2.5/site-packages/
setuptools-0.6c11-py2.5.egg', '/home/szimszon/.virtualenvs/web2py/lib/
python2.5/site-packages/simplejson-1.9.2-py2.5.egg'...

On ápr. 19, 13:58, szimszon  wrote:
> I got the some traceback as before :(
>
> >>> sys.path
>
> ['', '/home/szimszon/.virtualenvs/web2py/lib/python2.5/site-packages/
> setuptools-0.6c11-py2.5.egg', '/usr/lib/pymodules/python2.5', '/home/
> szimszon/.virtualenvs/web2py/lib/python2.5', '/home/
> szimszon/.virtualenvs/web2py/lib/python2.5/plat-linux2', '/home/
> szimszon/.virtualenvs/web2py/lib/python2.5/lib-tk', '/home/
> szimszon/.virtualenvs/web2py/lib/python2.5/lib-dynload', '/usr/lib/
> python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-
> tk', '/home/szimszon/.virtualenvs/web2py/lib/python2.5/site-packages',
> '/usr/local/lib/python2.5/site-packages', '/usr/lib/python2.5/site-
> packages', '/usr/lib/python2.5/site-packages/PIL', '/usr/lib/python2.5/
> site-packages/gst-0.10', '/usr/lib/pymodules/python2.5/gtk-2.0', '/usr/
> lib/python2.5/site-packages/wx-2.6-gtk2-unicode']
>
> On ápr. 19, 13:30, Mathieu Clabaut  wrote:
>
>
>
> > I use 
> > virtualenvwrapperhttp://www.doughellmann.com/docs/virtualenvwrapper/which
> > seems to work like a charm.
>
> > export WORKON_HOME=$HOME/.virtualenvs
> > source /usr/bin/virtualenvwrapper.sh # put those 2 lines in your
> > $HOME/.bashrc
> > mkvirtualenv web2py
>
> > From here, you just have to type :
> > workon web2py
>
> > berfore launching web2py.
>
> > It is not a web2py solution, but it may help in the meanwhile.
>
> > -Mathieu
>
> > On Mon, Apr 19, 2010 at 13:15, szimszon  wrote:
> > > Is there now a quick way to start web2py without removing simplejson
> > > from debian?
>
> > > Tnx.
>
> > > On ápr. 11, 16:23, mdipierro  wrote:
> > > > What's your advice about this?
>
> > > > Out r version of simplejson is patched to serialize dates. We could
> > > > upgrade to the latest and re-patch and for now this problem will go
> > > > away but this is not a long term solution. Clearly we must change
> > > > something in the way simplejson is imported to avoid conflict.
>
> > > > Massimo
>
> > > > On Apr 11, 4:30 am, muybay  wrote:
>
> > > > > I have the issue also. I am going to try this suggestion and possibly
> > > > > diff the two versions (upgraded vs web2py simplejson).
>
> > > > > On Apr 8, 8:00 am, mdipierro  wrote:
>
> > > > > > One solution is to upgrade thesimplejsonthat comes with web2py. The
> > > > > > problem is that the one we use has been modified to handle dates.
>
> > > > > > On Apr 8, 4:27 am, Johann Spies  wrote:
>
> > > > > > > Removing Debian's python-simplejsonhelped me to start web2py again
> > > -
> > > > > > > and broke some other stuff on Debian.
>
> > > > > > > Regards
> > > > > > > Johann
> > > > > > > --
> > > > > > >        "Every good gift and every perfect gift is from above,
> > > > > > >       and cometh down from the Father of lights, with whom
> > > > > > >       is no variableness, neither shadow of turning."
> > > > > > >                              James 1:17
>
> > > --
> > > Subscription settings:
> > >http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Trouble starting web2py

2010-04-19 Thread mdipierro
try copy simplejson into gluon/contrib/simplejson for now.


On Apr 19, 3:23 pm, szimszon  wrote:
> I can't run it (1.77.1) even if I installed the simplejson 1.9.2 in
> virtualenv:
>
> >>> sys.path
>
> ['', '/home/szimszon/.virtualenvs/web2py/lib/python2.5/site-packages/
> setuptools-0.6c11-py2.5.egg', '/home/szimszon/.virtualenvs/web2py/lib/
> python2.5/site-packages/simplejson-1.9.2-py2.5.egg'...
>
> On ápr. 19, 13:58, szimszon  wrote:
>
> > I got the some traceback as before :(
>
> > >>> sys.path
>
> > ['', '/home/szimszon/.virtualenvs/web2py/lib/python2.5/site-packages/
> > setuptools-0.6c11-py2.5.egg', '/usr/lib/pymodules/python2.5', '/home/
> > szimszon/.virtualenvs/web2py/lib/python2.5', '/home/
> > szimszon/.virtualenvs/web2py/lib/python2.5/plat-linux2', '/home/
> > szimszon/.virtualenvs/web2py/lib/python2.5/lib-tk', '/home/
> > szimszon/.virtualenvs/web2py/lib/python2.5/lib-dynload', '/usr/lib/
> > python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-
> > tk', '/home/szimszon/.virtualenvs/web2py/lib/python2.5/site-packages',
> > '/usr/local/lib/python2.5/site-packages', '/usr/lib/python2.5/site-
> > packages', '/usr/lib/python2.5/site-packages/PIL', '/usr/lib/python2.5/
> > site-packages/gst-0.10', '/usr/lib/pymodules/python2.5/gtk-2.0', '/usr/
> > lib/python2.5/site-packages/wx-2.6-gtk2-unicode']
>
> > On ápr. 19, 13:30, Mathieu Clabaut  wrote:
>
> > > I use 
> > > virtualenvwrapperhttp://www.doughellmann.com/docs/virtualenvwrapper/which
> > > seems to work like a charm.
>
> > > export WORKON_HOME=$HOME/.virtualenvs
> > > source /usr/bin/virtualenvwrapper.sh # put those 2 lines in your
> > > $HOME/.bashrc
> > > mkvirtualenv web2py
>
> > > From here, you just have to type :
> > > workon web2py
>
> > > berfore launching web2py.
>
> > > It is not a web2py solution, but it may help in the meanwhile.
>
> > > -Mathieu
>
> > > On Mon, Apr 19, 2010 at 13:15, szimszon  wrote:
> > > > Is there now a quick way to start web2py without removing simplejson
> > > > from debian?
>
> > > > Tnx.
>
> > > > On ápr. 11, 16:23, mdipierro  wrote:
> > > > > What's your advice about this?
>
> > > > > Out r version of simplejson is patched to serialize dates. We could
> > > > > upgrade to the latest and re-patch and for now this problem will go
> > > > > away but this is not a long term solution. Clearly we must change
> > > > > something in the way simplejson is imported to avoid conflict.
>
> > > > > Massimo
>
> > > > > On Apr 11, 4:30 am, muybay  wrote:
>
> > > > > > I have the issue also. I am going to try this suggestion and 
> > > > > > possibly
> > > > > > diff the two versions (upgraded vs web2py simplejson).
>
> > > > > > On Apr 8, 8:00 am, mdipierro  wrote:
>
> > > > > > > One solution is to upgrade thesimplejsonthat comes with web2py. 
> > > > > > > The
> > > > > > > problem is that the one we use has been modified to handle dates.
>
> > > > > > > On Apr 8, 4:27 am, Johann Spies  wrote:
>
> > > > > > > > Removing Debian's python-simplejsonhelped me to start web2py 
> > > > > > > > again
> > > > -
> > > > > > > > and broke some other stuff on Debian.
>
> > > > > > > > Regards
> > > > > > > > Johann
> > > > > > > > --
> > > > > > > >        "Every good gift and every perfect gift is from above,
> > > > > > > >       and cometh down from the Father of lights, with whom
> > > > > > > >       is no variableness, neither shadow of turning."
> > > > > > > >                              James 1:17
>
> > > > --
> > > > Subscription settings:
> > > >http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Trouble starting web2py

2010-04-19 Thread szimszon
Okay, copy "/usr/share/pyshared/simplejson" to gluon/contrib seems to
work for me.

BigTNX. (1.77.2 :)

On ápr. 19, 22:25, mdipierro  wrote:
> try copy simplejson into gluon/contrib/simplejson for now.
>
> On Apr 19, 3:23 pm, szimszon  wrote:
>
>
>
> > I can't run it (1.77.1) even if I installed the simplejson 1.9.2 in
> > virtualenv:
>
> > >>> sys.path
>
> > ['', '/home/szimszon/.virtualenvs/web2py/lib/python2.5/site-packages/
> > setuptools-0.6c11-py2.5.egg', '/home/szimszon/.virtualenvs/web2py/lib/
> > python2.5/site-packages/simplejson-1.9.2-py2.5.egg'...
>
> > On ápr. 19, 13:58, szimszon  wrote:
>
> > > I got the some traceback as before :(
>
> > > >>> sys.path
>
> > > ['', '/home/szimszon/.virtualenvs/web2py/lib/python2.5/site-packages/
> > > setuptools-0.6c11-py2.5.egg', '/usr/lib/pymodules/python2.5', '/home/
> > > szimszon/.virtualenvs/web2py/lib/python2.5', '/home/
> > > szimszon/.virtualenvs/web2py/lib/python2.5/plat-linux2', '/home/
> > > szimszon/.virtualenvs/web2py/lib/python2.5/lib-tk', '/home/
> > > szimszon/.virtualenvs/web2py/lib/python2.5/lib-dynload', '/usr/lib/
> > > python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-
> > > tk', '/home/szimszon/.virtualenvs/web2py/lib/python2.5/site-packages',
> > > '/usr/local/lib/python2.5/site-packages', '/usr/lib/python2.5/site-
> > > packages', '/usr/lib/python2.5/site-packages/PIL', '/usr/lib/python2.5/
> > > site-packages/gst-0.10', '/usr/lib/pymodules/python2.5/gtk-2.0', '/usr/
> > > lib/python2.5/site-packages/wx-2.6-gtk2-unicode']
>
> > > On ápr. 19, 13:30, Mathieu Clabaut  wrote:
>
> > > > I use 
> > > > virtualenvwrapperhttp://www.doughellmann.com/docs/virtualenvwrapper/which
> > > > seems to work like a charm.
>
> > > > export WORKON_HOME=$HOME/.virtualenvs
> > > > source /usr/bin/virtualenvwrapper.sh # put those 2 lines in your
> > > > $HOME/.bashrc
> > > > mkvirtualenv web2py
>
> > > > From here, you just have to type :
> > > > workon web2py
>
> > > > berfore launching web2py.
>
> > > > It is not a web2py solution, but it may help in the meanwhile.
>
> > > > -Mathieu
>
> > > > On Mon, Apr 19, 2010 at 13:15, szimszon  wrote:
> > > > > Is there now a quick way to start web2py without removing simplejson
> > > > > from debian?
>
> > > > > Tnx.
>
> > > > > On ápr. 11, 16:23, mdipierro  wrote:
> > > > > > What's your advice about this?
>
> > > > > > Out r version of simplejson is patched to serialize dates. We could
> > > > > > upgrade to the latest and re-patch and for now this problem will go
> > > > > > away but this is not a long term solution. Clearly we must change
> > > > > > something in the way simplejson is imported to avoid conflict.
>
> > > > > > Massimo
>
> > > > > > On Apr 11, 4:30 am, muybay  wrote:
>
> > > > > > > I have the issue also. I am going to try this suggestion and 
> > > > > > > possibly
> > > > > > > diff the two versions (upgraded vs web2py simplejson).
>
> > > > > > > On Apr 8, 8:00 am, mdipierro  wrote:
>
> > > > > > > > One solution is to upgrade thesimplejsonthat comes with web2py. 
> > > > > > > > The
> > > > > > > > problem is that the one we use has been modified to handle 
> > > > > > > > dates.
>
> > > > > > > > On Apr 8, 4:27 am, Johann Spies  wrote:
>
> > > > > > > > > Removing Debian's python-simplejsonhelped me to start web2py 
> > > > > > > > > again
> > > > > -
> > > > > > > > > and broke some other stuff on Debian.
>
> > > > > > > > > Regards
> > > > > > > > > Johann
> > > > > > > > > --
> > > > > > > > >        "Every good gift and every perfect gift is from above,
> > > > > > > > >       and cometh down from the Father of lights, with whom
> > > > > > > > >       is no variableness, neither shadow of turning."
> > > > > > > > >                              James 1:17
>
> > > > > --
> > > > > Subscription settings:
> > > > >http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] rocket performance

2010-04-19 Thread elffikk
 a simple test loading one by one the same link, leaving concurrency
and advanced testing to Tim and others :)
just wanted to feel the improvement, and I have to say Tim did his job
very well

web2py 1.76.5  vs 1.77.1 load test

10 requests:
1.76.5  - 0.3016 seconds
1.77.1 -  0.2736 seconds

100 requests:
1.76.5  - 1.7729 seconds
1.77.1 -  1.4585 seconds

1000 requests:
1.76.5  - 16.6493 seconds
1.77.1 -  13.4033 seconds

and here is the great test script :)

import sys, urllib
n = int((sys.argv[1:] or [10])[0])
s = 'http://127.0.0.1:8001/' # s = 'http://127.0.0.1:8002/'
for i in xrange(n):
urllib.urlopen(s).read()


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Trouble starting web2py

2010-04-19 Thread mdipierro
Mind that this is not the end of the story. The simplejson that ships
with web2py was modified to handle date/datetime/time. By replacing
with the latest official simplejson you will may not be able to
serialize DAL records.

One option is to include latest web2py in web2py and re-apply the
patch. we will do so in 1.77.x but it would be useful to get to the
bottom of why this problem arose in the first place.

Masismo

On Apr 19, 3:36 pm, szimszon  wrote:
> Okay, copy "/usr/share/pyshared/simplejson" to gluon/contrib seems to
> work for me.
>
> BigTNX. (1.77.2 :)
>
> On ápr. 19, 22:25, mdipierro  wrote:
>
> > try copy simplejson into gluon/contrib/simplejson for now.
>
> > On Apr 19, 3:23 pm, szimszon  wrote:
>
> > > I can't run it (1.77.1) even if I installed the simplejson 1.9.2 in
> > > virtualenv:
>
> > > >>> sys.path
>
> > > ['', '/home/szimszon/.virtualenvs/web2py/lib/python2.5/site-packages/
> > > setuptools-0.6c11-py2.5.egg', '/home/szimszon/.virtualenvs/web2py/lib/
> > > python2.5/site-packages/simplejson-1.9.2-py2.5.egg'...
>
> > > On ápr. 19, 13:58, szimszon  wrote:
>
> > > > I got the some traceback as before :(
>
> > > > >>> sys.path
>
> > > > ['', '/home/szimszon/.virtualenvs/web2py/lib/python2.5/site-packages/
> > > > setuptools-0.6c11-py2.5.egg', '/usr/lib/pymodules/python2.5', '/home/
> > > > szimszon/.virtualenvs/web2py/lib/python2.5', '/home/
> > > > szimszon/.virtualenvs/web2py/lib/python2.5/plat-linux2', '/home/
> > > > szimszon/.virtualenvs/web2py/lib/python2.5/lib-tk', '/home/
> > > > szimszon/.virtualenvs/web2py/lib/python2.5/lib-dynload', '/usr/lib/
> > > > python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-
> > > > tk', '/home/szimszon/.virtualenvs/web2py/lib/python2.5/site-packages',
> > > > '/usr/local/lib/python2.5/site-packages', '/usr/lib/python2.5/site-
> > > > packages', '/usr/lib/python2.5/site-packages/PIL', '/usr/lib/python2.5/
> > > > site-packages/gst-0.10', '/usr/lib/pymodules/python2.5/gtk-2.0', '/usr/
> > > > lib/python2.5/site-packages/wx-2.6-gtk2-unicode']
>
> > > > On ápr. 19, 13:30, Mathieu Clabaut  wrote:
>
> > > > > I use 
> > > > > virtualenvwrapperhttp://www.doughellmann.com/docs/virtualenvwrapper/which
> > > > > seems to work like a charm.
>
> > > > > export WORKON_HOME=$HOME/.virtualenvs
> > > > > source /usr/bin/virtualenvwrapper.sh # put those 2 lines in your
> > > > > $HOME/.bashrc
> > > > > mkvirtualenv web2py
>
> > > > > From here, you just have to type :
> > > > > workon web2py
>
> > > > > berfore launching web2py.
>
> > > > > It is not a web2py solution, but it may help in the meanwhile.
>
> > > > > -Mathieu
>
> > > > > On Mon, Apr 19, 2010 at 13:15, szimszon  wrote:
> > > > > > Is there now a quick way to start web2py without removing simplejson
> > > > > > from debian?
>
> > > > > > Tnx.
>
> > > > > > On ápr. 11, 16:23, mdipierro  wrote:
> > > > > > > What's your advice about this?
>
> > > > > > > Out r version of simplejson is patched to serialize dates. We 
> > > > > > > could
> > > > > > > upgrade to the latest and re-patch and for now this problem will 
> > > > > > > go
> > > > > > > away but this is not a long term solution. Clearly we must change
> > > > > > > something in the way simplejson is imported to avoid conflict.
>
> > > > > > > Massimo
>
> > > > > > > On Apr 11, 4:30 am, muybay  wrote:
>
> > > > > > > > I have the issue also. I am going to try this suggestion and 
> > > > > > > > possibly
> > > > > > > > diff the two versions (upgraded vs web2py simplejson).
>
> > > > > > > > On Apr 8, 8:00 am, mdipierro  wrote:
>
> > > > > > > > > One solution is to upgrade thesimplejsonthat comes with 
> > > > > > > > > web2py. The
> > > > > > > > > problem is that the one we use has been modified to handle 
> > > > > > > > > dates.
>
> > > > > > > > > On Apr 8, 4:27 am, Johann Spies  
> > > > > > > > > wrote:
>
> > > > > > > > > > Removing Debian's python-simplejsonhelped me to start 
> > > > > > > > > > web2py again
> > > > > > -
> > > > > > > > > > and broke some other stuff on Debian.
>
> > > > > > > > > > Regards
> > > > > > > > > > Johann
> > > > > > > > > > --
> > > > > > > > > >        "Every good gift and every perfect gift is from 
> > > > > > > > > > above,
> > > > > > > > > >       and cometh down from the Father of lights, with whom
> > > > > > > > > >       is no variableness, neither shadow of turning."
> > > > > > > > > >                              James 1:17
>
> > > > > > --
> > > > > > Subscription settings:
> > > > > >http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] a bug of sorts in app installation

2010-04-19 Thread Jonathan Lundell
I've been trying to install an app through admin, and it's been failing. 
(Problem #1: there's no feedback at all when this happens, just a message that 
the install failed; I had to run a debugger to find out why.)

It turned out that fix_newlines was raising an exception because it was trying 
to write a .py file that was read-only. It was read-only because my app is 
under Perforce source control, and read-only is the normal state for files not 
being edited.

So when the app was packed, tar preserved the read-only state of the files, and 
when fix_newlines tries to write them, kablooey.

My workaround is below: since this is a Unix system, fix_newlines isn't really 
necessary. I made the rewrite conditional on there actually being a change. 
Now, this is perhaps a good thing to do regardless, but of course it doesn't 
solve the problem in the Windows case.

I'm not sure what the right fix is, though this one is adequate for me. Maybe 
fix_newlines should make the file writable if necessary?


def fix_newlines(path):
regex = re.compile(r'''(\r
|\r|
)''')
for filename in listdir(path, '.*\.(py|html)$', drop=False):
fp = open(filename, 'rb')
rdata = fp.read()
fp.close()
wdata = regex.sub('\n', rdata)
if wdata != rdata:
fp = open(filename, 'wb')
fp.write(wdata)
fp.close()



-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] another compilation question

2010-04-19 Thread Jonathan Lundell
When I compile an app, and the install it, it appears that controllers show up 
twice: once in controllers/ as one .pyc per controller file, and again in 
compiled/, this time once per function. What's going on, and how are these 
files used?

Also, the manual says:

> Because views can extend and include other views in a tree, before bytecode 
> compilation, the view tree for every controller is collapsed into a single 
> file. 

But in compiled/, I see a view .pyc per function, not per controller. I assume 
that I'm misinterpreting something, but again: what's going on here?



-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] best practice for an upload with a very long file name

2010-04-19 Thread Rowdy

Greetings,

I am (still) using 1.76.5, running under Ubuntu 7.10.

During file upload (whether from a form or as part of a cron job that
extract files attached to emails) I am finding that some long filenames
are causing the store() function to choke:

Traceback (most recent call last):
  File "applications/webacc2/cron/hlpcheck2.py", line 881, in 
Main()
  File "applications/webacc2/cron/hlpcheck2.py", line 864, in Main
Process1(s, msgId)
  File "applications/webacc2/cron/hlpcheck2.py", line 730, in Process1
AttachToIncident(incidentId, tmpname, tmpdir2, hasAttachment, 
attachDesc, from1, to1, subject, date1, originatorId)
  File "applications/webacc2/cron/hlpcheck2.py", line 446, in 
AttachToIncident

AddAttachment(IncidentId, inname, None, None, None, None, UserId)
  File "applications/webacc2/cron/hlpcheck2.py", line 432, in AddAttachment
file = db.attachment.file.store(open(FileName, 'rb')), \
  File "/home/rowdy/web2py/gluon/sql.py", line 2645, in store
dest_file = open(pathfilename, 'wb')
IOError: [Errno 36] File name too long: 
'applications/webacc2/uploads/371041/attachment.file.8933d60f0092f7d3.696e667261456e74657270726973652045787465726e616c2043616c6c20526571756972696e6720416374696f6e203131373238392020204442202020496e66726150726f642020203130333735202020696d62616c616e6365206265747765656e2027524527262755502720474c205472616e73616374696f6e7320616e642072656365697074732e656d6c.eml'


I have no control over the filenames submitted by the users, and this is
an operating system limit (i.e. I cannot touch the file to create it -
same error).

Is there a best practice for dealing with this?

The original filename is 141 characters in length which is well within
OS limits, but encoded and expanded by web2py comes out at 319
characters.

I suppose the users do not really need to see such long filenames when
downloading the files later on, so I could probably truncate the
original filename (and rename the original file) before inserting it
into the database.

Any other ideas?

Thanx

Rowdy



--
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: best practice for an upload with a very long file name

2010-04-19 Thread mdipierro
I was not aware of this limit.

In gluon/sql.py you should replace:
newfilename = newfilename[:500] + '.' + extension

with something like

newfilename = newfilename[:120] + '.' + extension

perhaps this should be the default?

Massimo

On Apr 19, 5:16 pm, Rowdy  wrote:
> Greetings,
>
> I am (still) using 1.76.5, running under Ubuntu 7.10.
>
> During file upload (whether from a form or as part of a cron job that
> extract files attached to emails) I am finding that some long filenames
> are causing the store() function to choke:
>
> Traceback (most recent call last):
>    File "applications/webacc2/cron/hlpcheck2.py", line 881, in 
>      Main()
>    File "applications/webacc2/cron/hlpcheck2.py", line 864, in Main
>      Process1(s, msgId)
>    File "applications/webacc2/cron/hlpcheck2.py", line 730, in Process1
>      AttachToIncident(incidentId, tmpname, tmpdir2, hasAttachment,
> attachDesc, from1, to1, subject, date1, originatorId)
>    File "applications/webacc2/cron/hlpcheck2.py", line 446, in
> AttachToIncident
>      AddAttachment(IncidentId, inname, None, None, None, None, UserId)
>    File "applications/webacc2/cron/hlpcheck2.py", line 432, in AddAttachment
>      file = db.attachment.file.store(open(FileName, 'rb')), \
>    File "/home/rowdy/web2py/gluon/sql.py", line 2645, in store
>      dest_file = open(pathfilename, 'wb')
> IOError: [Errno 36] File name too long:
> 'applications/webacc2/uploads/371041/attachment.file.8933d60f0092f7d3.696e667261456e74657270726973652045787465726e616c2043616c6c20526571756972696e6720416374696f6e203131373238392020204442202020496e66726150726f642020203130333735202020696d62616c616e6365206265747765656e2027524527262755502720474c205472616e73616374696f6e7320616e642072656365697074732e656d6c.eml'
>
> I have no control over the filenames submitted by the users, and this is
> an operating system limit (i.e. I cannot touch the file to create it -
> same error).
>
> Is there a best practice for dealing with this?
>
> The original filename is 141 characters in length which is well within
> OS limits, but encoded and expanded by web2py comes out at 319
> characters.
>
> I suppose the users do not really need to see such long filenames when
> downloading the files later on, so I could probably truncate the
> original filename (and rename the original file) before inserting it
> into the database.
>
> Any other ideas?
>
> Thanx
>
> Rowdy
>
> --
> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: rocket performance

2010-04-19 Thread mdipierro
:-)

On Apr 19, 3:57 pm, elffikk  wrote:
>  a simple test loading one by one the same link, leaving concurrency
> and advanced testing to Tim and others :)
> just wanted to feel the improvement, and I have to say Tim did his job
> very well
>
> web2py 1.76.5  vs 1.77.1 load test
>
> 10 requests:
> 1.76.5  - 0.3016 seconds
> 1.77.1 -  0.2736 seconds
>
> 100 requests:
> 1.76.5  - 1.7729 seconds
> 1.77.1 -  1.4585 seconds
>
> 1000 requests:
> 1.76.5  - 16.6493 seconds
> 1.77.1 -  13.4033 seconds
>
> and here is the great test script :)
>
> import sys, urllib
> n = int((sys.argv[1:] or [10])[0])
> s = 'http://127.0.0.1:8001/'# s = 'http://127.0.0.1:8002/'
> for i in xrange(n):
>         urllib.urlopen(s).read()
>
> --
> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: another compilation question

2010-04-19 Thread mdipierro
web2py does something clever for view but very stupid for controllers.

The good:
For each action is collapses its view, all extended views (layout for
example) and included views into a single pyc file.

The bad:
For each action it generates one pyc that contains a copy of the
entire controller.

The ugly:
The bad part can easily be fixed so that there is only one pyc per
controller and not per action but this breaks backward compatibility
for bytecode compiled apps. In the end we are using more space than
needed in order to perform less checks. I admit it is ugly.

On Apr 19, 4:54 pm, Jonathan Lundell  wrote:
> When I compile an app, and the install it, it appears that controllers show 
> up twice: once in controllers/ as one .pyc per controller file, and again in 
> compiled/, this time once per function. What's going on, and how are these 
> files used?
>
> Also, the manual says:
>
> > Because views can extend and include other views in a tree, before bytecode 
> > compilation, the view tree for every controller is collapsed into a single 
> > file.
>
> But in compiled/, I see a view .pyc per function, not per controller. I 
> assume that I'm misinterpreting something, but again: what's going on here?
>
> --
> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] IE6 problems

2010-04-19 Thread mdipierro
User yanni has reported this problem with IE6
http://i.imgur.com/ivWKA.jpg
I do not have a windows machine but if anybody can suggest a css fix I
will be happy to include it.

Massimo


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: best practice for an upload with a very long file name

2010-04-19 Thread Rowdy

mdipierro wrote:

I was not aware of this limit.

In gluon/sql.py you should replace:
newfilename = newfilename[:500] + '.' + extension

with something like

newfilename = newfilename[:120] + '.' + extension

perhaps this should be the default?

Massimo


That is exactly what I was looking for, and worked perfectly :-)

Thank you again for the quick response.

It would be great if this could be a permanent change.

According to this:

http://en.wikipedia.org/wiki/Comparison_of_file_systems

FAT32 - max. 255 chars for filenames
NTFS - 226 chars
UFS1/2 - 255 chars
ext2/3/4 - 255 chars
XFS - 255 chars
ZFS - 255 chars

AFAIK those are the most common, so someone else is likely to run into
the limit at some point.

Thanx

Rowdy



--
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: best practice for an upload with a very long file name

2010-04-19 Thread mdipierro
Any objection to make this 200?

Massimo

On Apr 19, 6:22 pm, Rowdy  wrote:
> mdipierro wrote:
> > I was not aware of this limit.
>
> > In gluon/sql.py you should replace:
> > newfilename = newfilename[:500] + '.' + extension
>
> > with something like
>
> > newfilename = newfilename[:120] + '.' + extension
>
> > perhaps this should be the default?
>
> > Massimo
>
> That is exactly what I was looking for, and worked perfectly :-)
>
> Thank you again for the quick response.
>
> It would be great if this could be a permanent change.
>
> According to this:
>
> http://en.wikipedia.org/wiki/Comparison_of_file_systems
>
> FAT32 - max. 255 chars for filenames
> NTFS - 226 chars
> UFS1/2 - 255 chars
> ext2/3/4 - 255 chars
> XFS - 255 chars
> ZFS - 255 chars
>
> AFAIK those are the most common, so someone else is likely to run into
> the limit at some point.
>
> Thanx
>
> Rowdy
>
> --
> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: best practice for an upload with a very long file name

2010-04-19 Thread Rowdy

mdipierro wrote:

Any objection to make this 200?

Massimo


The limit seems to be NTFS with a maximum of 226 characters.

I have accumulated nearly 60,000 files in a legacy application, and the
longest extension is 5 characters (".batch").

No objection from me.

Rowdy



--
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: another compilation question

2010-04-19 Thread Jonathan Lundell
On Apr 19, 2010, at 4:10 PM, mdipierro wrote:

> web2py does something clever for view but very stupid for controllers.
> 
> The good:
> For each action is collapses its view, all extended views (layout for
> example) and included views into a single pyc file.
> 
> The bad:
> For each action it generates one pyc that contains a copy of the
> entire controller.
> 
> The ugly:
> The bad part can easily be fixed so that there is only one pyc per
> controller and not per action but this breaks backward compatibility
> for bytecode compiled apps. In the end we are using more space than
> needed in order to perform less checks. I admit it is ugly.

Why does the compiled version include the .pyc files in controllers/ (outside 
of compiled/)? It doesn't seem like those get used, at least not by 
run_controller_in.

And a minor thing: there's a lot of this kind of thing:

path = os.path.join(folder, 'compiled/')

Should the '/' really be part of the call? It sort of defeats the purpose of 
os.path.join.


> 
> On Apr 19, 4:54 pm, Jonathan Lundell  wrote:
>> When I compile an app, and the install it, it appears that controllers show 
>> up twice: once in controllers/ as one .pyc per controller file, and again in 
>> compiled/, this time once per function. What's going on, and how are these 
>> files used?
>> 
>> Also, the manual says:
>> 
>>> Because views can extend and include other views in a tree, before bytecode 
>>> compilation, the view tree for every controller is collapsed into a single 
>>> file.
>> 
>> But in compiled/, I see a view .pyc per function, not per controller. I 
>> assume that I'm misinterpreting something, but again: what's going on here?
>> 
>> --
>> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en




[web2py] web2py.com Documentation links book

2010-04-19 Thread Richard
I noticed the web2py.com Documentation link now points to the book.
What will happen to the existing documentation - AlterEgo, etc?


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: another compilation question

2010-04-19 Thread mdipierro
> Why does the compiled version include the .pyc files in controllers/ (outside 
> of compiled/)? It doesn't seem like those get used, at least not by 
> run_controller_in.

I think you refer to line 298 of compileapp.py. I do not recall why it
is there. I will try remove it and see what breaks.

> And a minor thing: there's a lot of this kind of thing:
>
>     path = os.path.join(folder, 'compiled/')
>
> Should the '/' really be part of the call? It sort of defeats the purpose of 
> os.path.join.

There are a few cases when in can be removed (and I just did in trunk)
but most of them are required else listdir does not work properly.




-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: web2py.com Documentation links book

2010-04-19 Thread mdipierro
It is linked from the book.

On Apr 19, 7:04 pm, Richard  wrote:
> I noticed the web2py.com Documentation link now points to the book.
> What will happen to the existing documentation - AlterEgo, etc?
>
> --
> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: another compilation question

2010-04-19 Thread Jonathan Lundell
On Apr 19, 2010, at 5:05 PM, mdipierro wrote:

>> Why does the compiled version include the .pyc files in controllers/ 
>> (outside of compiled/)? It doesn't seem like those get used, at least not by 
>> run_controller_in.
> 
> I think you refer to line 298 of compileapp.py. I do not recall why it
> is there. I will try remove it and see what breaks.

Ah, yes, that's where it comes from.

> 
>> And a minor thing: there's a lot of this kind of thing:
>> 
>> path = os.path.join(folder, 'compiled/')
>> 
>> Should the '/' really be part of the call? It sort of defeats the purpose of 
>> os.path.join.
> 
> There are a few cases when in can be removed (and I just did in trunk)
> but most of them are required else listdir does not work properly.

listdir appends a '/' if there isn't one already. (Though I don't see why it 
needs to, as long as it computes n correctly.)

BTW, the comment for listdir seems to confuse add_dirs with drop. Or something. 
And a pair of typos: s/b "regex pattern to filter files"

-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: another compilation question

2010-04-19 Thread mdipierro
I tried remove it and I an error in listdir.

Massimo

On Apr 19, 7:22 pm, Jonathan Lundell  wrote:
> On Apr 19, 2010, at 5:05 PM, mdipierro wrote:
>
> >> Why does the compiled version include the .pyc files in controllers/ 
> >> (outside of compiled/)? It doesn't seem like those get used, at least not 
> >> by run_controller_in.
>
> > I think you refer to line 298 of compileapp.py. I do not recall why it
> > is there. I will try remove it and see what breaks.
>
> Ah, yes, that's where it comes from.
>
>
>
> >> And a minor thing: there's a lot of this kind of thing:
>
> >>     path = os.path.join(folder, 'compiled/')
>
> >> Should the '/' really be part of the call? It sort of defeats the purpose 
> >> of os.path.join.
>
> > There are a few cases when in can be removed (and I just did in trunk)
> > but most of them are required else listdir does not work properly.
>
> listdir appends a '/' if there isn't one already. (Though I don't see why it 
> needs to, as long as it computes n correctly.)
>
> BTW, the comment for listdir seems to confuse add_dirs with drop. Or 
> something. And a pair of typos: s/b "regex pattern to filter files"
>
> --
> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] web2py wrong version

2010-04-19 Thread elffikk
hi,

just downloaded 1.77.2  (from 
http://www.web2py.com/examples/static/web2py_src.zip
),
but it shows that is version 1.77.1
content of version file:
Version 1.77.1 (2010-04-19 15:50:56)


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] delete database entry by form

2010-04-19 Thread claudio
I have a newbie question: How can I create a form to delete selected
entries from a database? Can I use SQLFORM for this?

I have tables roughly like this in db.py

db.define_table('person',
Field('name'))

db.define_table('posts',
Field('title'),
Field('author',db.person))

and in default.py a function that should create the form and then
delete the picked entry
def delEntry:
 
form=SQLFORM((db.posts.author==session.authorized).select(),fields=['posts'])



-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: delete database entry by form

2010-04-19 Thread mdipierro
This would delete all posts by current user for example:

db(db.posts.author==auth.user_id).delete()

On Apr 19, 7:12 pm, claudio  wrote:
> I have a newbie question: How can I create a form to delete selected
> entries from a database? Can I use SQLFORM for this?
>
> I have tables roughly like this in db.py
>
> db.define_table('person',
> Field('name'))
>
> db.define_table('posts',
> Field('title'),
> Field('author',db.person))
>
> and in default.py a function that should create the form and then
> delete the picked entry
> def delEntry:
>
> form=SQLFORM((db.posts.author==session.authorized).select(),fields=['posts'])
>
> --
> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: web2py wrong version

2010-04-19 Thread mdipierro
Something when wrong in the build script. To avoid confusion I will
post a 1.77.3.
Massimo

On Apr 19, 8:18 pm, elffikk  wrote:
> hi,
>
> just downloaded 1.77.2  
> (fromhttp://www.web2py.com/examples/static/web2py_src.zip
> ),
> but it shows that is version 1.77.1
> content of version file:
> Version 1.77.1 (2010-04-19 15:50:56)
>
> --
> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] IE6 problems

2010-04-19 Thread Thadeus Burgess
Display the following code inside your layout.html file.

http://pastebin.com/exyxkACz

--
Thadeus





On Mon, Apr 19, 2010 at 6:15 PM, mdipierro  wrote:
> User yanni has reported this problem with IE6
> http://i.imgur.com/ivWKA.jpg
> I do not have a windows machine but if anybody can suggest a css fix I
> will be happy to include it.
>
> Massimo
>
>
> --
> Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en
>


Re: [web2py] Re: another compilation question

2010-04-19 Thread Jonathan Lundell
On Apr 19, 2010, at 6:16 PM, mdipierro wrote:

> I tried remove it and I an error in listdir.

Odd, since listdir starts out with:

if path[-1:] != '/':
path = path + '/'


Which one did you remove that caused the error?

> 
> Massimo
> 
> On Apr 19, 7:22 pm, Jonathan Lundell  wrote:
>> On Apr 19, 2010, at 5:05 PM, mdipierro wrote:
>> 
 Why does the compiled version include the .pyc files in controllers/ 
 (outside of compiled/)? It doesn't seem like those get used, at least not 
 by run_controller_in.
>> 
>>> I think you refer to line 298 of compileapp.py. I do not recall why it
>>> is there. I will try remove it and see what breaks.
>> 
>> Ah, yes, that's where it comes from.
>> 
>> 
>> 
 And a minor thing: there's a lot of this kind of thing:
>> 
 path = os.path.join(folder, 'compiled/')
>> 
 Should the '/' really be part of the call? It sort of defeats the purpose 
 of os.path.join.
>> 
>>> There are a few cases when in can be removed (and I just did in trunk)
>>> but most of them are required else listdir does not work properly.
>> 
>> listdir appends a '/' if there isn't one already. (Though I don't see why it 
>> needs to, as long as it computes n correctly.)
>> 
>> BTW, the comment for listdir seems to confuse add_dirs with drop. Or 
>> something. And a pair of typos: s/b "regex pattern to filter files"
>> 
>> --
>> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en




Re: [web2py] IE6 problems

2010-04-19 Thread Álvaro Justen [Turicas]
On Mon, Apr 19, 2010 at 20:15, mdipierro  wrote:
> User yanni has reported this problem with IE6
> http://i.imgur.com/ivWKA.jpg
> I do not have a windows machine but if anybody can suggest a css fix I
> will be happy to include it.

http://www.dieie6.com/

-- 
Álvaro Justen - Turicas
 http://blog.justen.eng.br/
 21 9898-0141


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: another compilation question

2010-04-19 Thread mdipierro
I double checked. The problem was not listdir but the following path
+file (should have been os.path.join(path,file).
Fixed and reposting. Thank Jonathan!

Massimo

On Apr 19, 8:34 pm, Jonathan Lundell  wrote:
> On Apr 19, 2010, at 6:16 PM, mdipierro wrote:
>
> > I tried remove it and I an error in listdir.
>
> Odd, since listdir starts out with:
>
>     if path[-1:] != '/':
>         path = path + '/'
>
> Which one did you remove that caused the error?
>
>
>
> > Massimo
>
> > On Apr 19, 7:22 pm, Jonathan Lundell  wrote:
> >> On Apr 19, 2010, at 5:05 PM, mdipierro wrote:
>
>  Why does the compiled version include the .pyc files in controllers/ 
>  (outside of compiled/)? It doesn't seem like those get used, at least 
>  not by run_controller_in.
>
> >>> I think you refer to line 298 of compileapp.py. I do not recall why it
> >>> is there. I will try remove it and see what breaks.
>
> >> Ah, yes, that's where it comes from.
>
>  And a minor thing: there's a lot of this kind of thing:
>
>      path = os.path.join(folder, 'compiled/')
>
>  Should the '/' really be part of the call? It sort of defeats the 
>  purpose of os.path.join.
>
> >>> There are a few cases when in can be removed (and I just did in trunk)
> >>> but most of them are required else listdir does not work properly.
>
> >> listdir appends a '/' if there isn't one already. (Though I don't see why 
> >> it needs to, as long as it computes n correctly.)
>
> >> BTW, the comment for listdir seems to confuse add_dirs with drop. Or 
> >> something. And a pair of typos: s/b "regex pattern to filter files"
>
> >> --
> >> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: delete database entry by form

2010-04-19 Thread Mengu
SQLFORM has an argument called "deletable" if you set it to True when
you initialize it, you will have an option like "delete this record".
and when you submit the form with that option checked then the record
will be deleted.

On 20 Nisan, 03:12, claudio  wrote:
> I have a newbie question: How can I create a form to delete selected
> entries from a database? Can I use SQLFORM for this?
>
> I have tables roughly like this in db.py
>
> db.define_table('person',
> Field('name'))
>
> db.define_table('posts',
> Field('title'),
> Field('author',db.person))
>
> and in default.py a function that should create the form and then
> delete the picked entry
> def delEntry:
>
> form=SQLFORM((db.posts.author==session.authorized).select(),fields=['posts' ])
>
> --
> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: a bug of sorts in app installation

2010-04-19 Thread Jonathan Lundell
As a halfway fix, how about the patch below?

On Apr 19, 2010, at 2:48 PM, Jonathan Lundell wrote:

> I've been trying to install an app through admin, and it's been failing. 
> (Problem #1: there's no feedback at all when this happens, just a message 
> that the install failed; I had to run a debugger to find out why.)
> 
> It turned out that fix_newlines was raising an exception because it was 
> trying to write a .py file that was read-only. It was read-only because my 
> app is under Perforce source control, and read-only is the normal state for 
> files not being edited.
> 
> So when the app was packed, tar preserved the read-only state of the files, 
> and when fix_newlines tries to write them, kablooey.
> 
> My workaround is below: since this is a Unix system, fix_newlines isn't 
> really necessary. I made the rewrite conditional on there actually being a 
> change. Now, this is perhaps a good thing to do regardless, but of course it 
> doesn't solve the problem in the Windows case.
> 
> I'm not sure what the right fix is, though this one is adequate for me. Maybe 
> fix_newlines should make the file writable if necessary?
> 
> 
> def fix_newlines(path):
>regex = re.compile(r'''(\r
> |\r|
> )''')
>for filename in listdir(path, '.*\.(py|html)$', drop=False):
>fp = open(filename, 'rb')
>rdata = fp.read()
>fp.close()
>wdata = regex.sub('\n', rdata)
>if wdata != rdata:
>fp = open(filename, 'wb')
>fp.write(wdata)
>fp.close()
> 




-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: web2py 1.77.2 is OUT

2010-04-19 Thread Yarko Tymciurak
By the way,  thank you for tagging these releases:

For general info:  you can check releases by reviewing the .hgtags
file in the repository

http://code.google.com/p/web2py/source/browse/.hgtags

Since Massimo has prefixed the tags with "R-", this leaves the
possibility to tag specific fixes (separate from releases), i.e.

R-1.77.1  - if this is the release, then:

1.77.1-ez-css-fix

might be the "please check out this fix"  tag, which people could
use until it is acceted into R-1.77.2

Enjoy,
- Yarko

On Apr 19, 3:15 pm, mdipierro  wrote:
> There was a bug in 1.77.1:
>
> the new layout uses ez.css and it changes the z-index of the content.
> As a result the date/datetime/time popup appear under the windows.
>
> I have not fixed this but please check it under IE since I did not get
> a chance to try that. z-index in IE behaves funny.
>
> Massimo
>
> --
> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: a bug of sorts in app installation

2010-04-19 Thread mdipierro
Had a long day. I will look at this more in detail tomorrow.

On Apr 19, 10:16 pm, Jonathan Lundell  wrote:
> As a halfway fix, how about the patch below?
>
> On Apr 19, 2010, at 2:48 PM, Jonathan Lundell wrote:
>
>
>
> > I've been trying to install an app through admin, and it's been failing. 
> > (Problem #1: there's no feedback at all when this happens, just a message 
> > that the install failed; I had to run a debugger to find out why.)
>
> > It turned out that fix_newlines was raising an exception because it was 
> > trying to write a .py file that was read-only. It was read-only because my 
> > app is under Perforce source control, and read-only is the normal state for 
> > files not being edited.
>
> > So when the app was packed, tar preserved the read-only state of the files, 
> > and when fix_newlines tries to write them, kablooey.
>
> > My workaround is below: since this is a Unix system, fix_newlines isn't 
> > really necessary. I made the rewrite conditional on there actually being a 
> > change. Now, this is perhaps a good thing to do regardless, but of course 
> > it doesn't solve the problem in the Windows case.
>
> > I'm not sure what the right fix is, though this one is adequate for me. 
> > Maybe fix_newlines should make the file writable if necessary?
>
> > def fix_newlines(path):
> >    regex = re.compile(r'''(\r
> > |\r|
> > )''')
> >    for filename in listdir(path, '.*\.(py|html)$', drop=False):
> >        fp = open(filename, 'rb')
> >        rdata = fp.read()
> >        fp.close()
> >        wdata = regex.sub('\n', rdata)
> >        if wdata != rdata:
> >            fp = open(filename, 'wb')
> >            fp.write(wdata)
> >            fp.close()
>
> --
> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


RE: [web2py] Re: another compilation question

2010-04-19 Thread Fiko
Halo.. I am fiko a nubie on web2py..from Indonesia.
Nice to meet you. Because as newbie  I will be good listener before say
something.
... 
Thank you accept me as part of web2py user community.



-Original Message-
From: web2py@googlegroups.com [mailto:web...@googlegroups.com] On Behalf Of
mdipierro
Sent: Tuesday, April 20, 2010 8:48 AM
To: web2py-users
Subject: [web2py] Re: another compilation question

I double checked. The problem was not listdir but the following path
+file (should have been os.path.join(path,file).
Fixed and reposting. Thank Jonathan!

Massimo

On Apr 19, 8:34 pm, Jonathan Lundell  wrote:
> On Apr 19, 2010, at 6:16 PM, mdipierro wrote:
>
> > I tried remove it and I an error in listdir.
>
> Odd, since listdir starts out with:
>
>     if path[-1:] != '/':
>         path = path + '/'
>
> Which one did you remove that caused the error?
>
>
>
> > Massimo
>
> > On Apr 19, 7:22 pm, Jonathan Lundell  wrote:
> >> On Apr 19, 2010, at 5:05 PM, mdipierro wrote:
>
> >>>> Why does the compiled version include the .pyc files in controllers/
(outside of compiled/)? It doesn't seem like those get used, at least not by
run_controller_in.
>
> >>> I think you refer to line 298 of compileapp.py. I do not recall why it
> >>> is there. I will try remove it and see what breaks.
>
> >> Ah, yes, that's where it comes from.
>
> >>>> And a minor thing: there's a lot of this kind of thing:
>
> >>>>     path = os.path.join(folder, 'compiled/')
>
> >>>> Should the '/' really be part of the call? It sort of defeats the
purpose of os.path.join.
>
> >>> There are a few cases when in can be removed (and I just did in trunk)
> >>> but most of them are required else listdir does not work properly.
>
> >> listdir appends a '/' if there isn't one already. (Though I don't see
why it needs to, as long as it computes n correctly.)
>
> >> BTW, the comment for listdir seems to confuse add_dirs with drop. Or
something. And a pair of typos: s/b "regex pattern to filter files"
>
> >> --
> >> Subscription
settings:http://groups.google.com/group/web2py/subscribe?hl=en
 

__ Information from ESET Smart Security, version of virus signature
database 5042 (20100419) __

The message was checked by ESET Smart Security.

http://www.eset.com
 
 

__ Information from ESET Smart Security, version of virus signature
database 5042 (20100419) __

The message was checked by ESET Smart Security.

http://www.eset.com
 



[web2py] Re: another compilation question

2010-04-19 Thread mdipierro
Welcome and never be afraid to ask questions.

On Apr 19, 11:31 pm, "Fiko"  wrote:
> Halo.. I am fiko a nubie on web2py..from Indonesia.
> Nice to meet you. Because as newbie  I will be good listener before say
> something.
> ...
> Thank you accept me as part of web2py user community.
>
> -Original Message-
> From: web2py@googlegroups.com [mailto:web...@googlegroups.com] On Behalf Of
>
> mdipierro
> Sent: Tuesday, April 20, 2010 8:48 AM
> To: web2py-users
> Subject: [web2py] Re: another compilation question
>
> I double checked. The problem was not listdir but the following path
> +file (should have been os.path.join(path,file).
> Fixed and reposting. Thank Jonathan!
>
> Massimo
>
> On Apr 19, 8:34 pm, Jonathan Lundell  wrote:
> > On Apr 19, 2010, at 6:16 PM, mdipierro wrote:
>
> > > I tried remove it and I an error in listdir.
>
> > Odd, since listdir starts out with:
>
> >     if path[-1:] != '/':
> >         path = path + '/'
>
> > Which one did you remove that caused the error?
>
> > > Massimo
>
> > > On Apr 19, 7:22 pm, Jonathan Lundell  wrote:
> > >> On Apr 19, 2010, at 5:05 PM, mdipierro wrote:
>
> > >>>> Why does the compiled version include the .pyc files in controllers/
> (outside of compiled/)? It doesn't seem like those get used, at least not by
> run_controller_in.
>
> > >>> I think you refer to line 298 of compileapp.py. I do not recall why it
> > >>> is there. I will try remove it and see what breaks.
>
> > >> Ah, yes, that's where it comes from.
>
> > >>>> And a minor thing: there's a lot of this kind of thing:
>
> > >>>>     path = os.path.join(folder, 'compiled/')
>
> > >>>> Should the '/' really be part of the call? It sort of defeats the
> purpose of os.path.join.
>
> > >>> There are a few cases when in can be removed (and I just did in trunk)
> > >>> but most of them are required else listdir does not work properly.
>
> > >> listdir appends a '/' if there isn't one already. (Though I don't see
> why it needs to, as long as it computes n correctly.)
>
> > >> BTW, the comment for listdir seems to confuse add_dirs with drop. Or
> something. And a pair of typos: s/b "regex pattern to filter files"
>
> > >> --
> > >> Subscription
> settings:http://groups.google.com/group/web2py/subscribe?hl=en
>
> __ Information from ESET Smart Security, version of virus signature
> database 5042 (20100419) __
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
> __ Information from ESET Smart Security, version of virus signature
> database 5042 (20100419) __
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com


[web2py] Re: getting started with fbconnect

2010-04-19 Thread howesc
Rohan,

Someone pointed out gaema (http://code.google.com/p/gaema/) on the
group a couple of weeks ago as a tool that integrates google, twitter,
facebook, and others with google app engine.  i'm in the process of
adapting it to work with web2py auth (for GAE and non GAE apps).  If
all goes well look for an update from me in the next day or two with
my progress.

christian

On Apr 19, 12:17 am, Rohan  wrote:
> Hi All,
>
> I want to use fbconnect with web2py. I found couple of threads in this
> group
> 1.http://groups.google.com/group/web2py/browse_frm/thread/84f27e0a06312...
> 2.http://groups.google.com/group/web2py/browse_frm/thread/31e9149ad7310...
>
> but I am not able to find any document to get started with using
> fbconnect with web2py. I have already obtained API key from facebook.
> Can someone please share any doc for using fbconnect with web2py?
>
> Thanks


[web2py] Re: http://www.web2py.com doesnt load

2010-04-19 Thread Yarko Tymciurak
On Apr 19, 2:43 pm, Cody Harlow  wrote:
> Try from Google Code. It's the dev version though.
>
> http://code.google.com/p/web2py/

The "tip" may be development, but Massimo has started tagging the
checkings, so you can ALWAYS get the latest release from Google Code
repository:

On your machine, just:

$ hg clone -r R-1.77.3 https://web2py.googlecode.com/hg/  web2py

Actually Massimo:

This suggests it might be good to have a "release" equivalent of
"tip":

How about you tag each release with the release number  AND  a
standard tag, such as "RELEASE", so that "RELEASE" is always the
latest release.

You can put multiple tags on a single tag command;  since you would be
re-tagging "RELEASE" (always), you would need the "force" flag, so it
would look like this:

   massimo-machine $ hg -tag -f RELEASE R-1.77.99

- Yarko

>
> On Mon, Apr 19, 2010 at 2:50 PM, Pystar  wrote:
> > Hello guys,
> > I have noticed for sometime now that I can no longer access
> > web2py.com. i live in Lagos, Nigeria, and this never used to be a
> > problem for me. I want to download the current version of web2py
> > (1.77.1) but cant do so due to this problem. Can anyone please direct
> > me to any alternative download site for this?
> > Thanks
> > Pystar
>
> > --
> > Subscription settings:
> >http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: getting started with fbconnect

2010-04-19 Thread Rohan
I found some code on http://codepad.org/tadGosTd

I want to know if below piece of code is sufficient for creating a
record in auth.user table and creating a session for a user connected
using facebook connect?

logged_user = Users.find_by_fb_id(user['uid'])
user_id = db.users.insert(fb_id=user['uid'], name=user['name'],
age=user['age']) if not len(logged_user) else logged_user[0].id

if not auth.is_logged_in():
user_obj = 
Storage(the_data._filter_fields(Users.find_by_id(user_id)
[0], id=True))
session.auth = Storage(user=user_obj, last_visit=request.now,
expiration=2600)
auth.user = user_obj


On Apr 20, 10:10 am, howesc  wrote:
> Rohan,
>
> Someone pointed out gaema (http://code.google.com/p/gaema/) on the
> group a couple of weeks ago as a tool that integrates google, twitter,
> facebook, and others with google app engine.  i'm in the process of
> adapting it to work with web2py auth (for GAE and non GAE apps).  If
> all goes well look for an update from me in the next day or two with
> my progress.
>
> christian
>
> On Apr 19, 12:17 am, Rohan  wrote:
>
>
>
> > Hi All,
>
> > I want to use fbconnect with web2py. I found couple of threads in this
> > group
> > 1.http://groups.google.com/group/web2py/browse_frm/thread/84f27e0a06312...
> > 2.http://groups.google.com/group/web2py/browse_frm/thread/31e9149ad7310...
>
> > but I am not able to find any document to get started with using
> > fbconnect with web2py. I have already obtained API key from facebook.
> > Can someone please share any doc for using fbconnect with web2py?
>
> > Thanks


Re: [web2py] Re: can I hook my code to db.connect() ?

2010-04-19 Thread Alexey Nezhdanov
Oh, well.
May be that's an Oracle bug then. I use my custom 'console.py' script here,
but output should be clear enough:

BTW - time_start column was created by web2py with this line:
Field('time_start','datetime'),

sn...@nezhdanov:~/VTC/pinger/elixir$ ./console.py
select time_start from pinger_results where id=1;
[('TIME_START', , 23, 7, 0, 0, 1)]
select time_start from pinger_results where time_start='2010-04-20
15:16:17';
ORA-01861: литерал не соответствует формату строки
ALTER SESSION set NLS_DATE_FORMAT = '-MM-DD HH24:MI:SS'
ok
select time_start from pinger_results where time_start='2010-04-20
15:16:17';
[('TIME_START', , 23, 7, 0, 0, 1)]
==
no comments

Alexey

On Mon, Apr 19, 2010 at 8:27 PM, mdipierro  wrote:

> taking a second look at the source code
>
>self._execute("ALTER SESSION SET NLS_DATE_FORMAT = '-
> MM-DD';")
>self._execute("ALTER SESSION SET NLS_TIMESTAMP_FORMAT =
> '-MM-DD HH24:MI:SS';")
>
> Now you propose adding:
>
>self._execute("ALTER SESSION set NLS_DATE_FORMAT = '-
> MM-DD HH24:MI:SS';")
>
> But date does not have HH224, MI, SS, only timestamp does.
>
> On Apr 19, 11:19 am, Alexey Nezhdanov  wrote:
> > No, I'm all for it. Actually it sounds more like bugfix since atm web2py
> > can't make datetime queries on Oracle.
> >
> > On Mon, Apr 19, 2010 at 6:16 PM, mdipierro 
> wrote:
> > > There is no hook for this, but should this not be always the default?
> > > If so I am happy to add it to trunk. Any counterindication?
> >
> > > On Apr 19, 12:32 am, Alexey Nezhdanov  wrote:
> > > > Hi.
> > > > Sometimes I have to execute this line prior to making a query:
> > > > oradb.executesql("ALTER SESSION set NLS_DATE_FORMAT = '-MM-DD
> > > > HH24:MI:SS';")
> >
> > > > That is because Oracle by default uses different date format that
> causes
> > > my
> > > > queries to fail.
> > > > The problem is that doing that in model is incorrect - this should be
> > > > executed just once for each db connection.
> > > > Doing that just prior to query is inconvenient and still incorrect -
> I am
> > > > probably reusing same connection.
> > > > Can I somehow tell web2py to execute this sql right after calling
> > > connect()?
> >
> > > > Regards
> > > > Alexey
> >
> > > > --
> > > > Subscription settings:
> > >http://groups.google.com/group/web2py/subscribe?hl=en
>


Re: [web2py] Re: can I hook my code to db.connect() ?

2010-04-19 Thread Alexey Nezhdanov
Ah, one more little comment though. In two cases select yielded an empty
list - that is intentional.

On Tue, Apr 20, 2010 at 9:37 AM, Alexey Nezhdanov  wrote:

> Oh, well.
> May be that's an Oracle bug then. I use my custom 'console.py' script here,
> but output should be clear enough:
>
> BTW - time_start column was created by web2py with this line:
> Field('time_start','datetime'),
>
> sn...@nezhdanov:~/VTC/pinger/elixir$ ./console.py
> select time_start from pinger_results where id=1;
> [('TIME_START', , 23, 7, 0, 0, 1)]
> select time_start from pinger_results where time_start='2010-04-20
> 15:16:17';
> ORA-01861: литерал не соответствует формату строки
>
> ALTER SESSION set NLS_DATE_FORMAT = '-MM-DD HH24:MI:SS'
> ok
> select time_start from pinger_results where time_start='2010-04-20
> 15:16:17';
> [('TIME_START', , 23, 7, 0, 0, 1)]
> ==
> no comments
>
> Alexey
>
>
> On Mon, Apr 19, 2010 at 8:27 PM, mdipierro wrote:
>
>> taking a second look at the source code
>>
>>self._execute("ALTER SESSION SET NLS_DATE_FORMAT = '-
>> MM-DD';")
>>self._execute("ALTER SESSION SET NLS_TIMESTAMP_FORMAT =
>> '-MM-DD HH24:MI:SS';")
>>
>> Now you propose adding:
>>
>>self._execute("ALTER SESSION set NLS_DATE_FORMAT = '-
>> MM-DD HH24:MI:SS';")
>>
>> But date does not have HH224, MI, SS, only timestamp does.
>>
>> On Apr 19, 11:19 am, Alexey Nezhdanov  wrote:
>> > No, I'm all for it. Actually it sounds more like bugfix since atm web2py
>> > can't make datetime queries on Oracle.
>> >
>> > On Mon, Apr 19, 2010 at 6:16 PM, mdipierro 
>> wrote:
>> > > There is no hook for this, but should this not be always the default?
>> > > If so I am happy to add it to trunk. Any counterindication?
>> >
>> > > On Apr 19, 12:32 am, Alexey Nezhdanov  wrote:
>> > > > Hi.
>> > > > Sometimes I have to execute this line prior to making a query:
>> > > > oradb.executesql("ALTER SESSION set NLS_DATE_FORMAT =
>> '-MM-DD
>> > > > HH24:MI:SS';")
>> >
>> > > > That is because Oracle by default uses different date format that
>> causes
>> > > my
>> > > > queries to fail.
>> > > > The problem is that doing that in model is incorrect - this should
>> be
>> > > > executed just once for each db connection.
>> > > > Doing that just prior to query is inconvenient and still incorrect -
>> I am
>> > > > probably reusing same connection.
>> > > > Can I somehow tell web2py to execute this sql right after calling
>> > > connect()?
>> >
>> > > > Regards
>> > > > Alexey
>> >
>> > > > --
>> > > > Subscription settings:
>> > >http://groups.google.com/group/web2py/subscribe?hl=en
>>
>
>


[web2py] Re: Trouble starting web2py

2010-04-19 Thread szimszon
Okay. I'll wait :)

1.77.3 isn't working yet...

On ápr. 19, 22:58, mdipierro  wrote:
> Mind that this is not the end of the story. The simplejson that ships
> with web2py was modified to handle date/datetime/time. By replacing
> with the latest official simplejson you will may not be able to
> serialize DAL records.
>
> One option is to include latest web2py in web2py and re-apply the
> patch. we will do so in 1.77.x but it would be useful to get to the
> bottom of why this problem arose in the first place.
>
> Masismo
>
> On Apr 19, 3:36 pm, szimszon  wrote:
>
>
>
> > Okay, copy "/usr/share/pyshared/simplejson" to gluon/contrib seems to
> > work for me.
>
> > BigTNX. (1.77.2 :)
>
> > On ápr. 19, 22:25, mdipierro  wrote:
>
> > > try copy simplejson into gluon/contrib/simplejson for now.
>
> > > On Apr 19, 3:23 pm, szimszon  wrote:
>
> > > > I can't run it (1.77.1) even if I installed the simplejson 1.9.2 in
> > > > virtualenv:
>
> > > > >>> sys.path
>
> > > > ['', '/home/szimszon/.virtualenvs/web2py/lib/python2.5/site-packages/
> > > > setuptools-0.6c11-py2.5.egg', '/home/szimszon/.virtualenvs/web2py/lib/
> > > > python2.5/site-packages/simplejson-1.9.2-py2.5.egg'...
>
> > > > On ápr. 19, 13:58, szimszon  wrote:
>
> > > > > I got the some traceback as before :(
>
> > > > > >>> sys.path
>
> > > > > ['', '/home/szimszon/.virtualenvs/web2py/lib/python2.5/site-packages/
> > > > > setuptools-0.6c11-py2.5.egg', '/usr/lib/pymodules/python2.5', '/home/
> > > > > szimszon/.virtualenvs/web2py/lib/python2.5', '/home/
> > > > > szimszon/.virtualenvs/web2py/lib/python2.5/plat-linux2', '/home/
> > > > > szimszon/.virtualenvs/web2py/lib/python2.5/lib-tk', '/home/
> > > > > szimszon/.virtualenvs/web2py/lib/python2.5/lib-dynload', '/usr/lib/
> > > > > python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-
> > > > > tk', '/home/szimszon/.virtualenvs/web2py/lib/python2.5/site-packages',
> > > > > '/usr/local/lib/python2.5/site-packages', '/usr/lib/python2.5/site-
> > > > > packages', '/usr/lib/python2.5/site-packages/PIL', 
> > > > > '/usr/lib/python2.5/
> > > > > site-packages/gst-0.10', '/usr/lib/pymodules/python2.5/gtk-2.0', 
> > > > > '/usr/
> > > > > lib/python2.5/site-packages/wx-2.6-gtk2-unicode']
>
> > > > > On ápr. 19, 13:30, Mathieu Clabaut  wrote:
>
> > > > > > I use 
> > > > > > virtualenvwrapperhttp://www.doughellmann.com/docs/virtualenvwrapper/which
> > > > > > seems to work like a charm.
>
> > > > > > export WORKON_HOME=$HOME/.virtualenvs
> > > > > > source /usr/bin/virtualenvwrapper.sh # put those 2 lines in your
> > > > > > $HOME/.bashrc
> > > > > > mkvirtualenv web2py
>
> > > > > > From here, you just have to type :
> > > > > > workon web2py
>
> > > > > > berfore launching web2py.
>
> > > > > > It is not a web2py solution, but it may help in the meanwhile.
>
> > > > > > -Mathieu
>
> > > > > > On Mon, Apr 19, 2010 at 13:15, szimszon  wrote:
> > > > > > > Is there now a quick way to start web2py without removing 
> > > > > > > simplejson
> > > > > > > from debian?
>
> > > > > > > Tnx.
>
> > > > > > > On ápr. 11, 16:23, mdipierro  wrote:
> > > > > > > > What's your advice about this?
>
> > > > > > > > Out r version of simplejson is patched to serialize dates. We 
> > > > > > > > could
> > > > > > > > upgrade to the latest and re-patch and for now this problem 
> > > > > > > > will go
> > > > > > > > away but this is not a long term solution. Clearly we must 
> > > > > > > > change
> > > > > > > > something in the way simplejson is imported to avoid conflict.
>
> > > > > > > > Massimo
>
> > > > > > > > On Apr 11, 4:30 am, muybay  wrote:
>
> > > > > > > > > I have the issue also. I am going to try this suggestion and 
> > > > > > > > > possibly
> > > > > > > > > diff the two versions (upgraded vs web2py simplejson).
>
> > > > > > > > > On Apr 8, 8:00 am, mdipierro  wrote:
>
> > > > > > > > > > One solution is to upgrade thesimplejsonthat comes with 
> > > > > > > > > > web2py. The
> > > > > > > > > > problem is that the one we use has been modified to handle 
> > > > > > > > > > dates.
>
> > > > > > > > > > On Apr 8, 4:27 am, Johann Spies  
> > > > > > > > > > wrote:
>
> > > > > > > > > > > Removing Debian's python-simplejsonhelped me to start 
> > > > > > > > > > > web2py again
> > > > > > > -
> > > > > > > > > > > and broke some other stuff on Debian.
>
> > > > > > > > > > > Regards
> > > > > > > > > > > Johann
> > > > > > > > > > > --
> > > > > > > > > > >        "Every good gift and every perfect gift is from 
> > > > > > > > > > > above,
> > > > > > > > > > >       and cometh down from the Father of lights, with whom
> > > > > > > > > > >       is no variableness, neither shadow of turning."
> > > > > > > > > > >                              James 1:17
>
> > > > > > > --
> > > > > > > Subscription settings:
> > > > > > >http://groups.google.com/group/web2py/subscribe?hl=en