[web2py] Re: Markmin - could we use instead of ?

2012-03-25 Thread villas
Many thanks!


[web2py] auth profile redirect

2012-03-25 Thread Hassan Alnatour
Dear ALL ,

How can i redirect the user after he saves his profile ?


[web2py] Acces a page with @auth.requires_login() don't work

2012-03-25 Thread bussiere adrien
i've created and logged my user with :

password="toto"
my_crypt = CRYPT(key=auth.settings.hmac_key)
crypt_pass = my_crypt(password)[0]
user = db.auth_user.insert(
   Surnom="Surnom",
   email="email",
   password=crypt_pass,
   )
db.commit()
session.auth = 
Storage(user=user,expiration=auth.settings.expiration,hmac_key=str(uuid4()))
auth.login_bare(user,password)
and i have no error

but when i wan to access a page with :
@auth.requires_login()

it don't work
Ragrds
Bussiere



[web2py] Windows Service: No module named gluon.winservice

2012-03-25 Thread haggis
Hello,
I'm trying to start web2py as a Windows (XP) service. After installing the 
pywin32 extension all errors at command line were gone. However, the 
service doesn't start.

This is what happens:

#python web2py.py -W install
- no errors -

#python web2py.py -W start
[...]
Starting hardcron...
Starting service web2py

-> cannot access any web2py application!

#python web2py.py -W stop
[...]
Starting hardcron...
Stopping service web2py
Error stopping service: The service was not started. (1062)


Looking at the WinXP EventLog, I see the following:
"Python could not import the service's module
ImportError: No module named gluon.winservice"


Do you need further information?

Regards, Patrick


[web2py] Re: auth profile redirect

2012-03-25 Thread Anthony
auth.settings.profile_next = URL(...)

Note, that should already be set to URL('default', 'index') (assuming your 
auth user() function is in the default.py controller).

Anthony

On Sunday, March 25, 2012 5:26:08 AM UTC-4, Hassan Alnatour wrote:
>
> Dear ALL , 
>
> How can i redirect the user after he saves his profile ?



[web2py] Re: Windows Service: No module named gluon.winservice

2012-03-25 Thread haggis
Using web2py 1.99.4 stable


[web2py] Re: Acces a page with @auth.requires_login() don't work

2012-03-25 Thread Sushant Taneja
Just a thought here, but have you tried logging out and logging in again 
with the same password. Does it work ?

On Sunday, March 25, 2012 3:47:53 PM UTC+5:30, bussiere adrien wrote:
>
> i've created and logged my user with :
>
> password="toto"
> my_crypt = CRYPT(key=auth.settings.hmac_​key)
> crypt_pass = my_crypt(password)[0]
> user = db.auth_user.insert(
>Surnom="Surnom",
>email="email",
>password=crypt_pass​,
>)
> db.commit()
> session.auth = 
> Storage(user=user,expiration=a​uth.settings.expiration,hmac_​key=str(uuid4()))
> auth.login_bare(user,password)
> and i have no error
>
> but when i wan to access a page with :
> @auth.requires_login()
>
> it don't work
> Ragrds
> Bussiere
>
>

[web2py] Re: Acces a page with @auth.requires_login() don't work

2012-03-25 Thread bussiere adrien
How to log out in command line ?
But the main goal is that i want to tempory log a user with a dummy 
password.
He gives me the invitation i log him with a pre user made myself with the 
invitation as the password.
And them i give him a form inscription to make a full user.

So i need to log him myself.

Bussiere


Le dimanche 25 mars 2012 16:50:36 UTC+2, Sushant Taneja a écrit :
>
> Just a thought here, but have you tried logging out and logging in again 
> with the same password. Does it work ?
>
> On Sunday, March 25, 2012 3:47:53 PM UTC+5:30, bussiere adrien wrote:
>>
>> i've created and logged my user with :
>>
>> password="toto"
>> my_crypt = CRYPT(key=auth.settings.hmac_​​key)
>> crypt_pass = my_crypt(password)[0]
>> user = db.auth_user.insert(
>>Surnom="Surnom",
>>email="email",
>>password=crypt_pass​​,
>>)
>> db.commit()
>> session.auth = 
>> Storage(user=user,expiration=a​​uth.settings.expiration,hmac_​​key=str(uuid4()))
>> auth.login_bare(user,password)
>> and i have no error
>>
>> but when i wan to access a page with :
>> @auth.requires_login()
>>
>> it don't work
>> Ragrds
>> Bussiere
>>
>>

[web2py] 10.24$ reward for a recipe logging a user

2012-03-25 Thread bussiere adrien
I want to create myself a user then log him.
This for an open source project : https://github.com/bussiere/jackpoint 
I've been on it for 3 days now.

I want to create a user then loggin him and auth him.
If you find it just give me your paypal in private buy you a drink.

Here is my code :
def test():

  password="toto"
my_crypt = CRYPT(key=auth.settings.hmac_key)
crypt_pass = my_crypt(password)[0]
user = db.auth_user.insert(
   Surnom="Surnom",
   email="email5@toto",
   username="titi",
   password=crypt_pass,
   )
db.commit()

user = auth.login_bare("titi",password)
session.auth = 
Storage(user=user,expiration=auth.settings.expiration,hmac_key=str(uuid4()))
redirect(URL('inscriptioninvit'))

@auth.requires_login()
def inscriptioninvit():
 return "hello"



[web2py] Documentation suggestion

2012-03-25 Thread Keith Edmunds
If something like this has already been suggested, please point me at the
earlier discussion.

I've read the Web2py manual (and bought three of them) since v1, and the
quality of both web2py and the manual has improved hugely.

To my mind, however, the manual tries to fulfil two roles currently: it is
a "howto" manual with lots of developed examples, and it is a reference
manual. I think the two functions should be split to two documents.

Rationale: the current format requires that the reference material be
spread throughout the book. A simple example: look up the 'URL' helper
function. The helper functions are listed in "Views" chapter, and indeed
the URL function is included in the list under "HTML helpers". However, it
is actually defined in the previous chapter ("Core"). The tutorial nature
of the manual requires it be discussed in core, but the reference nature
of the manual suggests it should be under HTML helpers.

This isn't the only example. It also isn't a criticism: as a single
document, the manual is about as good as it could be. My question is
simply: is it time to split it up?
-- 
"You can have everything in life you want if you help enough other people
get what they want" - Zig Ziglar. 

Who did you help today?


Re: [web2py] 10.24$ reward for a recipe logging a user

2012-03-25 Thread Vasile Ermicioi
that works for me

def test():
password="toto"
my_crypt = CRYPT(key=auth.settings.hmac_key)
crypt_pass = my_crypt(password)[0]
if db(db.auth_user.email == 'email5@toto').count() == 0:
db.auth_user.insert(
   Surnom="Surnom",
   email="email5@toto",
   username="titi",
   password=crypt_pass,
)
db.commit()
user = auth.login_bare("titi",password)
redirect(URL(request.controller, 'inscriptioninvit'))
return dict()

@auth.requires_login()
def inscriptioninvit():
 return "hello"


Re: [web2py] 10.24$ reward for a recipe logging a user

2012-03-25 Thread bussiere adrien
It still redirect me to the the auth page with the login form 

Bussiere

Le dimanche 25 mars 2012 19:37:44 UTC+2, Vasile Ermicioi a écrit :
>
> that works for me
>
> def test():
> password="toto"
> my_crypt = CRYPT(key=auth.settings.hmac_​key)
> crypt_pass = my_crypt(password)[0]
> if db(db.auth_user.email == 'email5@toto').count() == 0:
> db.auth_user.insert(
>Surnom="Surnom",
>email="email5@toto",
>username="titi",
>password=crypt_pass,
> )
> db.commit()  
> user = auth.login_bare("titi",​password)
> redirect(URL(request.​controller, 'inscriptioninvit'))
> return dict()
>
> @auth.requires_login()
> def inscriptioninvit():
>  return "hello"
>


Re: [web2py] Re: DAL or SQL?

2012-03-25 Thread Keith Edmunds
On Mon, 19 Mar 2012 14:45:51 -0700 (PDT), niph...@gmail.com said:

> for every "period", duration is calculated as:
> duration = db.periods.end_time.seconds() -
> db.periods.start_time.seconds()

This is wrong.

I reworked my data model so that the period start and stop fields were of
type datetime. I then found the flaw in your logic above: the seconds()
method returns the value of the seconds part of the datetime rather than
the number of seconds of the duration.

You can see this below. For one row (id==257), these are the values:



So, start at 18:18:54 today, stop at 18:19:01, so the duration should be 6
seconds. However:

>>> duration = db.t_periods.f_end.seconds() -
>>> db.t_periods.f_start.seconds()
result = db(db.t_periods.id==257).select(db.t_periods.id,duration)
>>> for r in result:
...  print r
... 
 at
0xa15e1b4>, 't_periods_archive': ,
0xa15e1b4>'id': 257, 'delete_record':  at 0xa15e10c>}>,
0xa15e1b4>'_extra': web2py_extract('second',t_periods.f_start))": -53}>}>

...giving -53 seconds. In other words, it is the difference in the value
of seconds rather than the duration.
-- 
"You can have everything in life you want if you help enough other people
get what they want" - Zig Ziglar. 

Who did you help today?


[web2py] _title tag for looped OPTION attribute

2012-03-25 Thread web-dev-m
I may not be following some sort of convention, but I'm trying to
build a selector form element with a for loop from a query.  It
renders when i do it manually:





Howerver,

when I do:
files=db(myquery).select()
files_as_list=[]
for x in files:
files_as_list+=(OPTION(x.resource_title[0:50], value=x.id,
_title=x.resource_title, ))

the resulting html doesnt have the title attribute.  I am running
1.99.2.

Any suggestions?



Re: [web2py] 10.24$ reward for a recipe logging a user

2012-03-25 Thread villas
Suggestion 1:  
check whether 'user' has a value after this line:
>>user = auth.login_bare("titi",​password) 
If user is None then maybe you didn't create the user properly.  

Suggestion 2:
This function may be useful:   (in Auth)  get_or_create_user()
I don't think it is documented in the book at present.


On Sunday, 25 March 2012 19:45:51 UTC+1, bussiere adrien wrote:
>
> It still redirect me to the the auth page with the login form 
>
> Bussiere
>
> Le dimanche 25 mars 2012 19:37:44 UTC+2, Vasile Ermicioi a écrit :
>>
>> that works for me
>>
>> def test():
>> password="toto"
>> my_crypt = CRYPT(key=auth.settings.hmac_​​key)
>> crypt_pass = my_crypt(password)[0]
>> if db(db.auth_user.email == 'email5@toto').count() == 0:
>> db.auth_user.insert(
>>Surnom="Surnom",
>>email="email5@toto",
>>username="titi",
>>password=crypt_pass,
>> )
>> db.commit()  
>> user = auth.login_bare("titi",​​password)
>> redirect(URL(request.​​controller, 'inscriptioninvit'))
>> return dict()
>>
>> @auth.requires_login()
>> def inscriptioninvit():
>>  return "hello"
>>
>

Re: [web2py] 10.24$ reward for a recipe logging a user

2012-03-25 Thread bussiere adrien
it's created i've made a page to list all user for debugging and i see the 
new users :/

The project is here :
https://github.com/bussiere/jackpoint/blob/master/applications/init/controllers/default.py
  

i've made a function to list user and it work the user is created.

Bussiere

Le dimanche 25 mars 2012 22:39:20 UTC+2, villas a écrit :
>
> Suggestion 1:  
> check whether 'user' has a value after this line:
> >>user = auth.login_bare("titi",​​password) 
> If user is None then maybe you didn't create the user properly.  
>
> Suggestion 2:
> This function may be useful:   (in Auth)  get_or_create_user()
> I don't think it is documented in the book at present.
>
>
> On Sunday, 25 March 2012 19:45:51 UTC+1, bussiere adrien wrote:
>>
>> It still redirect me to the the auth page with the login form 
>>
>> Bussiere
>>
>> Le dimanche 25 mars 2012 19:37:44 UTC+2, Vasile Ermicioi a écrit :
>>>
>>> that works for me
>>>
>>> def test():
>>> password="toto"
>>> my_crypt = CRYPT(key=auth.settings.hmac_​​​key)
>>> crypt_pass = my_crypt(password)[0]
>>> if db(db.auth_user.email == 'email5@toto').count() == 0:
>>> db.auth_user.insert(
>>>Surnom="Surnom",
>>>email="email5@toto",
>>>username="titi",
>>>password=crypt_pass,
>>> )
>>> db.commit()  
>>> user = auth.login_bare("titi",​​​password)
>>> redirect(URL(request.​​​controller, 'inscriptioninvit'))
>>> return dict()
>>>
>>> @auth.requires_login()
>>> def inscriptioninvit():
>>>  return "hello"
>>>
>>

[web2py] Re: _title tag for looped OPTION attribute

2012-03-25 Thread Alan Etkin
option = OPTION(...)
option["_title"] = "test test"

doesn't work either?

On 25 mar, 17:25, web-dev-m  wrote:
> I may not be following some sort of convention, but I'm trying to
> build a selector form element with a for loop from a query.  It
> renders when i do it manually:
>
> 
> 
> 
>
> Howerver,
>
> when I do:
>     files=db(myquery).select()
>     files_as_list=[]
>     for x in files:
>         files_as_list+=(OPTION(x.resource_title[0:50], value=x.id,
> _title=x.resource_title, ))
>
> the resulting html doesnt have the title attribute.  I am running
> 1.99.2.
>
> Any suggestions?


[web2py] Re: web2py rocket error on vps

2012-03-25 Thread Unyo
I finally figured out why this is happens. If you have a small VPN like i 
do (tinyvpn on ipxcore, 96MB ram), the thread size (8MB) will cause a very 
small amount of threads to be allowed. 

To fix this, enter the command below:

ulimit -s 1024

http://www.alak.cc/2011/11/python-threaderror-cant-start-new.html 
http://adywicaksono.wordpress.com/2007/07/10/i-can-not-create-more-than-255-threads-on-linux-what-is-the-solutions/
 

Related error message:

File "/usr/lib/python2.6/threading.py", line 474, in start
_start_new_thread(self.__bootstrap, ())
thread.error: can't start new thread

Hope this helps someone in the future trying to run this great web 
framework on a minimal server!

On Thursday, December 22, 2011 5:28:19 PM UTC-10, Cody M wrote:
>
> I'm getting this error with the latest version of web2py as well. Which is 
> confusing, since all the web2py's I've used before the most recent version 
> has 
> worked fine.
>
>
>

[web2py] Re: Error deploying at djangoeurope with Rocket and webproxy.

2012-03-25 Thread Cody Moniz
Try doing this before starting web2py:

ulimit -s 1024



[web2py] Re: Windows Service: No module named gluon.winservice

2012-03-25 Thread Massimo Di Pierro


On Sunday, 25 March 2012 08:47:41 UTC-5, haggis wrote:
>
> Hello,
> I'm trying to start web2py as a Windows (XP) service. After installing the 
> pywin32 extension all errors at command line were gone. However, the 
> service doesn't start.
>
> This is what happens:
>
> #python web2py.py -W install
> - no errors -
>
> #python web2py.py -W start
> [...]
> Starting hardcron...
> Starting service web2py
>
> -> cannot access any web2py application!
>
> #python web2py.py -W stop
> [...]
> Starting hardcron...
> Stopping service web2py
> Error stopping service: The service was not started. (1062)
>
>
> Looking at the WinXP EventLog, I see the following:
> "Python could not import the service's module
> ImportError: No module named gluon.winservice"
>
>
> Do you need further information?
>
> Regards, Patrick
>


[web2py] Re: Windows Service: No module named gluon.winservice

2012-03-25 Thread Massimo Di Pierro
Looks like it is not finding the gluon folder. Please open a ticket and I 
will look at it asap.

Massimo

On Sunday, 25 March 2012 08:47:41 UTC-5, haggis wrote:
>
> Hello,
> I'm trying to start web2py as a Windows (XP) service. After installing the 
> pywin32 extension all errors at command line were gone. However, the 
> service doesn't start.
>
> This is what happens:
>
> #python web2py.py -W install
> - no errors -
>
> #python web2py.py -W start
> [...]
> Starting hardcron...
> Starting service web2py
>
> -> cannot access any web2py application!
>
> #python web2py.py -W stop
> [...]
> Starting hardcron...
> Stopping service web2py
> Error stopping service: The service was not started. (1062)
>
>
> Looking at the WinXP EventLog, I see the following:
> "Python could not import the service's module
> ImportError: No module named gluon.winservice"
>
>
> Do you need further information?
>
> Regards, Patrick
>


[web2py] Re: Documentation suggestion

2012-03-25 Thread Massimo Di Pierro
Good point. Not split it up but we need a second more introductory, manual.

massimo

On Sunday, 25 March 2012 12:00:44 UTC-5, backseat wrote:
>
> If something like this has already been suggested, please point me at the
> earlier discussion.
>
> I've read the Web2py manual (and bought three of them) since v1, and the
> quality of both web2py and the manual has improved hugely.
>
> To my mind, however, the manual tries to fulfil two roles currently: it is
> a "howto" manual with lots of developed examples, and it is a reference
> manual. I think the two functions should be split to two documents.
>
> Rationale: the current format requires that the reference material be
> spread throughout the book. A simple example: look up the 'URL' helper
> function. The helper functions are listed in "Views" chapter, and indeed
> the URL function is included in the list under "HTML helpers". However, it
> is actually defined in the previous chapter ("Core"). The tutorial nature
> of the manual requires it be discussed in core, but the reference nature
> of the manual suggests it should be under HTML helpers.
>
> This isn't the only example. It also isn't a criticism: as a single
> document, the manual is about as good as it could be. My question is
> simply: is it time to split it up?
> -- 
> "You can have everything in life you want if you help enough other people
> get what they want" - Zig Ziglar. 
>
> Who did you help today?
>
>

[web2py] Re: 10.24$ reward for a recipe logging a user

2012-03-25 Thread Massimo Di Pierro
I have been on the road and hard to keep up up with posts. If this issue is 
still open please open a ticket so it can be tracked.

On Sunday, 25 March 2012 11:57:20 UTC-5, bussiere adrien wrote:
>
> I want to create myself a user then log him.
> This for an open source project : 
> https://github.com/bussiere/​jackpoint
>  
> I've been on it for 3 days now.
>
> I want to create a user then loggin him and auth him.
> If you find it just give me your paypal in private buy you a drink.
>
> Here is my code :
> def test():
>
>   password="toto"
> my_crypt = CRYPT(key=auth.settings.hmac_​key)
> crypt_pass = my_crypt(password)[0]
> user = db.auth_user.insert(
>Surnom="Surnom",
>email="email5@toto"​,
>username="titi",
>password=crypt_pass​,
>)
> db.commit()
> 
> user = auth.login_bare("titi",passwor​d)
> session.auth = 
> Storage(user=user,expiration=a​uth.settings.expiration,hmac_​key=str(uuid4()))
> redirect(URL('​inscriptioninvit'))
>
> @auth.requires_login()
> def inscriptioninvit():
>  return "hello"
>
>

[web2py] Re: _title tag for looped OPTION attribute

2012-03-25 Thread Massimo Di Pierro
works for me.

$ python web2py.py -S welcome
>>> print OPTION(_title='test',_value='x')



On Sunday, 25 March 2012 16:34:51 UTC-5, Alan Etkin wrote:

> option = OPTION(...) 
> option["_title"] = "test test" 
>
> doesn't work either? 
>
> On 25 mar, 17:25, web-dev-m  wrote: 
> > I may not be following some sort of convention, but I'm trying to 
> > build a selector form element with a for loop from a query.  It 
> > renders when i do it manually: 
> > 
> >  
> >  
> >  
> > 
> > Howerver, 
> > 
> > when I do: 
> > files=db(myquery).select() 
> > files_as_list=[] 
> > for x in files: 
> > files_as_list+=(OPTION(x.​resource_title[0:50], value=x.id, 
> > _title=x.resource_title, )) 
> > 
> > the resulting html doesnt have the title attribute.  I am running 
> > 1.99.2. 
> > 
> > Any suggestions?



Re: [web2py] Re: DAL or SQL?

2012-03-25 Thread Niphlod
Doh, you're right. All the "datetime" api on fields are extracting, not 
converting the actual value
At this point you can sum up years difference, month difference, etc etc 
etc separately and then extract the time passed by.
.
duration_ye = (db.periods.end_time.year() - 
db.periods.start_time.year()).sum()
duration_mo = (db.periods.end_time.month() - 
db.periods.start_time.month()).sum()
duration_da = (db.periods.end_time.day() - 
db.periods.start_time.day()).sum()
.

This will be a "itchy" shot anyway even if you know that the months 
difference is "1" you can't really say how many days passed

Maybe at this stage is better to save unix time, that is an integer, and 
proceed simply with

duration = (db.periods.end_time - db.periods.start_time).sum()

Or, having the application filling in the seconds elapsed when it 
completes something like
period_to_update = db(db.periods.id==1).select().first()
start_time = period_to_update.start_time
period_to_update.update_record(end_time=request.now, 
seconds_elapsed=(request.now - start_time).seconds)

Sorry for the wrong previous advices, really, I should have tested with all 
kinds of values (instead of 2012-01-01 00:00:00 and 2012-01-01 00:00:15).


[web2py] Re: Bug? The DAL gives different SQL when query is provided as string.

2012-03-25 Thread Niphlod
is that because of the "extra" () ?
every time you call db() the where clause gets "encapsulated" in a pair of 
parenthesis.

db(db.auth_user.id>0)(db.auth_user.email==localhost)

and

db((db.auth_user.id>0) & (db.auth_user.email==localhost))

give you different raw strings, but the same exact result.



Il giorno sabato 24 marzo 2012 21:49:58 UTC+1, Limedrop ha scritto:
>
> I've copied this from the bottom of another thread. 
>
>
> The DAL gives different SQL when a query is provided in string format. 
> Is this a bug, or should I not expect this to work? 
>
>
> See the example below, the first SQL works, the second SQL raises an 
> error. 
>
>
> >>>from gluon.dal import Query 
> >>>query = (db.comment.id > 0) & (db.webpage.title == 'FAQ') & 
> (db.comment.page_id == db.webpage.id) 
> >>>query_as_string = str(query) 
> >>>query_from_string = Query(db, query_as_string) 
> >>>print db(query)._select(db.comment.​body) 
>
> SELECT  comment.body FROM comment, webpage WHERE (((comment.id > 0) 
> AND (webpage.title = 'FAQ')) AND (comment.page_id = webpage.id)); 
>
>
> >>>print db(query_from_string)._select(​db.comment.body) 
>
> SELECT  comment.body FROM comment WHERE comment.id > 0) AND 
> (webpage.title = 'FAQ')) AND (comment.page_id = webpage.id))); 
>
>
>
> Why do this?  If the were possible it would enable you to easily save 
> a query in the session.  For example: 
>
> ==Controller 1== 
> query1 = (db.comment.id > 0) & (db.webpage.title == 'FAQ') & 
> (db.comment.page_id == db.webpage.id) 
> session.query = str(query1) 
>
> ==Controller 2== 
> from gluon.dal import Query 
> query2 = Query(db, session.query) 
>
>
> This does NOT work because the DAL gives different SQL for query1 and 
> query2.



[web2py] Re: Bug? The DAL gives different SQL when query is provided as string.

2012-03-25 Thread Limedrop
The difference is in the FROM clause.  In the second SQL the webpage
table is missing.

On Mar 26, 12:51 pm, Niphlod  wrote:
> is that because of the "extra" () ?
> every time you call db() the where clause gets "encapsulated" in a pair of
> parenthesis.
>
> db(db.auth_user.id>0)(db.auth_user.email==localhost)
>
> and
>
> db((db.auth_user.id>0) & (db.auth_user.email==localhost))
>
> give you different raw strings, but the same exact result.
>
> Il giorno sabato 24 marzo 2012 21:49:58 UTC+1, Limedrop ha scritto:
>
>
>
>
>
>
>
>
>
> > I've copied this from the bottom of another thread.
>
> > The DAL gives different SQL when a query is provided in string format.
> > Is this a bug, or should I not expect this to work?
>
> > See the example below, the first SQL works, the second SQL raises an
> > error.
>
> > >>>from gluon.dal import Query
> > >>>query = (db.comment.id > 0) & (db.webpage.title == 'FAQ') &
> > (db.comment.page_id == db.webpage.id)
> > >>>query_as_string = str(query)
> > >>>query_from_string = Query(db, query_as_string)
> > >>>print db(query)._select(db.comment.​body)
>
> > SELECT  comment.body FROM comment, webpage WHERE (((comment.id > 0)
> > AND (webpage.title = 'FAQ')) AND (comment.page_id = webpage.id));
>
> > >>>print db(query_from_string)._select(​db.comment.body)
>
> > SELECT  comment.body FROM comment WHERE comment.id > 0) AND
> > (webpage.title = 'FAQ')) AND (comment.page_id = webpage.id)));
>
> > Why do this?  If the were possible it would enable you to easily save
> > a query in the session.  For example:
>
> > ==Controller 1==
> > query1 = (db.comment.id > 0) & (db.webpage.title == 'FAQ') &
> > (db.comment.page_id == db.webpage.id)
> > session.query = str(query1)
>
> > ==Controller 2==
> > from gluon.dal import Query
> > query2 = Query(db, session.query)
>
> > This does NOT work because the DAL gives different SQL for query1 and
> > query2.


[web2py] Re: 10.24$ reward for a recipe logging a user

2012-03-25 Thread bussiere adrien
it's more a logical problem than your framework.

I just want to know how to log a user.

Bussiere

Le lundi 26 mars 2012 01:35:04 UTC+2, Massimo Di Pierro a écrit :
>
> I have been on the road and hard to keep up up with posts. If this issue 
> is still open please open a ticket so it can be tracked.
>
> On Sunday, 25 March 2012 11:57:20 UTC-5, bussiere adrien wrote:
>>
>> I want to create myself a user then log him.
>> This for an open source project : 
>> https://github.com/bussiere/​​jackpoint
>>   
>> I've been on it for 3 days now.
>>
>> I want to create a user then loggin him and auth him.
>> If you find it just give me your paypal in private buy you a drink.
>>
>> Here is my code :
>> def test():
>>
>>   password="toto"
>> my_crypt = CRYPT(key=auth.settings.hmac_​​key)
>> crypt_pass = my_crypt(password)[0]
>> user = db.auth_user.insert(
>>Surnom="Surnom",
>>email="email5@toto"​​,
>>username="titi",
>>password=crypt_pass​​,
>>)
>> db.commit()
>> 
>> user = auth.login_bare("titi",passwor​​d)
>> session.auth = 
>> Storage(user=user,expiration=a​​uth.settings.expiration,hmac_​​key=str(uuid4()))
>> redirect(URL('​​inscriptioninvit'))
>>
>> @auth.requires_login()
>> def inscriptioninvit():
>>  return "hello"
>>
>>

[web2py] Re: Documentation suggestion

2012-03-25 Thread weheh
I think I made this point a couple of years ago. I'm too lazy to go
and try to dig up the thread. Here's my 10 cents.

I agree strongly that the current manual tries to be both introductory
tutorial and reference. I also agree it's been hugely improved since
v1 and is extremely useful. The cookbook should also prove to be a
valuable resource.

However, as a rare divergence in opinion from Massimo's, I strongly
DISAGREE that we need a second, more introductory manual. Instead, I
think we need a very concise, very dense reference manual. Here's my
rationale.

Although the v2 and v3 manuals have been made searchable online, the
information about certain commands is still spread out all over the
place. The way the manual works, it takes a long time to download, the
TOC of each chapter to render, and then for the search to paginate you
to the appropriate place in the doc. That's cumbersome, but it works
IF you know what to search for. There is no index. And even if you do
have the right search term, you often end up having to look in
multiple chapters. In some cases, there's a lot of verbiage to consume
as well.

I suggest we, as a community, invest time in a unix-like man page or
python-like doc reference. Each command of web2py to be listed, one to
a "page". Each command should have its complete signature described in
gory detail. In cases like Auth, there needs to be a complete listing
and description of its many class variables. There absolutely has to
be a cross-linked index, which should be the primary point of entry
into the document. The reference should be searchable as well. Each
web2py command/helper/whatever needs to have a short example. One
thing I don't like about python doc is that it's extremely slim on
examples vs. unix manuals, which have always had some short example or
two.

I think web2py has enough tutorial material for the time being. I'm
not saying it can't be improved. But if we split out a reference, it
will make tutorials easier to create in the future. Tutorials could
then be more task-directed, like the cookbook. And whenever a new
command or thingie gets added to web2py it can be easily added to the
reference.


[web2py] Re: Windows Service: No module named gluon.winservice

2012-03-25 Thread haggis
Thank you, Massimo!
Here's the ticket: http://code.google.com/p/web2py/issues/detail?id=733

Am Montag, 26. März 2012 01:30:05 UTC+2 schrieb Massimo Di Pierro:
>
> Looks like it is not finding the gluon folder. Please open a ticket and I 
> will look at it asap.
>
> Massimo
>
> On Sunday, 25 March 2012 08:47:41 UTC-5, haggis wrote:
>>
>> Hello,
>> I'm trying to start web2py as a Windows (XP) service. After installing 
>> the pywin32 extension all errors at command line were gone. However, the 
>> service doesn't start.
>>
>> This is what happens:
>>
>> #python web2py.py -W install
>> - no errors -
>>
>> #python web2py.py -W start
>> [...]
>> Starting hardcron...
>> Starting service web2py
>>
>> -> cannot access any web2py application!
>>
>> #python web2py.py -W stop
>> [...]
>> Starting hardcron...
>> Stopping service web2py
>> Error stopping service: The service was not started. (1062)
>>
>>
>> Looking at the WinXP EventLog, I see the following:
>> "Python could not import the service's module
>> ImportError: No module named gluon.winservice"
>>
>>
>> Do you need further information?
>>
>> Regards, Patrick
>>
>