[web2py] Re: auth have no key user ????

2012-04-04 Thread bussiere adrien
it's not that i 've corrected but not htat it drives me crazy it worked 
yesterday :

def invitation():
form=FORM("Code Invitation :", INPUT(_name='invitation')," 'User'VERSIONweb2py™(1, 99, 7, 
datetime.datetime(2012, 3, 4, 22, 12, 8), 'stable')PythonPython 2.5.4: 
C:\Users\Bussiere\Dropbox\Projets\jackpoint\web2py\web2py.exeTRACEBACK

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.

Traceback (most recent call last):
  File "gluon/restricted.py", line 205, in restricted
  File 
"C:/Users/Bussiere/Dropbox/Projets/jackpoint/web2py/applications/init/controllers/default.py"
 , line 
748, in 
  File "gluon/globals.py", line 173, in 
  File 
"C:/Users/Bussiere/Dropbox/Projets/jackpoint/web2py/applications/init/controllers/default.py"
 , line 
685, in invitation
  File "gluon/dal.py", line 7578, in select
  File "gluon/dal.py", line 1320, in select
  File "gluon/dal.py", line 1624, in parse
  File "gluon/dal.py", line 6714, in __getitem__
KeyError: 'User'

ERROR SNAPSHOT [image: help]

('User')

inspect attributes
Frames
   
   - 
   
   *File 
   C:\Users\Bussiere\Dropbox\Projets\jackpoint\web2py\gluon\restricted.py in 
   restricted at line 205* code arguments variables
   - 
   
   *File 
   
C:\Users\Bussiere\Dropbox\Projets\jackpoint\web2py\applications\init\controllers\default.py
 
   in  at line 748* code arguments variables
   - 
   
   *File 
   C:\Users\Bussiere\Dropbox\Projets\jackpoint\web2py\gluon\globals.py in 
at line 173* code arguments variables
   - 
   
   *File 
   
C:\Users\Bussiere\Dropbox\Projets\jackpoint\web2py\applications\init\controllers\default.py
 
   in invitation at line 685* code arguments variables
   - 
   
   *File C:\Users\Bussiere\Dropbox\Projets\jackpoint\web2py\gluon\dal.py in 
   select at line 7578* code arguments variables
   - 
   
   *File C:\Users\Bussiere\Dropbox\Projets\jackpoint\web2py\gluon\dal.py in 
   select at line 1320* code arguments variables
   - 
   
   *File C:\Users\Bussiere\Dropbox\Projets\jackpoint\web2py\gluon\dal.py in 
   parse at line 1624* code arguments variables
   - 
   
   *File C:\Users\Bussiere\Dropbox\Projets\jackpoint\web2py\gluon\dal.py in 
   __getitem__ at line 6714* code arguments variables
   Function argument list
   
   (self=}>, key='User')
   Code listing
   


[web2py] auth have no key user ????

2012-04-04 Thread bussiere adrien
i truly don't understand 
it seems to work before at my last commit and now i have a bug :

127.0.0.1.2012-04-04.14-49-48.50c46aad-96a9-4d70-9b67-009e81ed17f0
 'User'

Traceback (most recent call last):
  File "gluon/restricted.py", line 205, in restricted
  File 
"C:/Users/Bussiere/Dropbox/Projets/jackpoint/web2py/applications/init/controllers/default.py"
  , line 
749, in 
  File "gluon/globals.py", line 173, in 
  File 
"C:/Users/Bussiere/Dropbox/Projets/jackpoint/web2py/applications/init/controllers/default.py"
  , line 
686, in invitation
  File "gluon/dal.py", line 6683, in _filter_fields
  File "gluon/dal.py", line 6478, in __getattr__
  File "gluon/dal.py", line 6471, in __allocate
  File "gluon/dal.py", line 6712, in __getitem__
  File "gluon/dal.py", line 7578, in select
  File "gluon/dal.py", line 1320, in select
  File "gluon/dal.py", line 1624, in parse
  File "gluon/dal.py", line 6714, in __getitem__
KeyError: 'User'



here si my code :



def invitation():
form=FORM("Code Invitation :", INPUT(_name='invitation'),"

Re: [web2py] adding an item in a list:reference :

2012-04-02 Thread bussiere adrien
ok i thought about this too.
But when you have a long list 
that's not really nice.
And it take twolines.

Summon Massimo can't we make a one line methode to do that ?



Regards and thanks
Bussiere

Le lundi 2 avril 2012 10:00:23 UTC+2, Manuele a écrit :
>
> Il 01/04/2012 23:23, bussiere adrien ha scritto:
> > ok i see the example :
> > >>>  db.define_table('tag',Field('name'),format='%(name)s')
> > >>>  db.define_table('product',
> >  Field('name'),
> >  Field('tags','list:reference tag'))
> > >>>  a=db.tag.insert(name='red')
> > >>>  b=db.tag.insert(name='green')
> > >>>  c=db.tag.insert(name='blue')
> > >>>  db.product.insert(name='Toy Car',tags=[a,b,c])
> > *but if after i make :*
> > d=db.tag.insert(name='purple')
> >
> > how to add d to db.product ? with a,b,c who were already here ?
>
> I use to:
>
> 1. extract the values in a variable
> 2. append the new value to the list variable
> 3. update the value in table
>
>  M.
>
> >
> > Regards
> > Bussiere
> >
> > *
> > *
>
>

[web2py] Re: Separate form elements in a view ?

2012-04-01 Thread bussiere adrien
i will dig it regards.


Bussiere

Le dimanche 1 avril 2012 18:33:48 UTC+2, Anthony a écrit :
>
> See http://web2py.com/books/default/chapter/29/7#Custom-forms  and 
> http://web2py.com/books/default/chapter/29/7#SQLFORM-in-HTML . Forms are 
> also web2py HTML helper objects, so if you just need to make little tweaks, 
> you can use the server-side DOM to manipulate the form object before 
> serializing in the view: 
> http://web2py.com/books/default/chapter/29/5#Server-side-DOM-and-parsing 
> , 
> http://www.web2pyslices.com/slice/show/1370/modify-form-elements-and-attributes
>  .
>
> Anthony
>
> On Sunday, April 1, 2012 11:53:49 AM UTC-4, bussiere adrien wrote:
>>
>> How to separate element from a form in a view ?
>> {{= form }}
>> make the whole form.
>>
>> But i i want to use it one by one for css ?
>> is there a way to do it like :
>> {{= form.Email }} 
>>
>> Regards
>> Bussiere
>>
>> here is my form :
>> form2 = FORM(
>> TABLE(
>> TR(
>> TD(
>> 
>> LABEL('Email : ')
>> ),
>> TD( 
>> INPUT(_name='Email')
>> )
>> ),
>> TR(
>> TD(
>> 
>> LABEL('Age : ')
>> ),
>> TD( 
>> INPUT(_name='Age')
>> )
>> ),
>> TR(
>> TD(
>> LABEL('Password : ')
>> ), 
>> TD(
>> INPUT(_name='password1',_type='password')
>> )
>> ),
>>
>>  TR(
>> TD(
>> LABEL('Password verification : ')
>> ), 
>> TD(
>> INPUT(_name='password2',_type='password')
>> )
>> ),
>>  TR(INPUT(_type='submit'))
>> )
>> )
>>
>

[web2py] adding an item in a list:reference :

2012-04-01 Thread bussiere adrien
ok i see the example :

>>> db.define_table('tag',Field('name'),format='%(name)s')
>>> db.define_table('product',
Field('name'),
Field('tags','list:reference tag'))

>>> a = db.tag.insert(name='red')
>>> b = db.tag.insert(name='green')
>>> c = db.tag.insert(name='blue')
>>> db.product.insert(name='Toy Car',tags=[a, b, c])

*but if after i make :*

d = db.tag.insert(name='purple')


how to add d to db.product ? with a,b,c who were already here ?


Regards

Bussiere

*
*



[web2py] Separate form elements in a view ?

2012-04-01 Thread bussiere adrien
How to separate element from a form in a view ?
{{= form }}
make the whole form.

But i i want to use it one by one for css ?
is there a way to do it like :
{{= form.Email }} 

Regards
Bussiere

here is my form :
form2 = FORM(
TABLE(
TR(
TD(

LABEL('Email : ')
),
TD( 
INPUT(_name='Email')
)
),
TR(
TD(

LABEL('Age : ')
),
TD( 
INPUT(_name='Age')
)
),
TR(
TD(
LABEL('Password : ')
), 
TD(
INPUT(_name='password1',_type='password')
)
),

 TR(
TD(
LABEL('Password verification : ')
), 
TD(
INPUT(_name='password2',_type='password')
)
),
 TR(INPUT(_type='submit'))
)
)


[web2py] Re: Dynamically create form ?

2012-03-29 Thread bussiere adrien
Find i've adapted an exemple :

form=FORM("UserName:", INPUT(_name='Username'),
 "Email : ", INPUT(_name='email',_value=user.email),
  INPUT(_type='submit'))
form.insert(-1,INPUT(_name='titi',_value='titi'))


the doc :

Sometimes you may wish to add an extra element to your form after it has 
been created. For example, you may wish to add a checkbox which confirms 
the user agrees with the terms and conditions of your website:

1.
2.
3.
4.

form = SQLFORM(db.yourtable)
my_extra_element = TR(LABEL('I agree to the terms and conditions'), \
  INPUT(_name='agree',value=True,_type='checkbox'))
form[0].insert(-1,my_extra_element)


Le jeudi 29 mars 2012 14:14:01 UTC+2, bussiere adrien a écrit :
>
> is there a way to dynamically create a for like :
>
> liste = ["titi","toto"]
>
> form=FORM("UserName:", INPUT(_name='Username'),
>  "Email : ", INPUT(_name='email',_value=user.email),
> )
>
> for l in liste :
>   form.add("%s : "%l,INPUT(_name="%s"%l))
> # and at the end add the submit button :
> form.add(INPUT(_type='submit')) 
>
>
> Reagrds
> Bussiere
>
>
>

[web2py] Dynamically create form ?

2012-03-29 Thread bussiere adrien
is there a way to dynamically create a for like :

liste = ["titi","toto"]

form=FORM("UserName:", INPUT(_name='Username'),
 "Email : ", INPUT(_name='email',_value=user.email),
)

for l in liste :
  form.add("%s : "%l,INPUT(_name="%s"%l))
# and at the end add the submit button :
form.add(INPUT(_type='submit')) 


Reagrds
Bussiere




[web2py] database foreign key question

2012-03-29 Thread bussiere adrien
Thanks to you my project make nice progress :
http://img26.imageshack.us/img26/1271/loginscreena.png

But i need to know some things :
here is my database :


db.define_table('Skill',
 Field('Nom', unique=True),
 format = '%(Nom)s')

db.define_table('SkillLevel',
 Field('Level', 'integer'),
 Field('Skill', db.Skill),
 Field('Parent', db.Skill),
 format = '%(Skill)s')


and :
if db(db.SkillLevel.Skill.Nom == ''toto").count() == 0:

Don't work i says to me skill have no nom attribute


then an other question :
db.define_table('Demande',
 Field('Topic', unique=True),
 Field('Texte'),
 Field('Skills','list:reference SkillDemande'),
 Field('Items','list:reference Item'),
 Field('auth_user',db.auth_user),
 format = '%(Topic)s')


db.define_table('Item',
 Field('Nom', unique=True),
 Field('SkillUse', db.SkillLevel),
 format = '%(Nom)s')


How to select an item by Nom ?
How to add an item in demande ?

regards
Bussiere


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

2012-03-26 Thread bussiere adrien
It work 

Thanks
Just mail me in private where to give
Bussiere

Le lundi 26 mars 2012 20:23:06 UTC+2, selecta a écrit :
>
> if it works please donate to the web2py project
>
>
>

[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<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"
>>
>>

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"
>>>
>>

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"
>


[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] 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] 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] Re: simple recipe to create a user and loggin him ?

2012-03-24 Thread bussiere adrien


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)

that thing don't work ...

Bussiere


Le samedi 24 mars 2012 16:27:22 UTC+1, bussiere adrien a écrit :
>
> I need a simple recipe juste to create a user in command line / program to 
> create him and log him as :
>
> like :
>
> user =  db.auth_user.insert(name="​johndoe",password="toto")
> auth.user = user 
> auth.environment.session.auth = Storage(user=user, last_visit=request.now,
> 
> expiration=auth.settings.​expiration)
>
> Regards
> Bussiere
>


[web2py] simple recipe to create a user and loggin him ?

2012-03-24 Thread bussiere adrien
I need a simple recipe juste to create a user in command line / program to 
create him and log him as :

like :

user =  db.auth_user.insert(name="johndoe",password="toto")
auth.user = user 
auth.environment.session.auth = Storage(user=user, last_visit=request.now,

expiration=auth.settings.expiration)

Regards
Bussiere


[web2py] 'tuple' object has no attribute 'items'

2012-03-24 Thread bussiere adrien
I don't understand here is my db :
from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
auth = Auth(db, hmac_key=Auth.get_or_create_key())
crud, service, plugins = Crud(db), Service(), PluginManager()
db.define_table(
auth.settings.table_user_name,
Field('Surnom', length=128, default=''),
Field('email', length=128, default='', unique=True), # required
Field('password', 'password', length=512,# required
readable=False, label='Password'),
Field('Skills','list:reference SkillUser',default=None),
Field('Items','list:reference Item',default=None),
Field('registration_key', length=512,# required
writable=False, readable=False, default=''),
Field('reset_password_key', length=512,# required
writable=False, readable=False, default=''),
Field('registration_id', length=512, # required
writable=False, readable=False, default=''))

## do not forget validators
custom_auth_table = db[auth.settings.table_user_name] # get the 
custom_auth_table
custom_auth_table.Surnom.requires = \
IS_NOT_EMPTY(error_message=auth.messages.is_empty)
custom_auth_table.password.requires = [CRYPT()]
custom_auth_table.email.requires = [
IS_EMAIL(error_message=auth.messages.invalid_email),
IS_NOT_IN_DB(db, custom_auth_table.email)]


Items is at default = none

here is my default.py :


def ensurefirstuser(Surnom, email, password):
  users = db(db.auth_user.email == email).select()
  if users:
user_id = users[0].id
created = False
if settings.debug_ensure_first_user == True:
  print ('found user_id so created equals %s') % created
return (user_id, created)

  else:
my_crypt = CRYPT(key=auth.settings.hmac_key)
crypt_pass = my_crypt(password)[0]
id_user = db.auth_user.insert(
   Surnom=Surnom,
   email=email,
   password=crypt_pass,
   )
created = True
if settings.debug_ensure_first_user == True:
  print ('creating user_id')
return (id_user, created)


def invitation():
form=FORM("Code Invitation :", INPUT(_name='invitation'),"

[web2py] Re: display fill text in a {{ row }} not the trucate one

2012-03-24 Thread bussiere adrien
Thanks again regards

Bussiere

Le samedi 24 mars 2012 15:11:50 UTC+1, Anthony a écrit :
>
> When a Rows object is serialized in a view, it is passed to SQLTABLE, 
> which has a "truncate" argument that defaults to 16. Instead, you can call 
> SQLTABLE explicitly:
>
> {{=SQLTABLE(rows, truncate=None)}}
>
> Anthony
>
> On Saturday, March 24, 2012 9:41:51 AM UTC-4, bussiere adrien wrote:
>>
>> I have this when i put a {{row}} in a template (liste_invitations) :
>> {{extend 'layout.html'}}
>> Records
>> {{=rows}}
>>
>> it gives me :
>>
>> Invitation.id Invitation.Code Invitation.Usage Invitation.Donneur 
>> Invitation.Receveur Invitation.Email Invitation.Used
>> 1 Toto-5542 None None None None None
>> 2 USER_INTERFAC... None None None None None
>>
>> USER_INTERFAC...  is truncated how to have it in full ?
>>
>> here is the the controller :
>> def liste_invitations():
>> return dict(rows = db().select(db.Invitation.ALL)​​)
>>
>> it truncate the text of the invitation
>>
>

[web2py] display fill text in a {{ row }} not the trucate one

2012-03-24 Thread bussiere adrien
I have this when i put a {{row}} in a template (liste_invitations) :
{{extend 'layout.html'}}
Records
{{=rows}}

it gives me :

Invitation.id Invitation.Code Invitation.Usage Invitation.Donneur 
Invitation.Receveur Invitation.Email Invitation.Used
1 Toto-5542 None None None None None
2 USER_INTERFAC... None None None None None

USER_INTERFAC...  is truncated how to have it in full ?

here is the the controller :
def liste_invitations():
return dict(rows = db().select(db.Invitation.ALL))

it truncate the text of the invitation


Re: [web2py] Invalid syntax

2012-03-23 Thread bussiere adrien
Yep that was that the encoding

thanks all i did a replace with this regexp :
/[^\x00-\x7F]/

But it was hard to understand ...

Thanks
Bussiere


Le vendredi 23 mars 2012 15:14:02 UTC+1, Jonathan Lundell a écrit :
>
> On Mar 23, 2012, at 2:40 AM, bussiere adrien wrote:
> > # -*- coding: utf-8 -*-
> > def ensurefirstuser(firstname,​lastname,email,password)​:
> > users = db(db.auth_user.email==email).​​select()
> > if users:
> > user_id = users[0].id
> > created = False
> > if settings.debug_ensure_first_​​user == True:
> > print ('found user_id so created equals %s') % created
> > return (user_id,created)
> > 
> > else:
> > my_crypt = CRYPT(key=auth.settings.hmac_​​key)
> > crypt_pass = my_crypt(password)[0]
> > id_user= db.auth_user.insert(
> >   ​ first_name=firstname,
> >   ​ last_name=lastname,
> >   ​ email = email,
> >   ​ password = crypt_pass
> >   ​ )
> > created = True
> > if settings.debug_ensure_first_​​user == True:
> > print ('creating user_id')
> > return (id_user,created)
> > 
> > 
> > Here i truly don't understand why it still say invalid syntax and i'am 
> investing on it fr hours ...
> > 
> > Regards
> > Bussiere
> > 
>
> You have a bunch of Unicode 200B (zero-width space) characters in it. 
>


[web2py] Invalid syntax

2012-03-23 Thread bussiere adrien
# -*- coding: utf-8 -*-
def ensurefirstuser(firstname,lastname,email,password)​:
users = db(db.auth_user.email==email).​select()
if users:
user_id = users[0].id
created = False
if settings.debug_ensure_first_​user == True:
print ('found user_id so created equals %s') % created
return (user_id,created)

else:
my_crypt = CRYPT(key=auth.settings.hmac_​key)
crypt_pass = my_crypt(password)[0]
id_user= db.auth_user.insert(
  ​ first_name=firstname,
  ​ last_name=lastname,
  ​ email = email,
  ​ password = crypt_pass
  ​ )
created = True
if settings.debug_ensure_first_​user == True:
print ('creating user_id')
return (id_user,created)


Here i truly don't understand why it still say invalid syntax and i'am 
investing on it fr hours ...

Regards
Bussiere



[web2py] Re: infinite loop with form.process().accepted

2012-03-23 Thread bussiere adrien

>
> Thanks a lot.
>

It was obvious for me that it was an int.

Thanks again
Bussiere 


[web2py] infinite loop with form.process().accepted

2012-03-22 Thread bussiere adrien
i don't understand :
def generate_invitation(number,word=4,num=1,numdigit=5):
code = [
['BELCHER', 'FIX', 'EEL', 'PANZERBOY', 'DESK_JOCKEY', 'CHILLED', 
'ENFORCER', 'CHERRY_PICKING', 'COUNTRY_CLUB', 'BOMBSHELL', 'PLUGGED_IN', 
'FINI', 'LEGIT', 'JAM', 'BONED_OUT', 'BLADE', 'ROUST', 'SAMURAI', 'DISK', 
'INPUT', 'POST_TIME', 'SOUNDS', 'SKIP', 'FLATBACKER', 'WILSON', 
'SHOEMAKER', 'DELTA_SIERRA', 'HEART', 'CROAK', 'HEAD_HUNTER', 
'HOSHO_KAISHA', "DELTA'D", "'FACE_(also,_FACE,_EYE-FACE,_I-FACE)", 
'WEEFLE', 'DIRTGIRL', 'KEYBOARD', 'BRAIN_BUCKET', 'DRYING_OUT', 'OVERCOOK', 
'PIG', 'COLD_TEA', 'RECONFIG', 'PAD', 'LIT_UP', 'WRAITH', 'HANDLE', 'L.P.', 
'PINCH', 'TAKE_A_CAB', 'SPILL', 'ACE_KOOL', 'DO', 'BIZ', 'BROWNIE', 
'CANDLE_AND_BLOOD', 'BLUEBOY', 'UP_ON_IT', 'BURN', 'USER_INTERFACE', 'HOB', 
'GYRO', 'STUFFIT', 'THATCH', 'ICEBREAKER', 'ZIP_GUN', 'PETERMAN', 
'PLAY_DOUGH', 'TREY-EIGHT', 'SETTLE', "CHIPPIN'_IN", 'MEATBALL', 'RAFFLES', 
'YUBITSUME', 'CROAKER', 'SUCKER_POCKETS', 'L.A.M.A.', 'GEEK', 'BUTTONHEAD'],
['TAKE', 'TEKIYA', 'KURUMAKU', 'BLOC', 'GAT', 'JOHATSU', 'CRYSTAL', 'A.I.', 
'ZEROED', 'OVER_THE_SHOULDER', 'GRAB_GEE', 'PANZER', 'GO_LEO', 'WASHED', 
'I.C.E.', 'COPSHOP', 'COLLATERAL_DAMAGE', 'BIG_DARK', 'DOUBLE-DEUCE', 
'ZONEDANCE', 'MARK', 'COBBERS', 'CHIMPIRA', 'TRIADS', 'SHANK', 'FRAG', 
'BREATH_VAC', "CHARLIE'S_ANGEL", 'MULE', 'BURNER', "PACKIN'", 'HOTDOGGER', 
'BOSOZOKU', 'RIPPERDOC', 'THIRDMAN', 'MAXIMUM,_MAX', 'CHOOH2_("CHOO")', 
'CRYO_MAX', 'HEATER', 'SHARK', 'JOYGIRL', 'GURENTAI', 'BANDIT', 'VENICE', 
'MIZU_SHOBAI', 'PASTA_BOYS', 'SQUID', 'CYBERED_UP', 'DEAD_RECKONING', 
'POPSICLE', 'FAUST', 'COLLARBOY', 'SHOES', 'TORCH', 'DELTAJOCK', 
'BUTTERFLY_MAN', 'WISE_GUYS', 'BOOST', 'CAIN', 'FOUR-FIVE', 'BREAK-DOWN', 
'POLYMER_ONE-SHOT', 'FLAG', 'CALL_GIRL', 'IN_THE_HUNT', 'HYDRO', 'DOCK', 
'FENCE', 'SHAIKUJIN', 'GOMI', 'FILTER', 'SAINT_NICK', 'LINEFOOT', 
'CAVALRY', 'PUKE', 'CONVERSION', 'FINGER', 'CONTRACT'],
['PLASTIC', 'CRYSTALJOCKEY,_CRYSTALJOCK', 'SCREW', 'TOYSTORE', 
'DREAM_TIME', 'EXOTIC', 'WALKABOUT', 'DIAMOND_SEASON', 'SARAKIN', 
'CHRISTMAS_BUNDLES', 'SHADES', 'BUTTON_MAN', 'FOXTROT_UNIFORM', 'KAI', 
'UNDER_THE_PAINT', 'MINIMUM', 'TRIPLE_A', 'PIG_ON_A_WHEEL', 'BAG_MAN', 
'DIP', 'PIGEONS', 'MAN', 'ADAM_HENRY', 'HIGH', 'HEAT', 'NINJO', 
'KNIFE_FIGHT', 'MOUTHPIECE', 'AGRIPLEX', 'DATA_TERM', 'LIZ', 'CHROMER', 
'OUTPUT', 'N.O.E.', 'CLOSE_A_CONTRACT', 'LASSIE', 'FLATLINE', 'CHIV', 
'SING', 'AMMO', 'RAT', 'MATCHBOX', 'PULL_AN_ASH', 'BORYOKUDAN', 'SQUEEZE', 
'RONIN', 'HIT', 'RAGS', 'TAKE_OUT', 'BEAT_THE_RAP', 'GIRI', 
'RUNNING_THE_LINE', 'HARNESS', 'GRAVEROBBER', 'DROP_A_DIME', 
'BADGE_ON_A_BEAVER', 'FLETCHER', 'AMPED-OUT', 'NEUTRALIZE', 'PETER', 
'CONFIG', 'HARDFIRE', 'B.A.M.A.', 'CHROMATIC_ROCK', 'MOLDED', 'RAD', 
'CREASED', 'CHATTER_BOX', 'HAND_CANNON', 'NIPPERS', 'SIERRA_HOTEL', 
'HOOK_UP', '-JOCKEY,_-JOCK', 'BUG', 'BATMAN_AND_ROBIN', 'BLACK_OPERATIONS', 
"D.C.'S", 'SO_KA'],
['_A.A.A.', 'HOME_PLATE', 'LITEJACK', 'PINEAPPLE', 'MAKE', 'THE_STREET', 
'SITREP', 'HANGING_PAPER', 'PAINT_BOYS', 'WETWORK', 'NINER', 'BOOKIE', 
'WHIPLASH', 'TORPEDO', 'HEATWAVE', 'SOLAR_WIND', 'QUIFF', 'BIKE', 
'TRAFFIC', 'WIRE_ROOM', 'OYABUN', 'COWBOY', 'KOBUN', 'MUDBOY', 'COP_OUT', 
'SOKAIYA', "'DORPH", 'JOYBOY', 'DIRTY', 'BOAT', 'DROP', 'GRAV_or_GEE', 
'APOGEE', 'BOOSTER', 'BOOK', 'FRY', 'PULLING_TEETH', 'ONE_LARGE', 
'COMBAT_DRUGS', 'THRASH', 'DO_A_GHOST', 'DELTA', 'RIN_TIN_TIN', 'DROP_OUT', 
'GUMI', 'ROCKERBOY/GIRL', 'BULLET', 'DEB', 'THREADING_THE_NEEDLE', 'MOTOR', 
'BLEEDER', 'ARC', 'BOPPER', 'WASTE', '___DEMUKAI', 'BREAK', 
'HOLDING_DOWN', 'FEDS', 'GAP', 'RABBI', 'BAKUTO', 'CHOMBATTA_(CHOOMBA)', 
'BIG_HATS', 'MR._JOHNSON', 'EXEC', 'BULL', 'BULLSEYE', 'POSERGANG', 
'CHAOL', 'GEISHA', 'SLAMMIT_ON', 'POP_CAPS', 'HARD_TIME', 'BENJI', 
'MAKING_BANK', 'PAPERHANGER', 'NETRUN', 'BOGEY'],
] 
i = 0
invits = []
print number
while (i < number):
invit = ""
j = 0
while (j < word):
debut = random.randint(0,len(code)-1)
codepick = code[debut][random.randint(0,len(code[debut])-1)]
j += 1
invit += codepick+"-"
j = 0
while (j < num):
invit += randomdig(numdigit)+"-"
j += 1
i+= 1
invit = invit[:-1]
if invit not in invits :
invits.append(invit[:-1])
print invit
return invits

def randomdig(number):
max = "9"*number
max = int(max)
rand =  random.randint(0,max)
rand = str(rand)
rand = "0"*(number-len(rand))+rand
return rand



#@auth.requires_membership('manager')
def generate_invitationpage():
   form=FORM("Nombre d'invit a générer:", INPUT(_name='nmbreinvit'), 
INPUT(_type='submit'))
   if form.process().accepted:
   i = form.vars.nmbreinvit
   invitsgenere = generate_invitation(i)
   for invit in invitsgenere :
   db.Invitation.insert(Code=invit)
   db.commit()
   session.flash = 'invita

[web2py] Re: Current status of adapting OrientDB for web2py

2012-03-18 Thread bussiere adrien
Mee to i'am considering using orientdb also.

So if you have any example

regards
Bussiere

Le jeudi 16 février 2012 09:27:55 UTC+1, David Marko a écrit :
>
> I would also appreciate some hints on what libraries do you use to 
> communicate with orientDB, or can you create some simple appliance as demo?
>
> Thanks!
> David
>


[web2py] Re: list:reference and crud.create a form in a form or a popup (django style) recipe ?

2012-03-18 Thread bussiere adrien
i've found that one :
http://www.web2pyslices.com/slice/show/1446/widget-select-or-add-option  

I will try to make a generic adaptatin of that one.

Regards
Bussiere

Le dimanche 18 mars 2012 11:31:23 UTC+1, Alan Etkin a écrit :
>
> I think that by default that table definition should show the 
> multiselect widget in CRUD forms. If not, it should be possible to set 
> it explicitly: 
>
> db.mytable.myfield.widget = SQLFORM.widgets.multiple.widget 
>
> And you can also create your own custom widgets by declaring a 
> function that receives field and value arguments and returns a helper. 
> For a detailed example check the online manual at 7.7 Widgets 
>
> On 17 mar, 11:11, bussiere adrien  wrote: 
> > Is there a recipe anywhere to show how to do when a i have a external 
> > reference in my db table as liste:reference 
> > to make it simple to add existing references or make a popup to create a 
> > new reference ? 
> > 
> > exemple : 
> > db.define_table('Film', 
> >Field('nom'), 
> >Field('Acteur','list:reference Acteur'), 
> > 
> > When i make a form1 = crud.create(db.Film) 
> > it sho me just a field and not menu as django or a field list or create 
> a 
> > new one. 
> > 
> > Is there a recipe anywhere to do that ? 
> > 
> > Regards 
> > Bussiere



[web2py] list:reference and crud.create a form in a form or a popup (django style) recipe ?

2012-03-17 Thread bussiere adrien
Is there a recipe anywhere to show how to do when a i have a external 
reference in my db table as liste:reference
to make it simple to add existing references or make a popup to create a 
new reference ?

exemple :
db.define_table('Film',
   Field('nom'),
   Field('Acteur','list:reference Acteur'),

When i make a form1 = crud.create(db.Film)
it sho me just a field and not menu as django or a field list or create a 
new one.

Is there a recipe anywhere to do that ?

Regards
Bussiere


[web2py] Re: Key error that i don't understand based on the cookbook.

2012-03-17 Thread bussiere adrien
Found it all my db have name and one had a mystake.

Regards
Bussiere

Le samedi 17 mars 2012 14:35:30 UTC+1, bussiere adrien a écrit :
>
> here is my db.py :
>
> db.define_table('ImageFilmPreview',
>Field('Nom'),
>Field('date_Creation','date'),
>Field('Tag','list:reference Tag'),
>Field('FamilleTag','list:reference FamilleTag'),
>Field('Type','list:reference Type'),
>Field('Valeur_Ticket','double'),
>Field('Description_Courte'),
>Field('Description_Longue'),
>Field('Image'),#a revoir 
>Field('Texte_contenu','list:reference Texte_contenu'),
>Field('Link','list:reference Link'),
>Field('Note_divers','list:reference Note_divers'),
>format = '%(Nom)s')
>
>
> db.define_table('Film',
>Field('Nom'),
>Field('UrlPreview'),
>Field('date_Creation','date'),
>Field('date_Publication','date'),
>Field('Tag','list:reference Tag'),
>Field('FamilleTag','list:reference FamilleTag'),
>Field('Type','list:reference Type'),
>Field('Valeur_Ticket','double'),
>Field('Description_Courte'),
>Field('Description_Longue'),
>Field('ImageFilm','list:reference ImageFilm'),
>Field('ImageFilmPreview','list:reference ImagePreview'),
>Field('Texte_contenu','list:reference Texte_contenu'),
>Field('Acteur','list:reference Acteur'),
>Field('Avis','list:reference Avis'),
>Field('Link','list:reference Link'),
>Field('Note_divers','list:reference Note_divers'),
>format = '%(Nom)s')
>
>
> here is my default.py :
>
> def admindanakFilm():
> Line 88:form1 = crud.create(db.Film, next='admindanakFilm')
> films = db(db.Film).select(orderby=db.Film.id)
> film = db.company(request.args(0)) or redirect(URL('admindanak'))
> form2 = crud.update(db.Film, film, next='Film')
> return locals()
>
>
> and here is my template :
> Companies
> 
> New Film
> {{=form1}}
> 
> Film edit
> {{=form2}}
> 
>
> {{for Film in films:}}
> 
> {{=A(Film.Nom)}}
> {{=A('edit', _href=URL('admindanakFilm',
> args=Film.id))}}
> 
> {{pass}}
> 
> 
> 
> 
>
>
> and it gave to me :
>
> 127.0.0.1.2012-03-17.14-33-40.9b6207b2-aaf8-4dec-8c10-a4321f3616aa
>  'Nom'VERSIONweb2py™(1, 99, 7, 
> datetime.datetime(2012, 3, 4, 22, 12, 8), 'stable')PythonPython 2.5.4: 
> C:\Users\Bussiere\Dropbox\Projets\danak\web2py\web2py.exeTRACEBACK
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
>
> Traceback (most recent call last):
>   File "gluon/restricted.py", line 205, in restricted
>   File 
> "C:/Users/Bussiere/Dropbox/Projets/danak/web2py/applications/init/controllers/default.py"
>  <http://127.0.0.1:8000/admin/default/edit/init/controllers/default.py>, line 
> 96, in 
>   File "gluon/globals.py", line 173, in 
>   File 
> "C:/Users/Bussiere/Dropbox/Projets/danak/web2py/applications/init/controllers/default.py"
>  <http://127.0.0.1:8000/admin/default/edit/init/controllers/default.py>, line 
> 88, in admindanakFilm
>   File "gluon/tools.py", line 3172, in create
>   File "gluon/tools.py", line 3089, in update
>   File "gluon/sqlhtml.py", line 870, in __init__
>   File "gluon/sqlhtml.py", line 283, in widget
>   File "gluon/sqlhtml.py", line 216, in widget
>   File "gluon/validators.py", line 465, in options
>   File "gluon/validators.py", line 447, in build_set
>   File "gluon/dal.py", line 6714, in __getitem__
>
>

[web2py] Re: Key error that i don't understand based on the cookbook.

2012-03-17 Thread bussiere adrien
Found it the error was not so explicit all my name film and actors was name.

Bussiere

Le samedi 17 mars 2012 14:35:30 UTC+1, bussiere adrien a écrit :
>
> here is my db.py :
>
> db.define_table('ImageFilmPreview',
>Field('Nom'),
>Field('date_Creation','date'),
>Field('Tag','list:reference Tag'),
>Field('FamilleTag','list:reference FamilleTag'),
>Field('Type','list:reference Type'),
>Field('Valeur_Ticket','double'),
>Field('Description_Courte'),
>Field('Description_Longue'),
>Field('Image'),#a revoir 
>Field('Texte_contenu','list:reference Texte_contenu'),
>Field('Link','list:reference Link'),
>Field('Note_divers','list:reference Note_divers'),
>format = '%(Nom)s')
>
>
> db.define_table('Film',
>Field('Nom'),
>Field('UrlPreview'),
>Field('date_Creation','date'),
>Field('date_Publication','date'),
>Field('Tag','list:reference Tag'),
>Field('FamilleTag','list:reference FamilleTag'),
>Field('Type','list:reference Type'),
>Field('Valeur_Ticket','double'),
>Field('Description_Courte'),
>Field('Description_Longue'),
>Field('ImageFilm','list:reference ImageFilm'),
>Field('ImageFilmPreview','list:reference ImagePreview'),
>Field('Texte_contenu','list:reference Texte_contenu'),
>Field('Acteur','list:reference Acteur'),
>Field('Avis','list:reference Avis'),
>Field('Link','list:reference Link'),
>Field('Note_divers','list:reference Note_divers'),
>format = '%(Nom)s')
>
>
> here is my default.py :
>
> def admindanakFilm():
> Line 88:form1 = crud.create(db.Film, next='admindanakFilm')
> films = db(db.Film).select(orderby=db.Film.id)
> film = db.company(request.args(0)) or redirect(URL('admindanak'))
> form2 = crud.update(db.Film, film, next='Film')
> return locals()
>
>
> and here is my template :
> Companies
> 
> New Film
> {{=form1}}
> 
> Film edit
> {{=form2}}
> 
>
> {{for Film in films:}}
> 
> {{=A(Film.Nom)}}
> {{=A('edit', _href=URL('admindanakFilm',
> args=Film.id))}}
> 
> {{pass}}
> 
> 
> 
> 
>
>
> and it gave to me :
>
> 127.0.0.1.2012-03-17.14-33-40.9b6207b2-aaf8-4dec-8c10-a4321f3616aa
>  'Nom'VERSIONweb2py™(1, 99, 7, 
> datetime.datetime(2012, 3, 4, 22, 12, 8), 'stable')PythonPython 2.5.4: 
> C:\Users\Bussiere\Dropbox\Projets\danak\web2py\web2py.exeTRACEBACK
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
>
> Traceback (most recent call last):
>   File "gluon/restricted.py", line 205, in restricted
>   File 
> "C:/Users/Bussiere/Dropbox/Projets/danak/web2py/applications/init/controllers/default.py"
>  <http://127.0.0.1:8000/admin/default/edit/init/controllers/default.py>, line 
> 96, in 
>   File "gluon/globals.py", line 173, in 
>   File 
> "C:/Users/Bussiere/Dropbox/Projets/danak/web2py/applications/init/controllers/default.py"
>  <http://127.0.0.1:8000/admin/default/edit/init/controllers/default.py>, line 
> 88, in admindanakFilm
>   File "gluon/tools.py", line 3172, in create
>   File "gluon/tools.py", line 3089, in update
>   File "gluon/sqlhtml.py", line 870, in __init__
>   File "gluon/sqlhtml.py", line 283, in widget
>   File "gluon/sqlhtml.py", line 216, in widget
>   File "gluon/validators.py", line 465, in options
>   File "gluon/validators.py", line 447, in build_set
>   File "gluon/dal.py", line 6714, in __getitem__
>
>

[web2py] Key error that i don't understand based on the cookbook.

2012-03-17 Thread bussiere adrien
here is my db.py :

db.define_table('ImageFilmPreview',
   Field('Nom'),
   Field('date_Creation','date'),
   Field('Tag','list:reference Tag'),
   Field('FamilleTag','list:reference FamilleTag'),
   Field('Type','list:reference Type'),
   Field('Valeur_Ticket','double'),
   Field('Description_Courte'),
   Field('Description_Longue'),
   Field('Image'),#a revoir 
   Field('Texte_contenu','list:reference Texte_contenu'),
   Field('Link','list:reference Link'),
   Field('Note_divers','list:reference Note_divers'),
   format = '%(Nom)s')


db.define_table('Film',
   Field('Nom'),
   Field('UrlPreview'),
   Field('date_Creation','date'),
   Field('date_Publication','date'),
   Field('Tag','list:reference Tag'),
   Field('FamilleTag','list:reference FamilleTag'),
   Field('Type','list:reference Type'),
   Field('Valeur_Ticket','double'),
   Field('Description_Courte'),
   Field('Description_Longue'),
   Field('ImageFilm','list:reference ImageFilm'),
   Field('ImageFilmPreview','list:reference ImagePreview'),
   Field('Texte_contenu','list:reference Texte_contenu'),
   Field('Acteur','list:reference Acteur'),
   Field('Avis','list:reference Avis'),
   Field('Link','list:reference Link'),
   Field('Note_divers','list:reference Note_divers'),
   format = '%(Nom)s')


here is my default.py :

def admindanakFilm():
Line 88:form1 = crud.create(db.Film, next='admindanakFilm')
films = db(db.Film).select(orderby=db.Film.id)
film = db.company(request.args(0)) or redirect(URL('admindanak'))
form2 = crud.update(db.Film, film, next='Film')
return locals()


and here is my template :
Companies

New Film
{{=form1}}

Film edit
{{=form2}}


{{for Film in films:}}

{{=A(Film.Nom)}}
{{=A('edit', _href=URL('admindanakFilm',
args=Film.id))}}

{{pass}}






and it gave to me :

127.0.0.1.2012-03-17.14-33-40.9b6207b2-aaf8-4dec-8c10-a4321f3616aa
 'Nom'VERSIONweb2py™(1, 99, 7, 
datetime.datetime(2012, 3, 4, 22, 12, 8), 'stable')PythonPython 2.5.4: 
C:\Users\Bussiere\Dropbox\Projets\danak\web2py\web2py.exeTRACEBACK

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.

Traceback (most recent call last):
  File "gluon/restricted.py", line 205, in restricted
  File 
"C:/Users/Bussiere/Dropbox/Projets/danak/web2py/applications/init/controllers/default.py"
 , line 
96, in 
  File "gluon/globals.py", line 173, in 
  File 
"C:/Users/Bussiere/Dropbox/Projets/danak/web2py/applications/init/controllers/default.py"
 , line 
88, in admindanakFilm
  File "gluon/tools.py", line 3172, in create
  File "gluon/tools.py", line 3089, in update
  File "gluon/sqlhtml.py", line 870, in __init__
  File "gluon/sqlhtml.py", line 283, in widget
  File "gluon/sqlhtml.py", line 216, in widget
  File "gluon/validators.py", line 465, in options
  File "gluon/validators.py", line 447, in build_set
  File "gluon/dal.py", line 6714, in __getitem__



[web2py] {{pass}} problems

2012-03-14 Thread bussiere adrien
i don't understand the pass ...
I anyone have a better tutorial than the official one.

Here is my layout.html :




  
  Projet Jackpoint 


body{
color:#b7d14e;
background-color:#000f00;
margin:4px;
margin-top:0px;
font-family:monospace;
}
a:link{
color:#94d118;
}
a:visited{
color:#94a443;
}


here is my user.html :
{{extend 'layout.html'}}


   __ __   _   
   \ \  __ _  ___| | ___ __   ___ (_)_ __ | |_ 
\ \/ _` |/ __| |/ / '_ \ / _ \| | '_ \| __|
 /\_/ / (_| | (__|   <| |_) | (_) | | | | | |_ 
 \___/ \__,_|\___|_|\_\ .__/ \___/|_|_| |_|\__|
  |_|   

{{=T( request.args(0).replace('_',' ').capitalize() )}}

  {{=form}}
  {{if request.args(0)=='login':}}
  {{if not 'register' in auth.settings.actions_disabled:}}
  
  {{pass}}
  {{pass}}
  {{pass}}

Vous avez une invitation ? Follow the rabbit 
...
FAQ




Why does it say to me that there is not enough {{pass}} ?
I have no pass in layout.html and in user html 3 pass.

And before tryieng to make a layout and put the balise extend layout it 
worked fine.


regards
Bussiere


[web2py] call function in template layout

2012-03-14 Thread bussiere adrien
i would like to know if it's possible to call a home made function in a 
template.
i've made this gist and i would like to call it in template :
https://gist.github.com/2032147 

like : {{ encadrement(form)  }}

And where to place my gist to call it in template.
And if not, where to put this functino to call it before template.

regards
Bussiere


[web2py] Custom register form with personnalised Auth

2012-03-11 Thread bussiere adrien
here is my auth table :
(the beginning my table is correct)
db.define_table(
auth.settings.table_user_name,
   Field('Nom'),
   Field('Prenom'),
   Field('Telephone'),
   # NOte on user is intern and the user don't hve to see it.
   Field('Note on user'), 

How to make a custom sqlform from it ?
like :
def user():
# i just want some things what is needed (passwd name and all but NOT 
note on user on the form
form = SQLFORM([auth.settings.Nom,auth.settings.Prenom])
return dict(form=form)

Regards
Bussiere


Re: [web2py] (Field: unknown field type: float for Price)

2012-03-11 Thread bussiere adrien
i owe you one.

But on the web i see float ?

http://web2py.wordpress.com/ 

Le dimanche 11 mars 2012 10:26:29 UTC+1, rochacbruno a écrit :
>
> There is no float, it is double in web2py
>
>
>
>  Field ('Price', 'double'),
>
>
>
> -- 
>
> Bruno Rocha
> [http://rochacbruno.com.br]
>
>

[web2py] (Field: unknown field type: float for Price)

2012-03-11 Thread bussiere adrien
here is my error :

Traceback (most recent call last):
  File "gluon/restricted.py", line 205, in restricted
  File 
"C:/Users/Bussiere/Dropbox/Projets/Yuki/web2py/applications/init/models/db.py" 
, line 327, in 

  File "gluon/dal.py", line 6320, in define_table
  File "gluon/dal.py", line 638, in create_table
SyntaxError: Field: unknown field type: float for Price


(Field: unknown field type: float for Price)




db.define_table('Cour',
Field ('id'),
Field ('Price', 'float'),
format = '%(Price)d')

db.define_table('Currency',
   Field ('Name', 
unique=True),
   Field ('Cour', db.Cour),
   format = '%(Name)s')
   
   
db.define_table('Price',
   Field ('Name'),
   Field ('Currency', 
db.Currency),
   Field ('Amount', 'float'),
   format = '%(Price,Currency)s')


I ruly don't understand i did as in the tutorial 



[web2py] Re: How to list:reference users ?

2012-03-11 Thread bussiere adrien
thanks

Le dimanche 11 mars 2012 04:36:37 UTC+1, bussiere adrien a écrit :
>
> maybe Field('Auth','list:reference Auth'),
> or ('Auth','list:reference User'),
>
> Regards
> Bussiere
>


[web2py] How to list:reference users ?

2012-03-10 Thread bussiere adrien
maybe Field('Auth','list:reference Auth'),
or ('Auth','list:reference User'),

Regards
Bussiere


Re: [web2py] Database trigger like django save ?

2012-03-09 Thread bussiere adrien
Thanks i will look forward to it.


regards
Bussiere

Le vendredi 9 mars 2012 23:48:30 UTC+1, rochacbruno a écrit :
>
> in web2py's DAL there is no "save" you have only two ways to store/update 
> data and it is by using a dbset method such as .update or .insert and using 
> a update_record functions that is stored in every Row object.
>
> To do what Django does we need to have some "hooks' for that 3 events 
> (dbset.insert, dbsert.update and Row.update_record)
>
> I can see that if you extend DAL it is possible to redefine via monkey 
> patching the .insert method.
>
> But it will be very better if DAL can handle this out of the box.
>
> A suggestions is adding an "callback" in .insert method
>
> def myfunction(id):
> .
>
> db(db...).insert(**., _callback=myfunction)
>
> But I dont know if it is possible...
>
> On Fri, Mar 9, 2012 at 7:34 PM, bussiere adrien wrote:
>
>> Is there a way to do that in web2py :
>> i've found only this :
>> http://russcomp.wordpress.com/2011/10/12/web2py-re-db-events-trigger/ 
>>
>> To perform action on a save ?
>>
>> class Acteur(models.Model):
>> Pseudo = models.CharField(max_length=200,null=True,blank=True)
>> Tag = models.ManyToManyField('tags.Tag',null=True,blank=True)
>> FamilleTag = 
>> models.ManyToManyField('tags.FamilleTag',null=True,blank=True)
>> Description_courte = 
>> models.CharField(max_length=200,null=True,blank=True)
>> Description = models.CharField(max_length=400,null=True,blank=True)
>> Texte_contenu = 
>> models.ManyToManyField('presentation.Texte_contenu',null=True,blank=True)
>> Lien = models.ForeignKey('liens.Lien',null=True,blank=True)
>> Note_divers = 
>> models.ManyToManyField('notes.Note_divers',null=True,blank=True)
>> Image_Acteur = 
>> models.ManyToManyField(ImageActeur,null=True,blank=True)
>> def ___str__(self):
>> return self.Pseudo
>> def __unicode__(self):
>> return self.Pseudo
>> def save(self, *args, **kwargs):
>> super(Acteur, self).save(*args, **kwargs) # Call the "real" 
>> save() method.
>> page = deepcopy(Page.objects.get(Nom="Acteur_Modele"))
>> #page.pk = None
>> page.Nom = self.Pseudo
>> page.Acteurs = [self]
>> page.ImageActeur = self.Image_Acteur
>> page.save()
>>
>
>
>
> -- 
>
> Bruno Rocha
> [http://rochacbruno.com.br]
>
>

[web2py] Re: How to call other web2py applications from within a web2py application

2012-03-09 Thread bussiere adrien
this doc is outdated is there anything news for making a website with more 
than one app ?

regards
Bussiere

Le lundi 15 mars 2010 16:19:23 UTC+1, mdipierro a écrit :
>
> For now look at the following links that may help you:
>
> For an example of {{=LOAD(...)}}
>
>http://gluonframework.wordpress.com/2010/03/07/web2py-ajax-and-forms/
>
> You can load an action from the same app or other apps.
>
> For ways an app can share data with another app:
>
>   http://www.web2py.com/book/default/section/4/19
>   http://www.web2py.com/book/default/section/4/20
>
> Hope this helps.
>
> Massimo
>
> On Mar 12, 7:26 am, Rahul  wrote:
> > Hi All, Massimo,
> >I've been designing a  web app using web2py. Web2py is
> > really a
> > very well designed framework. I am considering it along with
> > Django for a
> > medium sized web app development. How ever I would like to know,
> > if I can
> > code more applications for a single complex site (as we can do in
> > Django)
> > and link it to one single application.I am not using CAS as I have
> > created
> > my own authentication system. Here's an example to make it clear
> > of what I
> > want-
> >  *my site*
> > |__ site pages along with main page
> > |__ link to app1 ( a blog that is a separate web2py app)
> > |__ link to a app2 (chat client)  ( again a separate
> > web2py app)
> > |__ link to my database triggered app3 (again a separate
> > web2py
> > app)
> >
> > In short how do I modularise my web2py project to combine
> > different
> > applications into my original site web2py project. From the web
> > I've seen a
> > post from Yarko that mentions this
> >
> > {{=LOAD(...,application='
> > otherapp')}}
> >
> > but technically I could not find any documentation either in your
> > online
> > book or site. Can you please provide methods of how this is
> > achievable
> > without sacrificing simplicity. I have also heard about plugins
> > but not
> > really sure what they are and should I be really using those.
> >
> > Please suggest.
> >
> > Sincerely, Rahul D
> > (India)
>
>

[web2py] Database trigger like django save ?

2012-03-09 Thread bussiere adrien
Is there a way to do that in web2py :
i've found only this :
http://russcomp.wordpress.com/2011/10/12/web2py-re-db-events-trigger/ 

To perform action on a save ?

class Acteur(models.Model):
Pseudo = models.CharField(max_length=200,null=True,blank=True)
Tag = models.ManyToManyField('tags.Tag',null=True,blank=True)
FamilleTag = 
models.ManyToManyField('tags.FamilleTag',null=True,blank=True)
Description_courte = 
models.CharField(max_length=200,null=True,blank=True)
Description = models.CharField(max_length=400,null=True,blank=True)
Texte_contenu = 
models.ManyToManyField('presentation.Texte_contenu',null=True,blank=True)
Lien = models.ForeignKey('liens.Lien',null=True,blank=True)
Note_divers = 
models.ManyToManyField('notes.Note_divers',null=True,blank=True)
Image_Acteur = models.ManyToManyField(ImageActeur,null=True,blank=True)
def ___str__(self):
return self.Pseudo
def __unicode__(self):
return self.Pseudo
def save(self, *args, **kwargs):
super(Acteur, self).save(*args, **kwargs) # Call the "real" save() 
method.
page = deepcopy(Page.objects.get(Nom="Acteur_Modele"))
#page.pk = None
page.Nom = self.Pseudo
page.Acteurs = [self]
page.ImageActeur = self.Image_Acteur
page.save()


[web2py] Re: Auth redefinition for all apps

2012-03-09 Thread bussiere adrien
thanks i will do that

Bussiere

Le vendredi 9 mars 2012 23:18:36 UTC+1, pbreit a écrit :
>
> I don't think there's a way to redefine auth for all apps short of 
> modifying Web2py itself (which I would not advise).
>
> I would suggest simply putting your customization into each project where 
> you need it. You could create an auth_user.py model file and just drop it 
> into each app's models directory.
>


[web2py] Auth redefinition for all apps

2012-03-09 Thread bussiere adrien
i 've found this :
http://web2py.com/books/default/chapter/29/9#Customizing-Auth 

But how redefine auth db for all apps ?


Regards 
Bussiere


[web2py] Re: looking for tutorial extends user and related to an other app

2012-03-09 Thread bussiere adrien
i've found this :
http://stackoverflow.com/questions/7121146/web2py-custom-user-profile
But i still have problems to find how to make list:related to an ohter app 
or make a global auth extend in db for all app.

Regards
Bussiere


Le jeudi 8 mars 2012 21:47:08 UTC+1, bussiere adrien a écrit :
>
> Hello i'am looking for tutorial to :
>
> Extends user add field to database.
>
> Then :
> an app street
> an app buildint
>
> link building field with street field
>
> And more tutorial
>
> Regards
>
> Bussiere
>


[web2py] looking for tutorial extends user and related to an other app

2012-03-08 Thread bussiere adrien
Hello i'am looking for tutorial to :

Extends user add field to database.

Then :
an app street
an app buildint

link building field with street field

And more tutorial

Regards

Bussiere