[web2py:32277] help on sending email on gae

2009-10-05 Thread vneve

I can send mails when running on localhost, but could not get this
working after deploying to gae. I'm using this from the default db.py:

mail.settings.server='smtp.gmail.com:587'# your SMTP server
mail.settings.sender = 'em...@gmail.com' # your email
mail.settings.logi n= 'email:**'  # your credentials or None

I'm not using email verification, only password retrieval.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32276] Re: anti spam, anti porn strategy?

2009-10-05 Thread Richard

I've used the recaptcha built in to auth_user registration and it
worked well. Is it easy to integrate with other forms?


On Oct 6, 1:34 am, david bain  wrote:
> implementing a captcha or recaptcha based system should help.
>
> On Mon, Oct 5, 2009 at 9:27 AM, Web2py-SuperFan  wrote:
>
> > Hi all,
>
> > I'm implementing a comments and wiki feature on my web2py app.  Is
> > there any best practices or strategies you've used or would recommend
> > on preventing spam or porn posts onto the site.  I'm looking for some
> > automated prevention as I'm afraid the amount of posts will be way too
> > much for human monitoring.  Its a social site.
>
> > Thanks for all your pointers.
>
> > Mark
>
> --
> SplashStart - Professional Websites. Starting Now.http://www.splashstart.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32275] Re: newbie looking for style advice

2009-10-05 Thread Richard

when you redirect you get a new request object so you could pass the
data to the new request.vars with:
URL(r=request, f='add_2', vars={'x':request.vars.x,
'y':request.vars.y})
or simply:
URL(r=request, f='add_2', vars=request.vars)

Probably better to pass temporary data in vars than store in session.

Richard


On Oct 6, 5:26 am, devnull  wrote:
> Below is the difficulty I was having getting request.vars to the
> target of the redirect. [add] redirects to [add_2], and when it does,
> request.vars doesn't have .x and .y ... instead I find myself stuffing
> x and y into the session explicitly and then pulling them out in
> [add_2] also explicitly.
>
> Is there something in the framework that handles this? (I feel like
> I'm missing something only a newbie would miss).  :-)  maybe
> [redirect] or [URL] takes another argument that I don't know about
> yet... I hope I've freed you from the notion that I know what I'm
> doing :-P
>
> def add():
>     form=SQLFORM.factory(
>         Field('x','double',
>               requires=IS_FLOAT_IN_RANGE(
>                   0,500,
>                   error_message='number between 0 and 500 required')),
>         Field('y','double',
>               requires=IS_FLOAT_IN_RANGE(
>                   0,100,
>                   error_message='number between 0 and 100 required')))
>     if form.accepts(request.vars, session):
>         session.x = request.vars.x
>         session.y = request.vars.y
>         redirect(URL(r=request,f='add_2'))
>     return dict(form=form)
>
> def add_2():
>     x=session.x
>     y=session.y
>     sum=float(x)+float(y)
>     return dict(x=x,y=y,sum=sum)
>
> On Oct 5, 11:31 am, mdipierro  wrote:
>
> > Thank you devnull,
>
> > some answers below:
>
> > On Oct 5, 10:14 am, devnull  wrote:
>
> > > Hello all. Just discovered web2py and I think it's great. I wish we
> > > were using it here at work, and so do some of my co-workers.
>
> > > I have created a little form as an exercise for myself and I came up
> > > with some questions.
>
> > > It's likely that some of the things I'm wondering about are handled by
> > > the framework and I just don't know it yet...
>
> > > ... and the rest of the stuff is probably telltale stylistic noob-ness
> > > that I hope you'll point out.
>
> > > At the bottom is the controller and view for my form. There's no model
> > > yet. The form just adds two values, x and y. Here are the questions.
>
> > > 1. The basic structure of the form is defined in the controller part.
> > > I did this so I could use the 'requires' argument to the INPUT method
> > > to specify a validator. Is this ok? The reason I ask is it feels like
> > > I'm putting view stuff in the controller when I say things like TABLE
> > > and TR...
>
> > You can do
> > form=SQLFORM.factory(Field('x',double')),Field('y','double')))
>
> > and in view
> > {{=form.custom.begin}}
> > {{=form.custom.widget.x}}
> > {{=form.custom.widget.y}}
> > {{=form.custom.submit}}
> > {{=form.custom.end}}
> > then insert the HTML you need in the view.
>
> > > 2. I wanted a more specific error message for each field which uses an
> > > is-float-in-range validator ... But is there a way to refer to the
> > > actual max and min without repeating it in the string? Something like
> > > $max and $min?
>
> > No, there is not. We could add it. If we do it would be %{minimum}s %
> > (maximum)s. Pros/Cons?
>
> > > 3. At the end of the controller, am I making a mistake by passing x
> > > and y explicitly? Are they also hiding inside form and can I extract x
> > > and y from the form in the view html?
>
> > You are not but form.vars.x is available inside the view since you are
> > passing the form.
>
> > > 4. Would it be a better practice to redirect the user to another page
> > > for the result instead of doing everything on the same page? I tried
> > > this but had some difficulty getting x and y in the second page for
> > > processing (adding).
>
> > I like to redirect on accept. In this case there is no different but
> > you may have multiple objects in one page that depend on one another.
> > Without an explicit redirection it ma be difficult to keep track of
> > their state.
>
> > > 5. Do you have any other advice?
>
> > No. It seems to me you know aht you are doing.
>
> > > Looking forward to learning from you all. Thanks in advance!
>
> > > controller:
>
> > > def form_example():
> > >     form=FORM(TABLE(
> > >         TR('x',
> > >            INPUT(_type='text',_name='x',
> > >                  requires=IS_FLOAT_IN_RANGE(
> > >                      0,500,
> > >                      error_message='number between 0 and 500
> > > required'))),
> > >         TR('y',
> > >            INPUT(_type='text',_name='y',
> > >                  requires=IS_FLOAT_IN_RANGE(
> > >                      0,100,
> > >                      error_message='number between 0 and 100
> > > required'))),
> > >         TR('',INPUT(_type='submit',
> > >                     _value='add'
> > >     sum =

[web2py:32274] Re: Database administration - db upload field

2009-10-05 Thread mdipierro

I do not understand the question

Massimo

On Oct 5, 11:05 pm, yamandu  wrote:
> I was almost blaming SQLite and almost changed it.
> Why the need of the default attribute?
> Is this a bug? I did not understand.
>
> On 10 set, 17:36, mdipierro  wrote:
>
> > def upload():
> >     import cStringIO
> >     data=request.body.read()
> >     f=cStringIO.StringIO(data)
> >     current_filename='bla.bla' # how to you know the file extension if
> > you do not pass the name?
> >     new_filename=db.mytable.picture.store(f,current_filename)
> >     # do something with new_filename and data
>
> > On Sep 10, 2:40 pm, ab  wrote:
>
> > > I don't know uploaded file name. There is only stream of bytes to save
> > > in blob field.
>
> > > On Sep 10, 9:27 pm, mdipierro  wrote:
>
> > > > It depends on how you send the file. Can you send me an example?
>
> > > > On Sep 10, 2:19 pm, ab  wrote:
>
> > > > > Thanks. Working fine.
>
> > > > > I have one more question.
>
> > > > > When I upload file by database administration, field file contains for
> > > > > example following entry -
> > > > > picture.file.975598ae58526cda.
> > > > > 46697265666f785f77616c6c70617065722a706a67.png
>
> > > > > I want to upload files by REST. Is there function which I can use to
> > > > > calucate file field value as above?
>
> > > > > On Sep 10, 7:25 pm, mdipierro  wrote:
>
> > > > > > Please try
>
> > > > > >   Field('file_data','blob',default=''))
>
> > > > > > On Sep 10, 10:57 am, ab  wrote:
>
> > > > > > > Hi
>
> > > > > > >   I found issue in database administration module and blob field 
> > > > > > > for
> > > > > > > files storage
>
> > > > > > >   When model is defined as below
>
> > > > > > >  db.define_table('picture', Field('file','upload'))
>
> > > > > > >   there is no problem with inserting new records using 'database
> > > > > > > administration'
>
> > > > > > > but when model is defined to store files in database as below
>
> > > > > > > db.define_table('picture',
> > > > > > >   Field('file','upload',uploadfield='file_data'),
> > > > > > >   Field('file_data','blob'))
>
> > > > > > > 'database administration' can't insert new record.
>
> > > > > > > I don't know if this is issue or current limitation.
>
> > > > > > > Regards
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32273] Re: Database administration - db upload field

2009-10-05 Thread yamandu

I was almost blaming SQLite and almost changed it.
Why the need of the default attribute?
Is this a bug? I did not understand.

On 10 set, 17:36, mdipierro  wrote:
> def upload():
>     import cStringIO
>     data=request.body.read()
>     f=cStringIO.StringIO(data)
>     current_filename='bla.bla' # how to you know the file extension if
> you do not pass the name?
>     new_filename=db.mytable.picture.store(f,current_filename)
>     # do something with new_filename and data
>
> On Sep 10, 2:40 pm, ab  wrote:
>
> > I don't know uploaded file name. There is only stream of bytes to save
> > in blob field.
>
> > On Sep 10, 9:27 pm, mdipierro  wrote:
>
> > > It depends on how you send the file. Can you send me an example?
>
> > > On Sep 10, 2:19 pm, ab  wrote:
>
> > > > Thanks. Working fine.
>
> > > > I have one more question.
>
> > > > When I upload file by database administration, field file contains for
> > > > example following entry -
> > > > picture.file.975598ae58526cda.
> > > > 46697265666f785f77616c6c70617065722a706a67.png
>
> > > > I want to upload files by REST. Is there function which I can use to
> > > > calucate file field value as above?
>
> > > > On Sep 10, 7:25 pm, mdipierro  wrote:
>
> > > > > Please try
>
> > > > >   Field('file_data','blob',default=''))
>
> > > > > On Sep 10, 10:57 am, ab  wrote:
>
> > > > > > Hi
>
> > > > > >   I found issue in database administration module and blob field for
> > > > > > files storage
>
> > > > > >   When model is defined as below
>
> > > > > >  db.define_table('picture', Field('file','upload'))
>
> > > > > >   there is no problem with inserting new records using 'database
> > > > > > administration'
>
> > > > > > but when model is defined to store files in database as below
>
> > > > > > db.define_table('picture',
> > > > > >   Field('file','upload',uploadfield='file_data'),
> > > > > >   Field('file_data','blob'))
>
> > > > > > 'database administration' can't insert new record.
>
> > > > > > I don't know if this is issue or current limitation.
>
> > > > > > Regards
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32272] Re: drupal hooks

2009-10-05 Thread Richard

I agree Drupal modules work well - simple to install/use/uninstall and
cover a wide range of functionality.
Also Firefox extensions do a good job.


On Oct 6, 7:32 am, mdipierro  wrote:
> I am not suggesting we implement hooks.
>
> I am pointing web2py users to a place where people have actually build
> a plugins (modules) system that has been successful in practice.
>
> The implementation is ugly and we should not copy that but it may give
> us some ideas about what plugins should do or should not do.
>
> On Oct 5, 1:58 pm, Alex Fanjul  wrote:
>
> > I thought that "Hooks"  is the "mend/patch" for non objetc oriented
> > languages/frameworks like Drupal, because Drupal started in php4 when
> > php wasnt object oriented yet... (no inheritance, no interfaces, ...)
> > By the way, What is the language paradigm of web2py? it is object
> > oriented, isnt it?
>
> > regards
> > alex f
>
> > El 05/10/2009 18:20, mdipierro escribió:
>
> > > In the context of creating a plugin system this may be useful:
>
> > >http://api.drupal.org/api/group/hooks/7
>
> > --
> > Alejandro Fanjul Fdez.
> > alex.fan...@gmail.comwww.mhproject.org
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32271] Re: Unit Testing Controllers with auth.requires_login

2009-10-05 Thread mdipierro

we normally suggest using doctests and int this case you can use
web2py.py -T

if you want to use unittest you should look into

gluon/shell.py exec_environment(...)

The problem is that you are not just testing functions that take an
input and return an output. They needs to have an environment to
work.

Massimo


On Oct 5, 10:03 pm, Dmitri Zagidulin  wrote:
> Ok, I think I understand, so far.
>
> My main question still stands, though - how can I import or
> instantiate a model file, externally (say, for unit testing)? And do
> you have any suggestions on how to unit test auth-protected controller
> functions?
>
> On Mon, Oct 5, 2009 at 10:59 PM, mdipierro  wrote:
>
> > If a function needs to be used by multiple controllers in the same
> > app, the easy solution is to put it into a model file.
>
> > If a function needs to be used by multiple controllers in different
> > applications than it needs to be defined in a module, imported, passed
> > the required global variables and called by the controllers.
>
> > Although code reuse is good and important it breaks the principle that
> > each web2py applications should be stand alone (if two apps depend on
> > each other, they they should be the same app).
>
> > One repetition that you cannot avoid is listing in controllers the
> > functions that you want to expose. This is unavoidable because by
> > forcing you to code this we try prevent you from having two
> > controllers expose the same functionality and we prevent hidden
> > controller actions (expose functions by mistake).
>
> > Massimo
>
> > On Oct 5, 9:34 pm, Dmitri Zagidulin  wrote:
> >> Actually, my main question is simply - how does one use/instantiate
> >> Model code from external files? (Like, if I want to do outsource some
> >> business logic to a module, so that several controllers can reuse it?)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32270] Re: Unit Testing Controllers with auth.requires_login

2009-10-05 Thread Dmitri Zagidulin

Ok, I think I understand, so far.

My main question still stands, though - how can I import or
instantiate a model file, externally (say, for unit testing)? And do
you have any suggestions on how to unit test auth-protected controller
functions?

On Mon, Oct 5, 2009 at 10:59 PM, mdipierro  wrote:
>
> If a function needs to be used by multiple controllers in the same
> app, the easy solution is to put it into a model file.
>
> If a function needs to be used by multiple controllers in different
> applications than it needs to be defined in a module, imported, passed
> the required global variables and called by the controllers.
>
> Although code reuse is good and important it breaks the principle that
> each web2py applications should be stand alone (if two apps depend on
> each other, they they should be the same app).
>
> One repetition that you cannot avoid is listing in controllers the
> functions that you want to expose. This is unavoidable because by
> forcing you to code this we try prevent you from having two
> controllers expose the same functionality and we prevent hidden
> controller actions (expose functions by mistake).
>
>
> Massimo
>
> On Oct 5, 9:34 pm, Dmitri Zagidulin  wrote:
>> Actually, my main question is simply - how does one use/instantiate
>> Model code from external files? (Like, if I want to do outsource some
>> business logic to a module, so that several controllers can reuse it?)
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32269] Re: Unit Testing Controllers with auth.requires_login

2009-10-05 Thread mdipierro

If a function needs to be used by multiple controllers in the same
app, the easy solution is to put it into a model file.

If a function needs to be used by multiple controllers in different
applications than it needs to be defined in a module, imported, passed
the required global variables and called by the controllers.

Although code reuse is good and important it breaks the principle that
each web2py applications should be stand alone (if two apps depend on
each other, they they should be the same app).

One repetition that you cannot avoid is listing in controllers the
functions that you want to expose. This is unavoidable because by
forcing you to code this we try prevent you from having two
controllers expose the same functionality and we prevent hidden
controller actions (expose functions by mistake).


Massimo

On Oct 5, 9:34 pm, Dmitri Zagidulin  wrote:
> Actually, my main question is simply - how does one use/instantiate
> Model code from external files? (Like, if I want to do outsource some
> business logic to a module, so that several controllers can reuse it?)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32268] Re: Unit Testing Controllers with auth.requires_login

2009-10-05 Thread Dmitri Zagidulin

Actually, my main question is simply - how does one use/instantiate
Model code from external files? (Like, if I want to do outsource some
business logic to a module, so that several controllers can reuse it?)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32267] Re: Database Synchronization and UUID's

2009-10-05 Thread mdipierro

I added the corresponding arguments to db.import_from_csv_file in
trunk so that the example works as listed (but without auth)
Sorry for this error.

Massimo



On Oct 5, 9:10 pm, mdipierro  wrote:
> GRR this is a major error in the manual
>
> In book page 172
>
> db.import_to_csv_file(form.vars.data.file,unique=False)
>
> is supposed to be:
>
> db.import_from_csv_file(form.vars.data.file)
>
> only db[table].import_from_csv_file take the unique argument. not the
> import of the entire DB.
>
> You get the KeyError because you probably have auth_tables that do not
> have a uuid. The example only works if you do not have auth enabled
> (comment auth.define_tables())
>
> Massimo
>
> On Oct 5, 12:38 pm, CJSteel  wrote:
>
> > Database Synchronization and UUID's
>
> > I am wondering if I need to do searches by uuid's in a different way.
> > I have been experimenting with them and frequently run into the error -> 
> > KeyError: 'uuid' when attempting to do queries or when trying to
>
> > pass them as variables from controllers to views and vice-versa.
>
> > At the moment I am working with the example in the book (171-173) and
> > seem to be getting the same error again with the book example in
> > addition to one other error:
>
> >     TypeError: import_from_csv_file() got an unexpected keyword
> > argument 'unique'
>
> > OR
>
> >     KeyError: 'uuid'
>
> > I can eliminate the first error by changing the following line in the
> > import function:
>
> >     db.import_from_csv_file(form.vars.data.file,unique=False)
>
> > to be
>
> >     db.import_from_csv_file(form.vars.data.file) #removed unique=False
>
> > but then the now dreaded KeyError: 'uuid' shows up again. Here are
> > some links to my current db.py and default.py which are basically from
> > the book, although I needed to import some additional modules to get
> > it working and needed to change "now" to be "request.now" :
>
> > db.py
> >    view          http://vishpala.com/resources/web2py/db.py/view
> >    download  http://vishpala.com/resources/web2py/db.py/at_download/file
>
> > default.py
> >     view        http://vishpala.com/resources/web2py/default.py/view
> >     downloadhttp://vishpala.com/resources/web2py/default.py/at_download/file
>
> > This line in the book intrigued me but I was not sure about how to go
> > about creating an index manually to make searching by uuid's go
> > faster, especially since I seem to be unable to search by uuid's at
> > all. I have a feeling it is a formatting issue (standard index int vs
> > the uuid format which includes dashes.
>
> >     "Create an index manually to make the search by uuid faster."
>
> > I would appreciate any assistance and or suggestions, especially in
> > regards to a functioning query search by uuid and getting the import
> > function working.
>
> > Web2py rocks!
>
> > Cheers,
>
> > Christopher Steel
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32266] Re: Database Synchronization and UUID's

2009-10-05 Thread mdipierro

GRR this is a major error in the manual

In book page 172

db.import_to_csv_file(form.vars.data.file,unique=False)

is supposed to be:

db.import_from_csv_file(form.vars.data.file)

only db[table].import_from_csv_file take the unique argument. not the
import of the entire DB.

You get the KeyError because you probably have auth_tables that do not
have a uuid. The example only works if you do not have auth enabled
(comment auth.define_tables())

Massimo


On Oct 5, 12:38 pm, CJSteel  wrote:
> Database Synchronization and UUID's
>
> I am wondering if I need to do searches by uuid's in a different way.
> I have been experimenting with them and frequently run into the error -> 
> KeyError: 'uuid' when attempting to do queries or when trying to
>
> pass them as variables from controllers to views and vice-versa.
>
> At the moment I am working with the example in the book (171-173) and
> seem to be getting the same error again with the book example in
> addition to one other error:
>
>     TypeError: import_from_csv_file() got an unexpected keyword
> argument 'unique'
>
> OR
>
>     KeyError: 'uuid'
>
> I can eliminate the first error by changing the following line in the
> import function:
>
>     db.import_from_csv_file(form.vars.data.file,unique=False)
>
> to be
>
>     db.import_from_csv_file(form.vars.data.file) #removed unique=False
>
> but then the now dreaded KeyError: 'uuid' shows up again. Here are
> some links to my current db.py and default.py which are basically from
> the book, although I needed to import some additional modules to get
> it working and needed to change "now" to be "request.now" :
>
> db.py
>    view          http://vishpala.com/resources/web2py/db.py/view
>    download  http://vishpala.com/resources/web2py/db.py/at_download/file
>
> default.py
>     view        http://vishpala.com/resources/web2py/default.py/view
>     downloadhttp://vishpala.com/resources/web2py/default.py/at_download/file
>
> This line in the book intrigued me but I was not sure about how to go
> about creating an index manually to make searching by uuid's go
> faster, especially since I seem to be unable to search by uuid's at
> all. I have a feeling it is a formatting issue (standard index int vs
> the uuid format which includes dashes.
>
>     "Create an index manually to make the search by uuid faster."
>
> I would appreciate any assistance and or suggestions, especially in
> regards to a functioning query search by uuid and getting the import
> function working.
>
> Web2py rocks!
>
> Cheers,
>
> Christopher Steel
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32265] Re: "Add" button next to "combo box"

2009-10-05 Thread Renato-ES-Brazil

Massimo, I don't believe! The solution is simpler than I thought. :-)
Thanks a lot! :-)

>From what I read in the manual I thought I had to extend SQLFORM
manually.

The solution solved my needs, but just to clarify me, how I could
implement the same solution but using a class that extends SQLFORM?

On Oct 5, 10:31 pm, mdipierro  wrote:
> I do not think you need to extend SQLFORM to implement this. You just
> need a new widget for the reference field. I think.
> Not that there is anything worng with extending SQLFORM but I think it
> may be more complex that needs to be.
>
> On Oct 5, 8:22 pm, Renato-ES-Brazil  wrote:
>
> > I've created a simple code.
>
> > In my db_task.py I have the following lines, among others:
>
> > from applications.myapp.modules.mywidgets import *
>
> > db.main.product.requires=IS_IN_DB(db,db.product.id,db.product.name,
> > orderby=~db.product.name)
> > db.main.product.widget = options_with_add_link.widget
>
> > And in my module mywidgets.py I have the class:
>
> > class options_with_add_link(SQLFORM):
> >     @staticmethod
> >     def widget(field,value,**attr):
> >         select = OptionsWidget.widget(field,value,**attr)
> >         id = "%(tablename)s_%(fieldname)s" %
> > {"tablename":field._tablename,"fieldname":field.name}
> >         script_add_button = SCRIPT(
> >             """$(document).ready(function() {
> >                 $("#%(id)s").after(
> >                 \"%(text)s\"
> >                 );
> >             }
> >             )""" % {"id" : id,"url":URL
> > (a="myapp",c=field.name,f="create"),"text":"Add"}
> >         )
> >         return DIV(select, script_add_button)
>
> > Notice above, in the line where I create the "add" link, that I call
> > the "URL" method by passing hard coded values. I don't want it.
>
> > On Oct 5, 9:44 pm, Renato-ES-Brazil  wrote:
>
> > > I am here trying to create a custom widget, inside a class that
> > > extends SQLFORM, but how could I create a custom widget that allow me
> > > to send others parameters besides "field" and "value"?
>
> > > I would like call the new widget by sending the parameters "control"
> > > and "function". So, inside the function, I would use the values to
> > > create properly the "add" link (url).
>
> > > I found only a few examples of customization of widget.
>
> > > Thanks.
>
> > > On Oct 5, 8:03 am, Renato-ES-Brazil  wrote:
>
> > > > Cool!
>
> > > > Before I try to do something I really wanted to know if there was
> > > > something done by passing a parameter.
>
> > > > Thanks a lot guys!
>
> > > > On Oct 5, 1:08 am, mdipierro  wrote:
>
> > > > > It would be nice to a widget that does this.
>
> > > > > On Oct 4, 10:14 pm, Álvaro Justen [Turicas] 
> > > > > wrote:
>
> > > > > > On Sat, Oct 3, 2009 at 02:52, Iceberg  wrote:
>
> > > > > > > On Oct3, 8:41am, Renato-ES-Brazil  
> > > > > > > wrote:
> > > > > > >> Hi guys!
>
> > > > > > >> When the form displays the select with several options from the 
> > > > > > >> other
> > > > > > >> table, using the "is_in_db" configuration, couldn't also to put a
> > > > > > >> button, for example "ADD NOW", next to it to allows add a new 
> > > > > > >> option?
>
> > > > > > >> Currently is there this possibility for the CRUD (create and 
> > > > > > >> update
> > > > > > >> forms)?
>
> > > > > > > I've been in same situation as you mentioned. Here is my journey.
>
> > > > > > > Adding a "Add Now" button is easy. You can either customize the 
> > > > > > > form,
> > > > > > > or customize the widget, or just use some jquery effect in a way 
> > > > > > > like
> > > > > > > this:
>
> > > > > > >  def youraction():
> > > > > > >    form=crud.create(...)
> > > > > > >    ...
> > > > > > >    return dict(form=DIV(
> > > > > > >      form,
> > > > > > >      SCRIPT('''$(document).ready(function() {
> > > > > > >      $("#your_widgit_id").after(
> > > > > > >        "Add 
> > > > > > > Now > > > > > > a>");
> > > > > > >      });'''),
> > > > > > >      ))
>
> > > > > > > However, I found that after successfully adding a new entry into 
> > > > > > > db,
> > > > > > > there is no obvious way to refresh the is_in_db field itself,
> > > > > > > providing that I don't want to HARDCODE one more dedicated ajax 
> > > > > > > action
> > > > > > > in my already-too-complex controller.
>
> > > > > > > So, my user still have to refresh the whole original page to see 
> > > > > > > the
> > > > > > > change after "add now", with a price of losing all his previous 
> > > > > > > input.
> > > > > > > Lucky enough that I could arrange the is_in_db field at the first 
> > > > > > > line
> > > > > > > of my form, so the waste of input is minimum. In this case, the
> > > > > > > benefit of "Add Now" button is not as big as we thought.
>
> > > > > > > If anybody knows a better solution, please give me some tips. 
> > > > > > > Thanks!
>
> > > > > > You could open a popup with a SQLFORM to create a new register in
> > > > > > other table, with a JavaScript/AJAX to update dropdown's options 
> 

[web2py:32264] Re: "Add" button next to "combo box"

2009-10-05 Thread mdipierro

I do not think you need to extend SQLFORM to implement this. You just
need a new widget for the reference field. I think.
Not that there is anything worng with extending SQLFORM but I think it
may be more complex that needs to be.

On Oct 5, 8:22 pm, Renato-ES-Brazil  wrote:
> I've created a simple code.
>
> In my db_task.py I have the following lines, among others:
>
> from applications.myapp.modules.mywidgets import *
>
> db.main.product.requires=IS_IN_DB(db,db.product.id,db.product.name,
> orderby=~db.product.name)
> db.main.product.widget = options_with_add_link.widget
>
> And in my module mywidgets.py I have the class:
>
> class options_with_add_link(SQLFORM):
>     @staticmethod
>     def widget(field,value,**attr):
>         select = OptionsWidget.widget(field,value,**attr)
>         id = "%(tablename)s_%(fieldname)s" %
> {"tablename":field._tablename,"fieldname":field.name}
>         script_add_button = SCRIPT(
>             """$(document).ready(function() {
>                 $("#%(id)s").after(
>                 \"%(text)s\"
>                 );
>             }
>             )""" % {"id" : id,"url":URL
> (a="myapp",c=field.name,f="create"),"text":"Add"}
>         )
>         return DIV(select, script_add_button)
>
> Notice above, in the line where I create the "add" link, that I call
> the "URL" method by passing hard coded values. I don't want it.
>
> On Oct 5, 9:44 pm, Renato-ES-Brazil  wrote:
>
> > I am here trying to create a custom widget, inside a class that
> > extends SQLFORM, but how could I create a custom widget that allow me
> > to send others parameters besides "field" and "value"?
>
> > I would like call the new widget by sending the parameters "control"
> > and "function". So, inside the function, I would use the values to
> > create properly the "add" link (url).
>
> > I found only a few examples of customization of widget.
>
> > Thanks.
>
> > On Oct 5, 8:03 am, Renato-ES-Brazil  wrote:
>
> > > Cool!
>
> > > Before I try to do something I really wanted to know if there was
> > > something done by passing a parameter.
>
> > > Thanks a lot guys!
>
> > > On Oct 5, 1:08 am, mdipierro  wrote:
>
> > > > It would be nice to a widget that does this.
>
> > > > On Oct 4, 10:14 pm, Álvaro Justen [Turicas] 
> > > > wrote:
>
> > > > > On Sat, Oct 3, 2009 at 02:52, Iceberg  wrote:
>
> > > > > > On Oct3, 8:41am, Renato-ES-Brazil  wrote:
> > > > > >> Hi guys!
>
> > > > > >> When the form displays the select with several options from the 
> > > > > >> other
> > > > > >> table, using the "is_in_db" configuration, couldn't also to put a
> > > > > >> button, for example "ADD NOW", next to it to allows add a new 
> > > > > >> option?
>
> > > > > >> Currently is there this possibility for the CRUD (create and update
> > > > > >> forms)?
>
> > > > > > I've been in same situation as you mentioned. Here is my journey.
>
> > > > > > Adding a "Add Now" button is easy. You can either customize the 
> > > > > > form,
> > > > > > or customize the widget, or just use some jquery effect in a way 
> > > > > > like
> > > > > > this:
>
> > > > > >  def youraction():
> > > > > >    form=crud.create(...)
> > > > > >    ...
> > > > > >    return dict(form=DIV(
> > > > > >      form,
> > > > > >      SCRIPT('''$(document).ready(function() {
> > > > > >      $("#your_widgit_id").after(
> > > > > >        "Add Now > > > > > a>");
> > > > > >      });'''),
> > > > > >      ))
>
> > > > > > However, I found that after successfully adding a new entry into db,
> > > > > > there is no obvious way to refresh the is_in_db field itself,
> > > > > > providing that I don't want to HARDCODE one more dedicated ajax 
> > > > > > action
> > > > > > in my already-too-complex controller.
>
> > > > > > So, my user still have to refresh the whole original page to see the
> > > > > > change after "add now", with a price of losing all his previous 
> > > > > > input.
> > > > > > Lucky enough that I could arrange the is_in_db field at the first 
> > > > > > line
> > > > > > of my form, so the waste of input is minimum. In this case, the
> > > > > > benefit of "Add Now" button is not as big as we thought.
>
> > > > > > If anybody knows a better solution, please give me some tips. 
> > > > > > Thanks!
>
> > > > > You could open a popup with a SQLFORM to create a new register in
> > > > > other table, with a JavaScript/AJAX to update dropdown's options (and
> > > > > select option that was created), like Djando admin do.
> > > > > You could also use a "overlay" to show the form instead of the popup.
> > > > > See:http://alvarojunior.com/jquery/joverlay/0.7.1/
>
> > > > > --
> > > > >  Álvaro Justen
> > > > >  Peta5 - Telecomunicações e Software Livre
> > > > >  21 3021-6001 / 9898-0141
> > > > >  http://www.peta5.com.br/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe 

[web2py:32263] Re: "Add" button next to "combo box"

2009-10-05 Thread Renato-ES-Brazil

I've created a simple code.

In my db_task.py I have the following lines, among others:

from applications.myapp.modules.mywidgets import *

db.main.product.requires=IS_IN_DB(db,db.product.id,db.product.name,
orderby=~db.product.name)
db.main.product.widget = options_with_add_link.widget


And in my module mywidgets.py I have the class:

class options_with_add_link(SQLFORM):
@staticmethod
def widget(field,value,**attr):
select = OptionsWidget.widget(field,value,**attr)
id = "%(tablename)s_%(fieldname)s" %
{"tablename":field._tablename,"fieldname":field.name}
script_add_button = SCRIPT(
"""$(document).ready(function() {
$("#%(id)s").after(
\"%(text)s\"
);
}
)""" % {"id" : id,"url":URL
(a="myapp",c=field.name,f="create"),"text":"Add"}
)
return DIV(select, script_add_button)



Notice above, in the line where I create the "add" link, that I call
the "URL" method by passing hard coded values. I don't want it.




On Oct 5, 9:44 pm, Renato-ES-Brazil  wrote:
> I am here trying to create a custom widget, inside a class that
> extends SQLFORM, but how could I create a custom widget that allow me
> to send others parameters besides "field" and "value"?
>
> I would like call the new widget by sending the parameters "control"
> and "function". So, inside the function, I would use the values to
> create properly the "add" link (url).
>
> I found only a few examples of customization of widget.
>
> Thanks.
>
> On Oct 5, 8:03 am, Renato-ES-Brazil  wrote:
>
> > Cool!
>
> > Before I try to do something I really wanted to know if there was
> > something done by passing a parameter.
>
> > Thanks a lot guys!
>
> > On Oct 5, 1:08 am, mdipierro  wrote:
>
> > > It would be nice to a widget that does this.
>
> > > On Oct 4, 10:14 pm, Álvaro Justen [Turicas] 
> > > wrote:
>
> > > > On Sat, Oct 3, 2009 at 02:52, Iceberg  wrote:
>
> > > > > On Oct3, 8:41am, Renato-ES-Brazil  wrote:
> > > > >> Hi guys!
>
> > > > >> When the form displays the select with several options from the other
> > > > >> table, using the "is_in_db" configuration, couldn't also to put a
> > > > >> button, for example "ADD NOW", next to it to allows add a new option?
>
> > > > >> Currently is there this possibility for the CRUD (create and update
> > > > >> forms)?
>
> > > > > I've been in same situation as you mentioned. Here is my journey.
>
> > > > > Adding a "Add Now" button is easy. You can either customize the form,
> > > > > or customize the widget, or just use some jquery effect in a way like
> > > > > this:
>
> > > > >  def youraction():
> > > > >    form=crud.create(...)
> > > > >    ...
> > > > >    return dict(form=DIV(
> > > > >      form,
> > > > >      SCRIPT('''$(document).ready(function() {
> > > > >      $("#your_widgit_id").after(
> > > > >        "Add Now > > > > a>");
> > > > >      });'''),
> > > > >      ))
>
> > > > > However, I found that after successfully adding a new entry into db,
> > > > > there is no obvious way to refresh the is_in_db field itself,
> > > > > providing that I don't want to HARDCODE one more dedicated ajax action
> > > > > in my already-too-complex controller.
>
> > > > > So, my user still have to refresh the whole original page to see the
> > > > > change after "add now", with a price of losing all his previous input.
> > > > > Lucky enough that I could arrange the is_in_db field at the first line
> > > > > of my form, so the waste of input is minimum. In this case, the
> > > > > benefit of "Add Now" button is not as big as we thought.
>
> > > > > If anybody knows a better solution, please give me some tips. Thanks!
>
> > > > You could open a popup with a SQLFORM to create a new register in
> > > > other table, with a JavaScript/AJAX to update dropdown's options (and
> > > > select option that was created), like Djando admin do.
> > > > You could also use a "overlay" to show the form instead of the popup.
> > > > See:http://alvarojunior.com/jquery/joverlay/0.7.1/
>
> > > > --
> > > >  Álvaro Justen
> > > >  Peta5 - Telecomunicações e Software Livre
> > > >  21 3021-6001 / 9898-0141
> > > >  http://www.peta5.com.br/
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32262] Re: "Add" button next to "combo box"

2009-10-05 Thread mdipierro

you can do something like

class MyWidget:
def __init__(self,**parameters):
 self.parameters=parameters
def __call__(self,field,value):
 # use self.parameters
 return INPUT(_type='text',_name=field.name,_value=value)

db.table.field.widget=MyWidget(parameter1="1",parameter2="2")

On Oct 5, 7:44 pm, Renato-ES-Brazil  wrote:
> I am here trying to create a custom widget, inside a class that
> extends SQLFORM, but how could I create a custom widget that allow me
> to send others parameters besides "field" and "value"?
>
> I would like call the new widget by sending the parameters "control"
> and "function". So, inside the function, I would use the values to
> create properly the "add" link (url).
>
> I found only a few examples of customization of widget.
>
> Thanks.
>
> On Oct 5, 8:03 am, Renato-ES-Brazil  wrote:
>
> > Cool!
>
> > Before I try to do something I really wanted to know if there was
> > something done by passing a parameter.
>
> > Thanks a lot guys!
>
> > On Oct 5, 1:08 am, mdipierro  wrote:
>
> > > It would be nice to a widget that does this.
>
> > > On Oct 4, 10:14 pm, Álvaro Justen [Turicas] 
> > > wrote:
>
> > > > On Sat, Oct 3, 2009 at 02:52, Iceberg  wrote:
>
> > > > > On Oct3, 8:41am, Renato-ES-Brazil  wrote:
> > > > >> Hi guys!
>
> > > > >> When the form displays the select with several options from the other
> > > > >> table, using the "is_in_db" configuration, couldn't also to put a
> > > > >> button, for example "ADD NOW", next to it to allows add a new option?
>
> > > > >> Currently is there this possibility for the CRUD (create and update
> > > > >> forms)?
>
> > > > > I've been in same situation as you mentioned. Here is my journey.
>
> > > > > Adding a "Add Now" button is easy. You can either customize the form,
> > > > > or customize the widget, or just use some jquery effect in a way like
> > > > > this:
>
> > > > >  def youraction():
> > > > >    form=crud.create(...)
> > > > >    ...
> > > > >    return dict(form=DIV(
> > > > >      form,
> > > > >      SCRIPT('''$(document).ready(function() {
> > > > >      $("#your_widgit_id").after(
> > > > >        "Add Now > > > > a>");
> > > > >      });'''),
> > > > >      ))
>
> > > > > However, I found that after successfully adding a new entry into db,
> > > > > there is no obvious way to refresh the is_in_db field itself,
> > > > > providing that I don't want to HARDCODE one more dedicated ajax action
> > > > > in my already-too-complex controller.
>
> > > > > So, my user still have to refresh the whole original page to see the
> > > > > change after "add now", with a price of losing all his previous input.
> > > > > Lucky enough that I could arrange the is_in_db field at the first line
> > > > > of my form, so the waste of input is minimum. In this case, the
> > > > > benefit of "Add Now" button is not as big as we thought.
>
> > > > > If anybody knows a better solution, please give me some tips. Thanks!
>
> > > > You could open a popup with a SQLFORM to create a new register in
> > > > other table, with a JavaScript/AJAX to update dropdown's options (and
> > > > select option that was created), like Djando admin do.
> > > > You could also use a "overlay" to show the form instead of the popup.
> > > > See:http://alvarojunior.com/jquery/joverlay/0.7.1/
>
> > > > --
> > > >  Álvaro Justen
> > > >  Peta5 - Telecomunicações e Software Livre
> > > >  21 3021-6001 / 9898-0141
> > > >  http://www.peta5.com.br/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32261] Re: "Add" button next to "combo box"

2009-10-05 Thread Renato-ES-Brazil

I am here trying to create a custom widget, inside a class that
extends SQLFORM, but how could I create a custom widget that allow me
to send others parameters besides "field" and "value"?

I would like call the new widget by sending the parameters "control"
and "function". So, inside the function, I would use the values to
create properly the "add" link (url).

I found only a few examples of customization of widget.

Thanks.


On Oct 5, 8:03 am, Renato-ES-Brazil  wrote:
> Cool!
>
> Before I try to do something I really wanted to know if there was
> something done by passing a parameter.
>
> Thanks a lot guys!
>
> On Oct 5, 1:08 am, mdipierro  wrote:
>
> > It would be nice to a widget that does this.
>
> > On Oct 4, 10:14 pm, Álvaro Justen [Turicas] 
> > wrote:
>
> > > On Sat, Oct 3, 2009 at 02:52, Iceberg  wrote:
>
> > > > On Oct3, 8:41am, Renato-ES-Brazil  wrote:
> > > >> Hi guys!
>
> > > >> When the form displays the select with several options from the other
> > > >> table, using the "is_in_db" configuration, couldn't also to put a
> > > >> button, for example "ADD NOW", next to it to allows add a new option?
>
> > > >> Currently is there this possibility for the CRUD (create and update
> > > >> forms)?
>
> > > > I've been in same situation as you mentioned. Here is my journey.
>
> > > > Adding a "Add Now" button is easy. You can either customize the form,
> > > > or customize the widget, or just use some jquery effect in a way like
> > > > this:
>
> > > >  def youraction():
> > > >    form=crud.create(...)
> > > >    ...
> > > >    return dict(form=DIV(
> > > >      form,
> > > >      SCRIPT('''$(document).ready(function() {
> > > >      $("#your_widgit_id").after(
> > > >        "Add Now > > > a>");
> > > >      });'''),
> > > >      ))
>
> > > > However, I found that after successfully adding a new entry into db,
> > > > there is no obvious way to refresh the is_in_db field itself,
> > > > providing that I don't want to HARDCODE one more dedicated ajax action
> > > > in my already-too-complex controller.
>
> > > > So, my user still have to refresh the whole original page to see the
> > > > change after "add now", with a price of losing all his previous input.
> > > > Lucky enough that I could arrange the is_in_db field at the first line
> > > > of my form, so the waste of input is minimum. In this case, the
> > > > benefit of "Add Now" button is not as big as we thought.
>
> > > > If anybody knows a better solution, please give me some tips. Thanks!
>
> > > You could open a popup with a SQLFORM to create a new register in
> > > other table, with a JavaScript/AJAX to update dropdown's options (and
> > > select option that was created), like Djando admin do.
> > > You could also use a "overlay" to show the form instead of the popup.
> > > See:http://alvarojunior.com/jquery/joverlay/0.7.1/
>
> > > --
> > >  Álvaro Justen
> > >  Peta5 - Telecomunicações e Software Livre
> > >  21 3021-6001 / 9898-0141
> > >  http://www.peta5.com.br/
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32260] Re: web2py + pyjamas desktop = a desktop framework?

2009-10-05 Thread don

Fluid, Prism and Chrome 'application short-cuts' all look very
similar.

Don.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32259] Re: web2py + pyjamas desktop = a desktop framework?

2009-10-05 Thread Jonathan Lundell

On Oct 5, 2009, at 5:02 PM, Álvaro Justen [Turicas] wrote:

> It depends on how you will distribute your application.
> My mother uses a system based on web2py and I've created a shell  
> script to:
> - kill any web2py.py process
> - start a new web2py.py process
> - open firefox in http://localhost:8000/myapp
> - kill process when firefox is closed (just add kill command after
> firefox command)
>
> I've created a desktop icon for this shell script and it works fine!
>
> So, it depends on your scenario.

I haven't tried it (for web2py, that is) myself, but the Fluid site- 
specific browser might be nice for this kind of application: 
http://fluidapp.com/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32258] Re: web2py + pyjamas desktop = a desktop framework?

2009-10-05 Thread don

Yes, that is a possibility.  I could do something similar to this
using a small Python application instead of a shell script as I
want something that will run on Windows.

Thanks,

Don.

On Oct 5, 8:02 pm, Álvaro Justen [Turicas] 
wrote:

> My mother uses a system based on web2py and I've created a shell script to:
> - kill any web2py.py process
> - start a new web2py.py process
> - open firefox inhttp://localhost:8000/myapp
> - kill process when firefox is closed (just add kill command after
> firefox command)
>
> I've created a desktop icon for this shell script and it works fine!
>
> --
>  Álvaro Justen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32257] Re: web2py + pyjamas desktop = a desktop framework?

2009-10-05 Thread Álvaro Justen [Turicas]

On Mon, Oct 5, 2009 at 15:22, don  wrote:
>
> What I would like is to not 'see the man behind the curtain',
> that is the server.
>
> I know that he is going to be there, somewhere, but I don't
> want the user to be aware of the server's existence - and that
> includes using a Windows service.  Ideally, I would like the
> application to be a 'portable application'.
>
> I wonder if the server could be 'glued' on to the back of the
> application/browser?  Assuming something like pyjamas desktop,
> webkit + pyqt or Prism then could a web-like desktop app be
> created as a single executable?
>
> This maybe what Richard did when he 'embedded web2py in a
> desktop app'?

It depends on how you will distribute your application.
My mother uses a system based on web2py and I've created a shell script to:
- kill any web2py.py process
- start a new web2py.py process
- open firefox in http://localhost:8000/myapp
- kill process when firefox is closed (just add kill command after
firefox command)

I've created a desktop icon for this shell script and it works fine!

So, it depends on your scenario.

> Don.
>
>
> 
-- 
 Álvaro Justen
 Peta5 - Telecomunicações e Software Livre
 21 3021-6001 / 9898-0141
 http://www.peta5.com.br/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32256] synchronize Google Apps groups with web2py groups?

2009-10-05 Thread Graham Charles

Has anyone already written code to synchronize Google Apps groups with
web2py groups? That is, I'd like to be able to make use of the groups
I've defined in Google Apps in decorator functions like

  @auth.requires_membership

The code in gluon.contrib.login_methods.gae_google_account retrieves a
logged-in Google Apps account only, not group or group membership.

Thanks,

g.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32255] Re: Midphase + web2py how do I set it up?

2009-10-05 Thread mdipierro

You may need this:
http://www.web2py.com/AlterEgo/default/show/219

You may also have problems with appliances that use 2.5 syntax but
nothing that you cannot find a way around to. The source of web2py is
2.4 compliant.

Massimo


On Oct 5, 4:39 pm, Chris S  wrote:
> Is there any information I should be aware of when trying to run
> web2py on Python 2.4?  I do agree I wouldn't choose this host, but
> this is a FREE opportunity for me to check out web2py on a friends
> paid for account.  I'm using this to compare/contrast a host with GAE
> before I start paying hosting fees myself so swapping isn't an option
> though I would look for a different host if I decide I prefer the non-
> google option.
>
> On Oct 5, 10:03 am, Álvaro Justen [Turicas] 
> wrote:
>
> > On Mon, Oct 5, 2009 at 10:15, Chris S  wrote:
>
> > > I heard back from tech support.  Python is 'supported' on midphase but
> > > they still have version 2.4 installed with no ETA on any upgrades.  I
> > > think that means I can't use them as a host am I correct?
>
> > Well, so your hosting company doesn't matter to have up-to-date
> > software? web2py runs on python 2.4 but I think the better option is
> > to change your hosting company since others provide a lot of features
> > (including updated versions of python) and don't cost so much. Search
> > in this list for hosting companies.
>
> > > When you say not to use a public folder, what would I need to do to
> > > avoid that.  If I put the web2py files in a non-public folder where do
> > > I put .htacecss and the WSGI or FastCGI handlers?  Do I just leave
> > > them in the current public folder and point them somehow to the non-
> > > public folder with the RewriteBase command in .htaccess?
>
> > Yes, I think it'll work.
>
> > > On Oct 4, 10:18 pm, Álvaro Justen [Turicas] 
> > > wrote:
> > >> On Fri, Oct 2, 2009 at 10:58, Chris S  wrote:
>
> > >> > Just wanted to update here for anyone else that tries to implement on
> > >> >Midphasehosting.
>
> > >> > 1 - The RewriteBase for me needed to be:
> > >> > RewriteBase /home//public_html/
>
> > >> You should not use a "public" (Web-acessible) directory to install
> > >> web2py. It is more safe to have web2py files in a non-public
> > >> directory.
> > >> Using WSGI is preferable than CGI/FastCGI.
>
> > >> > That changed from 'file not found' to 'bad request'
>
> > >> > 2 - I contacted customer support and it seems python isn't installed
> > >> > but it is supported.  I put in a ticket to have python installed on
> > >> > our host, and hopefully if the customer service rep was right I'll be
> > >> > updating you with more info once that's done.
>
> > >> > On Oct 1, 10:26 am, Chris S  wrote:
> > >> >> I've got a friend that's letting me try out web2py on his unlimited
> > >> >> host so I can compare to the GAE.  However, I'm just not clear on how
> > >> >> to get this setup.
>
> > >> >> He's usingmidphaseand I have cPanel and FTP access to the site.
> > >> >> I've uploaded the contents of my web2py folder into the Public_html/
> > >> >> myfolder.
>
> > >> >> Going towww.example.com/myfolder
> > >> >> shows an Index of all files in the folder.
>
> > >> >> I tried adding a .htaccess file with:
> > >> >> Options +ExecCGI
> > >> >> AddHandler fastcgi-script .fcgi
> > >> >> RewriteEngine On
> > >> >> RewriteBase /
> > >> >> RewriteRule ^dispatch\.fcgi/ - [L]
> > >> >> RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
>
> > >> >> With that I renamed the fastcgihandler.py to dispatch.fcgi.  I've
> > >> >> given 755 permisions to the dispatch.fcgi file as well as
> > >> >> fcgihandler.py.  I get an error message saying that dispatch.fcgi
> > >> >> can't be found.
>
> > >> >> Then I tried using:
> > >> >> SetHandler python-program
> > >> >> PythonHandler web2py_modpython
> > >> >> ##PythonDebug On
>
> > >> >> This time I set the web2py_modpython.py to 755 as well as
> > >> >> wsgihandler.py.  Now I get a 500 Internal Server error.
>
> > >> >>Midphasesupport says they support both FastCGI and WSGI.  Where do I
> > >> >> go from here?  What information do I need to ask for to get this
> > >> >> setup?  I had this same copy of web2py running via WSGI + Apache
> > >> >> following the instructions on in the book, but it's really lacking in
> > >> >> information if you can't setup the Apache config file and have to
> > >> >> use .htaccess with WSGI or FastCGI.
>
> > >> >> Thanks!
>
> > >> --
> > >>  Álvaro Justen
> > >>  Peta5 - Telecomunicações e Software Livre
> > >>  21 3021-6001 / 9898-0141
> > >>  http://www.peta5.com.br/
>
> > --
> >  Álvaro Justen
> >  Peta5 - Telecomunicações e Software Livre
> >  21 3021-6001 / 9898-0141
> >  http://www.peta5.com.br/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this g

[web2py:32254] Re: Midphase + web2py how do I set it up?

2009-10-05 Thread Chris S

Is there any information I should be aware of when trying to run
web2py on Python 2.4?  I do agree I wouldn't choose this host, but
this is a FREE opportunity for me to check out web2py on a friends
paid for account.  I'm using this to compare/contrast a host with GAE
before I start paying hosting fees myself so swapping isn't an option
though I would look for a different host if I decide I prefer the non-
google option.



On Oct 5, 10:03 am, Álvaro Justen [Turicas] 
wrote:
> On Mon, Oct 5, 2009 at 10:15, Chris S  wrote:
>
> > I heard back from tech support.  Python is 'supported' on midphase but
> > they still have version 2.4 installed with no ETA on any upgrades.  I
> > think that means I can't use them as a host am I correct?
>
> Well, so your hosting company doesn't matter to have up-to-date
> software? web2py runs on python 2.4 but I think the better option is
> to change your hosting company since others provide a lot of features
> (including updated versions of python) and don't cost so much. Search
> in this list for hosting companies.
>
> > When you say not to use a public folder, what would I need to do to
> > avoid that.  If I put the web2py files in a non-public folder where do
> > I put .htacecss and the WSGI or FastCGI handlers?  Do I just leave
> > them in the current public folder and point them somehow to the non-
> > public folder with the RewriteBase command in .htaccess?
>
> Yes, I think it'll work.
>
>
>
> > On Oct 4, 10:18 pm, Álvaro Justen [Turicas] 
> > wrote:
> >> On Fri, Oct 2, 2009 at 10:58, Chris S  wrote:
>
> >> > Just wanted to update here for anyone else that tries to implement on
> >> >Midphasehosting.
>
> >> > 1 - The RewriteBase for me needed to be:
> >> > RewriteBase /home//public_html/
>
> >> You should not use a "public" (Web-acessible) directory to install
> >> web2py. It is more safe to have web2py files in a non-public
> >> directory.
> >> Using WSGI is preferable than CGI/FastCGI.
>
> >> > That changed from 'file not found' to 'bad request'
>
> >> > 2 - I contacted customer support and it seems python isn't installed
> >> > but it is supported.  I put in a ticket to have python installed on
> >> > our host, and hopefully if the customer service rep was right I'll be
> >> > updating you with more info once that's done.
>
> >> > On Oct 1, 10:26 am, Chris S  wrote:
> >> >> I've got a friend that's letting me try out web2py on his unlimited
> >> >> host so I can compare to the GAE.  However, I'm just not clear on how
> >> >> to get this setup.
>
> >> >> He's usingmidphaseand I have cPanel and FTP access to the site.
> >> >> I've uploaded the contents of my web2py folder into the Public_html/
> >> >> myfolder.
>
> >> >> Going towww.example.com/myfolder
> >> >> shows an Index of all files in the folder.
>
> >> >> I tried adding a .htaccess file with:
> >> >> Options +ExecCGI
> >> >> AddHandler fastcgi-script .fcgi
> >> >> RewriteEngine On
> >> >> RewriteBase /
> >> >> RewriteRule ^dispatch\.fcgi/ - [L]
> >> >> RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
>
> >> >> With that I renamed the fastcgihandler.py to dispatch.fcgi.  I've
> >> >> given 755 permisions to the dispatch.fcgi file as well as
> >> >> fcgihandler.py.  I get an error message saying that dispatch.fcgi
> >> >> can't be found.
>
> >> >> Then I tried using:
> >> >> SetHandler python-program
> >> >> PythonHandler web2py_modpython
> >> >> ##PythonDebug On
>
> >> >> This time I set the web2py_modpython.py to 755 as well as
> >> >> wsgihandler.py.  Now I get a 500 Internal Server error.
>
> >> >>Midphasesupport says they support both FastCGI and WSGI.  Where do I
> >> >> go from here?  What information do I need to ask for to get this
> >> >> setup?  I had this same copy of web2py running via WSGI + Apache
> >> >> following the instructions on in the book, but it's really lacking in
> >> >> information if you can't setup the Apache config file and have to
> >> >> use .htaccess with WSGI or FastCGI.
>
> >> >> Thanks!
>
> >> --
> >>  Álvaro Justen
> >>  Peta5 - Telecomunicações e Software Livre
> >>  21 3021-6001 / 9898-0141
> >>  http://www.peta5.com.br/
>
> --
>  Álvaro Justen
>  Peta5 - Telecomunicações e Software Livre
>  21 3021-6001 / 9898-0141
>  http://www.peta5.com.br/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32253] Re: can't access 'id' field when running GAE dev_appserver

2009-10-05 Thread Robin B

GAE has added a feature so you can query by id or keyname (using
__key__), it is not implemented in DAL yet.

http://code.google.com/appengine/docs/python/datastore/queriesandindexes.html#Queries_on_Keys

Robin



On Oct 5, 8:07 am, mdipierro  wrote:
> GAE is very weird. It does allow queries that mix queries by ID and by
> other fields.
> You must first search by ID, then check that other condition is valid:
>
> query = (self.db.assessmentQuest.id == nQuestId)
> rows = self.db(query).select()
> if not rows or rows[0].candidate_id != userId:
>     do_something
>
> On Oct 5, 5:55 am, Carl  wrote:
>
> > this one has been floored
>
> > the following works correctly locally (sqlite) but trips over when
> > running on dev_appserver
>
> > query = (self.db.assessmentQuest.candidate_id == userId) &
> > (self.db.assessmentQuest.id == nQuestId)
> > rows = self.db(query).select(self.db.assessmentQuest.ALL)
>
> > It's the self.db.assessmentQuest.id that tripping execution with ***
> > Query' object has no attribute 'left' ***
> > If I remove this condition the code runs through fine and then trips
> > on the following with the same error...
>
> > if rows:
> >     return rows[0].id
>
> > and yet the following runs fine on dev_appserver:
> > if rows:
> >     id = rows[0].id
> >     return id
>
> > I'm totally foxed. Anyone an idea what's causing this behaviour?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32252] Re: drupal hooks

2009-10-05 Thread mdipierro

I am not suggesting we implement hooks.

I am pointing web2py users to a place where people have actually build
a plugins (modules) system that has been successful in practice.

The implementation is ugly and we should not copy that but it may give
us some ideas about what plugins should do or should not do.


On Oct 5, 1:58 pm, Alex Fanjul  wrote:
> I thought that "Hooks"  is the "mend/patch" for non objetc oriented
> languages/frameworks like Drupal, because Drupal started in php4 when
> php wasnt object oriented yet... (no inheritance, no interfaces, ...)
> By the way, What is the language paradigm of web2py? it is object
> oriented, isnt it?
>
> regards
> alex f
>
> El 05/10/2009 18:20, mdipierro escribió:
>
> > In the context of creating a plugin system this may be useful:
>
> >http://api.drupal.org/api/group/hooks/7
>
> --
> Alejandro Fanjul Fdez.
> alex.fan...@gmail.comwww.mhproject.org
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32251] Re: drupal hooks

2009-10-05 Thread Alex Fanjul

I thought that "Hooks"  is the "mend/patch" for non objetc oriented 
languages/frameworks like Drupal, because Drupal started in php4 when 
php wasnt object oriented yet... (no inheritance, no interfaces, ...)
By the way, What is the language paradigm of web2py? it is object 
oriented, isnt it?

regards
alex f

El 05/10/2009 18:20, mdipierro escribió:
> In the context of creating a plugin system this may be useful:
>
> http://api.drupal.org/api/group/hooks/7
> >
>
>

-- 
Alejandro Fanjul Fdez.
alex.fan...@gmail.com
www.mhproject.org

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32250] Re: newbie looking for style advice

2009-10-05 Thread devnull

Below is the difficulty I was having getting request.vars to the
target of the redirect. [add] redirects to [add_2], and when it does,
request.vars doesn't have .x and .y ... instead I find myself stuffing
x and y into the session explicitly and then pulling them out in
[add_2] also explicitly.

Is there something in the framework that handles this? (I feel like
I'm missing something only a newbie would miss).  :-)  maybe
[redirect] or [URL] takes another argument that I don't know about
yet... I hope I've freed you from the notion that I know what I'm
doing :-P

def add():
form=SQLFORM.factory(
Field('x','double',
  requires=IS_FLOAT_IN_RANGE(
  0,500,
  error_message='number between 0 and 500 required')),
Field('y','double',
  requires=IS_FLOAT_IN_RANGE(
  0,100,
  error_message='number between 0 and 100 required')))
if form.accepts(request.vars, session):
session.x = request.vars.x
session.y = request.vars.y
redirect(URL(r=request,f='add_2'))
return dict(form=form)

def add_2():
x=session.x
y=session.y
sum=float(x)+float(y)
return dict(x=x,y=y,sum=sum)

On Oct 5, 11:31 am, mdipierro  wrote:
> Thank you devnull,
>
> some answers below:
>
> On Oct 5, 10:14 am, devnull  wrote:
>
>
>
> > Hello all. Just discovered web2py and I think it's great. I wish we
> > were using it here at work, and so do some of my co-workers.
>
> > I have created a little form as an exercise for myself and I came up
> > with some questions.
>
> > It's likely that some of the things I'm wondering about are handled by
> > the framework and I just don't know it yet...
>
> > ... and the rest of the stuff is probably telltale stylistic noob-ness
> > that I hope you'll point out.
>
> > At the bottom is the controller and view for my form. There's no model
> > yet. The form just adds two values, x and y. Here are the questions.
>
> > 1. The basic structure of the form is defined in the controller part.
> > I did this so I could use the 'requires' argument to the INPUT method
> > to specify a validator. Is this ok? The reason I ask is it feels like
> > I'm putting view stuff in the controller when I say things like TABLE
> > and TR...
>
> You can do
> form=SQLFORM.factory(Field('x',double')),Field('y','double')))
>
> and in view
> {{=form.custom.begin}}
> {{=form.custom.widget.x}}
> {{=form.custom.widget.y}}
> {{=form.custom.submit}}
> {{=form.custom.end}}
> then insert the HTML you need in the view.
>
> > 2. I wanted a more specific error message for each field which uses an
> > is-float-in-range validator ... But is there a way to refer to the
> > actual max and min without repeating it in the string? Something like
> > $max and $min?
>
> No, there is not. We could add it. If we do it would be %{minimum}s %
> (maximum)s. Pros/Cons?
>
> > 3. At the end of the controller, am I making a mistake by passing x
> > and y explicitly? Are they also hiding inside form and can I extract x
> > and y from the form in the view html?
>
> You are not but form.vars.x is available inside the view since you are
> passing the form.
>
> > 4. Would it be a better practice to redirect the user to another page
> > for the result instead of doing everything on the same page? I tried
> > this but had some difficulty getting x and y in the second page for
> > processing (adding).
>
> I like to redirect on accept. In this case there is no different but
> you may have multiple objects in one page that depend on one another.
> Without an explicit redirection it ma be difficult to keep track of
> their state.
>
> > 5. Do you have any other advice?
>
> No. It seems to me you know aht you are doing.
>
>
>
> > Looking forward to learning from you all. Thanks in advance!
>
> > controller:
>
> > def form_example():
> >     form=FORM(TABLE(
> >         TR('x',
> >            INPUT(_type='text',_name='x',
> >                  requires=IS_FLOAT_IN_RANGE(
> >                      0,500,
> >                      error_message='number between 0 and 500
> > required'))),
> >         TR('y',
> >            INPUT(_type='text',_name='y',
> >                  requires=IS_FLOAT_IN_RANGE(
> >                      0,100,
> >                      error_message='number between 0 and 100
> > required'))),
> >         TR('',INPUT(_type='submit',
> >                     _value='add'
> >     sum = x = y = ''
> >     visibility = 'hidden'
> >     if form.accepts(request.vars, session):
> >         sum = float(request.vars.x) + float(request.vars.y)
> >         visibility = 'visible'
> >     return dict(form = form,
> >                 sum = sum,
> >                 x = request.vars.x,
> >                 y = request.vars.y,
> >                 visibility = visibility)
>
> > view:
>
> > form example
> > {{=form}}
> > 
> > 
> > Most recent x entered
> > {{=x}}
> > 
> > 
> > Most recent y entered
> > {{=y}}
> > 
> > 
> > sum
> > {{=su

[web2py:32249] Re: web2py + pyjamas desktop = a desktop framework?

2009-10-05 Thread don

What I would like is to not 'see the man behind the curtain',
that is the server.

I know that he is going to be there, somewhere, but I don't
want the user to be aware of the server's existence - and that
includes using a Windows service.  Ideally, I would like the
application to be a 'portable application'.

I wonder if the server could be 'glued' on to the back of the
application/browser?  Assuming something like pyjamas desktop,
webkit + pyqt or Prism then could a web-like desktop app be
created as a single executable?

This maybe what Richard did when he 'embedded web2py in a
desktop app'?


Don.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32248] Re: Database Synchronization and UUID's

2009-10-05 Thread mdipierro

There must be a bug. Will double check tonight.

On Oct 5, 12:38 pm, CJSteel  wrote:
> Database Synchronization and UUID's
>
> I am wondering if I need to do searches by uuid's in a different way.
> I have been experimenting with them and frequently run into the error -> 
> KeyError: 'uuid' when attempting to do queries or when trying to
>
> pass them as variables from controllers to views and vice-versa.
>
> At the moment I am working with the example in the book (171-173) and
> seem to be getting the same error again with the book example in
> addition to one other error:
>
> TypeError: import_from_csv_file() got an unexpected keyword
> argument 'unique'
>
> OR
>
> KeyError: 'uuid'
>
> I can eliminate the first error by changing the following line in the
> import function:
>
> db.import_from_csv_file(form.vars.data.file,unique=False)
>
> to be
>
> db.import_from_csv_file(form.vars.data.file) #removed unique=False
>
> but then the now dreaded KeyError: 'uuid' shows up again. Here are
> some links to my current db.py and default.py which are basically from
> the book, although I needed to import some additional modules to get
> it working and needed to change "now" to be "request.now" :
>
> db.py
>view  http://vishpala.com/resources/web2py/db.py/view
>download  http://vishpala.com/resources/web2py/db.py/at_download/file
>
> default.py
> viewhttp://vishpala.com/resources/web2py/default.py/view
> downloadhttp://vishpala.com/resources/web2py/default.py/at_download/file
>
> This line in the book intrigued me but I was not sure about how to go
> about creating an index manually to make searching by uuid's go
> faster, especially since I seem to be unable to search by uuid's at
> all. I have a feeling it is a formatting issue (standard index int vs
> the uuid format which includes dashes.
>
> "Create an index manually to make the search by uuid faster."
>
> I would appreciate any assistance and or suggestions, especially in
> regards to a functioning query search by uuid and getting the import
> function working.
>
> Web2py rocks!
>
> Cheers,
>
> Christopher Steel
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32247] Database Synchronization and UUID's

2009-10-05 Thread CJSteel

Database Synchronization and UUID's

I am wondering if I need to do searches by uuid's in a different way.
I have been experimenting with them and frequently run into the error -
> KeyError: 'uuid' when attempting to do queries or when trying to
pass them as variables from controllers to views and vice-versa.

At the moment I am working with the example in the book (171-173) and
seem to be getting the same error again with the book example in
addition to one other error:

TypeError: import_from_csv_file() got an unexpected keyword
argument 'unique'

OR

KeyError: 'uuid'

I can eliminate the first error by changing the following line in the
import function:

db.import_from_csv_file(form.vars.data.file,unique=False)

to be

db.import_from_csv_file(form.vars.data.file) #removed unique=False

but then the now dreaded KeyError: 'uuid' shows up again. Here are
some links to my current db.py and default.py which are basically from
the book, although I needed to import some additional modules to get
it working and needed to change "now" to be "request.now" :

db.py
   view   http://vishpala.com/resources/web2py/db.py/view
   download   http://vishpala.com/resources/web2py/db.py/at_download/file

default.py
view http://vishpala.com/resources/web2py/default.py/view
download http://vishpala.com/resources/web2py/default.py/at_download/file

This line in the book intrigued me but I was not sure about how to go
about creating an index manually to make searching by uuid's go
faster, especially since I seem to be unable to search by uuid's at
all. I have a feeling it is a formatting issue (standard index int vs
the uuid format which includes dashes.

"Create an index manually to make the search by uuid faster."

I would appreciate any assistance and or suggestions, especially in
regards to a functioning query search by uuid and getting the import
function working.

Web2py rocks!

Cheers,

Christopher Steel



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32246] Re: can't access 'id' field when running GAE dev_appserver

2009-10-05 Thread Carl

thanks M

I've changed the 3 places where I'd used combined fields with an id
search and all is humming on dev_appserver.
cheers

On Oct 5, 2:07 pm, mdipierro  wrote:
> GAE is very weird. It does allow queries that mix queries by ID and by
> other fields.
> You must first search by ID, then check that other condition is valid:
>
> query = (self.db.assessmentQuest.id == nQuestId)
> rows = self.db(query).select()
> if not rows or rows[0].candidate_id != userId:
>     do_something
>
> On Oct 5, 5:55 am, Carl  wrote:
>
>
>
> > this one has been floored
>
> > the following works correctly locally (sqlite) but trips over when
> > running on dev_appserver
>
> > query = (self.db.assessmentQuest.candidate_id == userId) &
> > (self.db.assessmentQuest.id == nQuestId)
> > rows = self.db(query).select(self.db.assessmentQuest.ALL)
>
> > It's the self.db.assessmentQuest.id that tripping execution with ***
> > Query' object has no attribute 'left' ***
> > If I remove this condition the code runs through fine and then trips
> > on the following with the same error...
>
> > if rows:
> >     return rows[0].id
>
> > and yet the following runs fine on dev_appserver:
> > if rows:
> >     id = rows[0].id
> >     return id
>
> > I'm totally foxed. Anyone an idea what's causing this behaviour?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32245] drupal hooks

2009-10-05 Thread mdipierro

In the context of creating a plugin system this may be useful:

http://api.drupal.org/api/group/hooks/7
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32244] Re: newbie looking for style advice

2009-10-05 Thread mdipierro

Thank you devnull,

some answers below:

On Oct 5, 10:14 am, devnull  wrote:
> Hello all. Just discovered web2py and I think it's great. I wish we
> were using it here at work, and so do some of my co-workers.
>
> I have created a little form as an exercise for myself and I came up
> with some questions.
>
> It's likely that some of the things I'm wondering about are handled by
> the framework and I just don't know it yet...
>
> ... and the rest of the stuff is probably telltale stylistic noob-ness
> that I hope you'll point out.
>
> At the bottom is the controller and view for my form. There's no model
> yet. The form just adds two values, x and y. Here are the questions.
>
> 1. The basic structure of the form is defined in the controller part.
> I did this so I could use the 'requires' argument to the INPUT method
> to specify a validator. Is this ok? The reason I ask is it feels like
> I'm putting view stuff in the controller when I say things like TABLE
> and TR...


You can do
form=SQLFORM.factory(Field('x',double')),Field('y','double')))

and in view
{{=form.custom.begin}}
{{=form.custom.widget.x}}
{{=form.custom.widget.y}}
{{=form.custom.submit}}
{{=form.custom.end}}
then insert the HTML you need in the view.

> 2. I wanted a more specific error message for each field which uses an
> is-float-in-range validator ... But is there a way to refer to the
> actual max and min without repeating it in the string? Something like
> $max and $min?

No, there is not. We could add it. If we do it would be %{minimum}s %
(maximum)s. Pros/Cons?

> 3. At the end of the controller, am I making a mistake by passing x
> and y explicitly? Are they also hiding inside form and can I extract x
> and y from the form in the view html?

You are not but form.vars.x is available inside the view since you are
passing the form.

> 4. Would it be a better practice to redirect the user to another page
> for the result instead of doing everything on the same page? I tried
> this but had some difficulty getting x and y in the second page for
> processing (adding).

I like to redirect on accept. In this case there is no different but
you may have multiple objects in one page that depend on one another.
Without an explicit redirection it ma be difficult to keep track of
their state.

> 5. Do you have any other advice?

No. It seems to me you know aht you are doing.

>
> Looking forward to learning from you all. Thanks in advance!
>
> controller:
>
> def form_example():
> form=FORM(TABLE(
> TR('x',
>INPUT(_type='text',_name='x',
>  requires=IS_FLOAT_IN_RANGE(
>  0,500,
>  error_message='number between 0 and 500
> required'))),
> TR('y',
>INPUT(_type='text',_name='y',
>  requires=IS_FLOAT_IN_RANGE(
>  0,100,
>  error_message='number between 0 and 100
> required'))),
> TR('',INPUT(_type='submit',
> _value='add'
> sum = x = y = ''
> visibility = 'hidden'
> if form.accepts(request.vars, session):
> sum = float(request.vars.x) + float(request.vars.y)
> visibility = 'visible'
> return dict(form = form,
> sum = sum,
> x = request.vars.x,
> y = request.vars.y,
> visibility = visibility)
>
> view:
>
> form example
> {{=form}}
> 
> 
> Most recent x entered
> {{=x}}
> 
> 
> Most recent y entered
> {{=y}}
> 
> 
> sum
> {{=sum}}
> 
> 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32243] newbie looking for style advice

2009-10-05 Thread devnull

Hello all. Just discovered web2py and I think it's great. I wish we
were using it here at work, and so do some of my co-workers.

I have created a little form as an exercise for myself and I came up
with some questions.

It's likely that some of the things I'm wondering about are handled by
the framework and I just don't know it yet...

... and the rest of the stuff is probably telltale stylistic noob-ness
that I hope you'll point out.

At the bottom is the controller and view for my form. There's no model
yet. The form just adds two values, x and y. Here are the questions.

1. The basic structure of the form is defined in the controller part.
I did this so I could use the 'requires' argument to the INPUT method
to specify a validator. Is this ok? The reason I ask is it feels like
I'm putting view stuff in the controller when I say things like TABLE
and TR...

2. I wanted a more specific error message for each field which uses an
is-float-in-range validator ... But is there a way to refer to the
actual max and min without repeating it in the string? Something like
$max and $min?

3. At the end of the controller, am I making a mistake by passing x
and y explicitly? Are they also hiding inside form and can I extract x
and y from the form in the view html?

4. Would it be a better practice to redirect the user to another page
for the result instead of doing everything on the same page? I tried
this but had some difficulty getting x and y in the second page for
processing (adding).

5. Do you have any other advice?

Looking forward to learning from you all. Thanks in advance!

controller:

def form_example():
form=FORM(TABLE(
TR('x',
   INPUT(_type='text',_name='x',
 requires=IS_FLOAT_IN_RANGE(
 0,500,
 error_message='number between 0 and 500
required'))),
TR('y',
   INPUT(_type='text',_name='y',
 requires=IS_FLOAT_IN_RANGE(
 0,100,
 error_message='number between 0 and 100
required'))),
TR('',INPUT(_type='submit',
_value='add'
sum = x = y = ''
visibility = 'hidden'
if form.accepts(request.vars, session):
sum = float(request.vars.x) + float(request.vars.y)
visibility = 'visible'
return dict(form = form,
sum = sum,
x = request.vars.x,
y = request.vars.y,
visibility = visibility)

view:

form example
{{=form}}


Most recent x entered
{{=x}}


Most recent y entered
{{=y}}


sum
{{=sum}}



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32242] Re: Midphase + web2py how do I set it up?

2009-10-05 Thread Álvaro Justen [Turicas]

On Mon, Oct 5, 2009 at 10:15, Chris S  wrote:
>
> I heard back from tech support.  Python is 'supported' on midphase but
> they still have version 2.4 installed with no ETA on any upgrades.  I
> think that means I can't use them as a host am I correct?

Well, so your hosting company doesn't matter to have up-to-date
software? web2py runs on python 2.4 but I think the better option is
to change your hosting company since others provide a lot of features
(including updated versions of python) and don't cost so much. Search
in this list for hosting companies.

> When you say not to use a public folder, what would I need to do to
> avoid that.  If I put the web2py files in a non-public folder where do
> I put .htacecss and the WSGI or FastCGI handlers?  Do I just leave
> them in the current public folder and point them somehow to the non-
> public folder with the RewriteBase command in .htaccess?

Yes, I think it'll work.

> On Oct 4, 10:18 pm, Álvaro Justen [Turicas] 
> wrote:
>> On Fri, Oct 2, 2009 at 10:58, Chris S  wrote:
>>
>> > Just wanted to update here for anyone else that tries to implement on
>> >Midphasehosting.
>>
>> > 1 - The RewriteBase for me needed to be:
>> > RewriteBase /home//public_html/
>>
>> You should not use a "public" (Web-acessible) directory to install
>> web2py. It is more safe to have web2py files in a non-public
>> directory.
>> Using WSGI is preferable than CGI/FastCGI.
>>
>>
>>
>> > That changed from 'file not found' to 'bad request'
>>
>> > 2 - I contacted customer support and it seems python isn't installed
>> > but it is supported.  I put in a ticket to have python installed on
>> > our host, and hopefully if the customer service rep was right I'll be
>> > updating you with more info once that's done.
>>
>> > On Oct 1, 10:26 am, Chris S  wrote:
>> >> I've got a friend that's letting me try out web2py on his unlimited
>> >> host so I can compare to the GAE.  However, I'm just not clear on how
>> >> to get this setup.
>>
>> >> He's usingmidphaseand I have cPanel and FTP access to the site.
>> >> I've uploaded the contents of my web2py folder into the Public_html/
>> >> myfolder.
>>
>> >> Going towww.example.com/myfolder
>> >> shows an Index of all files in the folder.
>>
>> >> I tried adding a .htaccess file with:
>> >> Options +ExecCGI
>> >> AddHandler fastcgi-script .fcgi
>> >> RewriteEngine On
>> >> RewriteBase /
>> >> RewriteRule ^dispatch\.fcgi/ - [L]
>> >> RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
>>
>> >> With that I renamed the fastcgihandler.py to dispatch.fcgi.  I've
>> >> given 755 permisions to the dispatch.fcgi file as well as
>> >> fcgihandler.py.  I get an error message saying that dispatch.fcgi
>> >> can't be found.
>>
>> >> Then I tried using:
>> >> SetHandler python-program
>> >> PythonHandler web2py_modpython
>> >> ##PythonDebug On
>>
>> >> This time I set the web2py_modpython.py to 755 as well as
>> >> wsgihandler.py.  Now I get a 500 Internal Server error.
>>
>> >>Midphasesupport says they support both FastCGI and WSGI.  Where do I
>> >> go from here?  What information do I need to ask for to get this
>> >> setup?  I had this same copy of web2py running via WSGI + Apache
>> >> following the instructions on in the book, but it's really lacking in
>> >> information if you can't setup the Apache config file and have to
>> >> use .htaccess with WSGI or FastCGI.
>>
>> >> Thanks!
>>
>> --
>>  Álvaro Justen
>>  Peta5 - Telecomunicações e Software Livre
>>  21 3021-6001 / 9898-0141
>>  http://www.peta5.com.br/

-- 
 Álvaro Justen
 Peta5 - Telecomunicações e Software Livre
 21 3021-6001 / 9898-0141
 http://www.peta5.com.br/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32241] Re: anti spam, anti porn strategy?

2009-10-05 Thread Álvaro Justen [Turicas]

On Mon, Oct 5, 2009 at 11:27, Web2py-SuperFan  wrote:
>
> Hi all,
>
> I'm implementing a comments and wiki feature on my web2py app.  Is
> there any best practices or strategies you've used or would recommend
> on preventing spam or porn posts onto the site.  I'm looking for some
> automated prevention as I'm afraid the amount of posts will be way too
> much for human monitoring.  Its a social site.
>
> Thanks for all your pointers.

If you don't have a high traffic in your site (so people won't create
specialized bots for your site) you can create your form with plus X
random fields (all these with random names, in blank, and hidden via
CSS/JavaScript). In form validation if some 'user' fill these hidden
fields you will know that this 'user' is really a bot, so you can
ignore this comment (and even block IP address etc.).

-- 
 Álvaro Justen
 Peta5 - Telecomunicações e Software Livre
 21 3021-6001 / 9898-0141
 http://www.peta5.com.br/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32240] Re: anti spam, anti porn strategy?

2009-10-05 Thread david bain

implementing a captcha or recaptcha based system should help.

On Mon, Oct 5, 2009 at 9:27 AM, Web2py-SuperFan  wrote:
>
> Hi all,
>
> I'm implementing a comments and wiki feature on my web2py app.  Is
> there any best practices or strategies you've used or would recommend
> on preventing spam or porn posts onto the site.  I'm looking for some
> automated prevention as I'm afraid the amount of posts will be way too
> much for human monitoring.  Its a social site.
>
> Thanks for all your pointers.
>
> Mark
> >
>



-- 
SplashStart - Professional Websites. Starting Now.
http://www.splashstart.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32239] anti spam, anti porn strategy?

2009-10-05 Thread Web2py-SuperFan

Hi all,

I'm implementing a comments and wiki feature on my web2py app.  Is
there any best practices or strategies you've used or would recommend
on preventing spam or porn posts onto the site.  I'm looking for some
automated prevention as I'm afraid the amount of posts will be way too
much for human monitoring.  Its a social site.

Thanks for all your pointers.

Mark
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32238] Unit Testing Controllers with auth.requires_login

2009-10-05 Thread Dmitri Zagidulin

The article on Unit Test Controllers using unittest
(http://www.web2py.com/AlterEgo/default/show/213 )
 gives some examples on how to unit-test web2py controllers.

However, how do I test controller functions that are decorated with
auth.requires_login()? When I tried running a test similar to that of
the article, I got a:
NameError: name 'auth' is not defined

Ok, makes sense (although I was surprised that the model, in which
auth
is defined, is not auto-loaded).
I tried putting a
self.model = exec_environment('applications/myapp/models/db.py')
line before the
self.controller =
exec_environment('applications/myapp/controllers/default.py',
request=self.request)
but got an error:
SyntaxError: not enough information to build the url

So, what's the right way to test auth-protected controller functions?
Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32237] Re: Midphase + web2py how do I set it up?

2009-10-05 Thread Chris S

I heard back from tech support.  Python is 'supported' on midphase but
they still have version 2.4 installed with no ETA on any upgrades.  I
think that means I can't use them as a host am I correct?

When you say not to use a public folder, what would I need to do to
avoid that.  If I put the web2py files in a non-public folder where do
I put .htacecss and the WSGI or FastCGI handlers?  Do I just leave
them in the current public folder and point them somehow to the non-
public folder with the RewriteBase command in .htaccess?

On Oct 4, 10:18 pm, Álvaro Justen [Turicas] 
wrote:
> On Fri, Oct 2, 2009 at 10:58, Chris S  wrote:
>
> > Just wanted to update here for anyone else that tries to implement on
> >Midphasehosting.
>
> > 1 - The RewriteBase for me needed to be:
> > RewriteBase /home//public_html/
>
> You should not use a "public" (Web-acessible) directory to install
> web2py. It is more safe to have web2py files in a non-public
> directory.
> Using WSGI is preferable than CGI/FastCGI.
>
>
>
> > That changed from 'file not found' to 'bad request'
>
> > 2 - I contacted customer support and it seems python isn't installed
> > but it is supported.  I put in a ticket to have python installed on
> > our host, and hopefully if the customer service rep was right I'll be
> > updating you with more info once that's done.
>
> > On Oct 1, 10:26 am, Chris S  wrote:
> >> I've got a friend that's letting me try out web2py on his unlimited
> >> host so I can compare to the GAE.  However, I'm just not clear on how
> >> to get this setup.
>
> >> He's usingmidphaseand I have cPanel and FTP access to the site.
> >> I've uploaded the contents of my web2py folder into the Public_html/
> >> myfolder.
>
> >> Going towww.example.com/myfolder
> >> shows an Index of all files in the folder.
>
> >> I tried adding a .htaccess file with:
> >> Options +ExecCGI
> >> AddHandler fastcgi-script .fcgi
> >> RewriteEngine On
> >> RewriteBase /
> >> RewriteRule ^dispatch\.fcgi/ - [L]
> >> RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
>
> >> With that I renamed the fastcgihandler.py to dispatch.fcgi.  I've
> >> given 755 permisions to the dispatch.fcgi file as well as
> >> fcgihandler.py.  I get an error message saying that dispatch.fcgi
> >> can't be found.
>
> >> Then I tried using:
> >> SetHandler python-program
> >> PythonHandler web2py_modpython
> >> ##PythonDebug On
>
> >> This time I set the web2py_modpython.py to 755 as well as
> >> wsgihandler.py.  Now I get a 500 Internal Server error.
>
> >>Midphasesupport says they support both FastCGI and WSGI.  Where do I
> >> go from here?  What information do I need to ask for to get this
> >> setup?  I had this same copy of web2py running via WSGI + Apache
> >> following the instructions on in the book, but it's really lacking in
> >> information if you can't setup the Apache config file and have to
> >> use .htaccess with WSGI or FastCGI.
>
> >> Thanks!
>
> --
>  Álvaro Justen
>  Peta5 - Telecomunicações e Software Livre
>  21 3021-6001 / 9898-0141
>  http://www.peta5.com.br/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32236] Re: can't access 'id' field when running GAE dev_appserver

2009-10-05 Thread mdipierro

GAE is very weird. It does allow queries that mix queries by ID and by
other fields.
You must first search by ID, then check that other condition is valid:

query = (self.db.assessmentQuest.id == nQuestId)
rows = self.db(query).select()
if not rows or rows[0].candidate_id != userId:
do_something



On Oct 5, 5:55 am, Carl  wrote:
> this one has been floored
>
> the following works correctly locally (sqlite) but trips over when
> running on dev_appserver
>
> query = (self.db.assessmentQuest.candidate_id == userId) &
> (self.db.assessmentQuest.id == nQuestId)
> rows = self.db(query).select(self.db.assessmentQuest.ALL)
>
> It's the self.db.assessmentQuest.id that tripping execution with ***
> Query' object has no attribute 'left' ***
> If I remove this condition the code runs through fine and then trips
> on the following with the same error...
>
> if rows:
>     return rows[0].id
>
> and yet the following runs fine on dev_appserver:
> if rows:
>     id = rows[0].id
>     return id
>
> I'm totally foxed. Anyone an idea what's causing this behaviour?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32235] Adding a user name to user registration

2009-10-05 Thread Joseph Jude

Hi,
I want to customize the auth functionality to add a user id(or name).
This is what I've done so far.
DB:

from gluon.tools import Auth
auth=Auth(globals(),db)
auth.settings.table_user=db.define_table(
auth.settings.table_user_name,
Field('user_name',length=128,default='',requires=[IS_NOT_IN_DB
(db,'%s.user_name'%auth.settings.table_user_name)]),
Field('first_name', length=128, default=''),
Field('last_name',length=128, default=''),
Field('email',length=128,default='',requires=[IS_EMAIL(), IS_NOT_IN_DB
(db,'%s.email'%auth.settings.table_user_name)]),
Field('password', 'password', readable=False, label='Password',
requires=CRYPT()),
Field('registration_key', length=128, writable=False,
readable=False,default=''))
##create all necessary tables
auth.define_tables()

CONTROLLER:

def register():
return dict(form=auth.register(next='index'))

def login():
return dict(form=auth.login(next='index'))

VIEWS:
register.html

{{extend 'layout.html'}}



User Name:



Password:



Verify Password:






{{=form.hidden_fields()}}


login.html

{{extend 'layout.html'}}



User Name:



Password:






{{=form.hidden_fields()}}


Here are the issues that I'm facing:
1) error messages for uniqueness of user name & email are not shown to
front end; is there any other js that I need to include?
2) in login, the password is sent in plain text. how to rectify
3) should the users so registered be inserted into any groups (as part
of auth framework)? If so, do I do this in the register controller
function?

Thank you,
Joseph
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32234] Re: "Add" button next to "combo box"

2009-10-05 Thread Renato-ES-Brazil

Cool!

Before I try to do something I really wanted to know if there was
something done by passing a parameter.

Thanks a lot guys!

On Oct 5, 1:08 am, mdipierro  wrote:
> It would be nice to a widget that does this.
>
> On Oct 4, 10:14 pm, Álvaro Justen [Turicas] 
> wrote:
>
> > On Sat, Oct 3, 2009 at 02:52, Iceberg  wrote:
>
> > > On Oct3, 8:41am, Renato-ES-Brazil  wrote:
> > >> Hi guys!
>
> > >> When the form displays the select with several options from the other
> > >> table, using the "is_in_db" configuration, couldn't also to put a
> > >> button, for example "ADD NOW", next to it to allows add a new option?
>
> > >> Currently is there this possibility for the CRUD (create and update
> > >> forms)?
>
> > > I've been in same situation as you mentioned. Here is my journey.
>
> > > Adding a "Add Now" button is easy. You can either customize the form,
> > > or customize the widget, or just use some jquery effect in a way like
> > > this:
>
> > >  def youraction():
> > >    form=crud.create(...)
> > >    ...
> > >    return dict(form=DIV(
> > >      form,
> > >      SCRIPT('''$(document).ready(function() {
> > >      $("#your_widgit_id").after(
> > >        "Add Now > > a>");
> > >      });'''),
> > >      ))
>
> > > However, I found that after successfully adding a new entry into db,
> > > there is no obvious way to refresh the is_in_db field itself,
> > > providing that I don't want to HARDCODE one more dedicated ajax action
> > > in my already-too-complex controller.
>
> > > So, my user still have to refresh the whole original page to see the
> > > change after "add now", with a price of losing all his previous input.
> > > Lucky enough that I could arrange the is_in_db field at the first line
> > > of my form, so the waste of input is minimum. In this case, the
> > > benefit of "Add Now" button is not as big as we thought.
>
> > > If anybody knows a better solution, please give me some tips. Thanks!
>
> > You could open a popup with a SQLFORM to create a new register in
> > other table, with a JavaScript/AJAX to update dropdown's options (and
> > select option that was created), like Djando admin do.
> > You could also use a "overlay" to show the form instead of the popup.
> > See:http://alvarojunior.com/jquery/joverlay/0.7.1/
>
> > --
> >  Álvaro Justen
> >  Peta5 - Telecomunicações e Software Livre
> >  21 3021-6001 / 9898-0141
> >  http://www.peta5.com.br/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32233] can't access 'id' field when running GAE dev_appserver

2009-10-05 Thread Carl

this one has been floored

the following works correctly locally (sqlite) but trips over when
running on dev_appserver

query = (self.db.assessmentQuest.candidate_id == userId) &
(self.db.assessmentQuest.id == nQuestId)
rows = self.db(query).select(self.db.assessmentQuest.ALL)

It's the self.db.assessmentQuest.id that tripping execution with ***
Query' object has no attribute 'left' ***
If I remove this condition the code runs through fine and then trips
on the following with the same error...

if rows:
return rows[0].id

and yet the following runs fine on dev_appserver:
if rows:
id = rows[0].id
return id

I'm totally foxed. Anyone an idea what's causing this behaviour?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32232] Re: column ... is not unique

2009-10-05 Thread Carl

Is this happening in your local development environment is it using
sqlite?
If so, the only solution I found was to delete the local database and
start over.


On Oct 5, 9:23 am, mika  wrote:
> hi!
>
> The problem is that traceback shows that column in my db is not
> unique. In code, there was 'unique=True',
> but I changed it. The problem still occurs. What should I do?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32231] Re: Can Web2py use a SQLite database on another machine on the LAN?

2009-10-05 Thread BluePoint

Thanks everyone for wise advice. In my particular case, there is
normally only
one user, just occasionally two, on different machines, but the
applications must
run on either of two machines using the same database.

I will bear in mind your advice about serving applications over the
network and using
a database with a server but, just for the record, I have successfully
run the Pyjamas Example with
the SQLite database on a remote machine connected via a VPN. Since I
am currently on Windows XP  the
connection statement looked like this:
db = DAL(r'sqlite://\\remotemachinename\SharedDocs\storage.sqlite')
(using a raw string to avoid having to double up the \ characters)
So it can be done.

Thanks again everyone.
Phil

On Oct 5, 2:45 am, Álvaro Justen [Turicas] 
wrote:
> On Sun, Oct 4, 2009 at 08:18, BluePoint  wrote:
>
> > Yes, thanks, I understand that - my current apps look for the database
> > in a shared folder
> > on another machine. However, I was wondering how one would tell web2py
> > to do that.
> > Normally one specifies the database in models/db.py by a line like:
> >    db = DAL('sqlite://storage.sqlite')
> > and the database automatically goes in the databases sub-directory.
> > How would one modify that code to use a path something like:
> >    '//othermachine/databases/storage.sqlite' ?
>
> If you want to create more apps using this database and in a near
> future you are thinking in having more users/concurrent requests, I
> think you could migrate your system to web2py using SQLite now
> (exported via NFS or Samba, for example) and migrate your database to
> a better system (like MySQL, PostgreSQL etc.) - it'll be easy to
> change database in web2py (just change DAL string) and web2py could
> help you migrate data from SQLite to MySQL/PostgreSQL/whatever
> database system.
>
> > On Oct 3, 5:25 pm, mdipierro  wrote:
> >> sqlite is not a client server database so the only option is for you
> >> to share the folder (smb or nfs).
>
> >> On Oct 3, 10:49 am, BluePoint  wrote:
>
> >> > I currently have a suite of 3 applications (not using Web2py) which
> >> > run on different machines on a LAN and all access a single SQLite
> >> > database on one of those machines. I am considering porting the
> >> > applications to Web2py but I wonder if it will be possible to share
> >> > the database in this way.
>
> --
>  Álvaro Justen
>  Peta5 - Telecomunicações e Software Livre
>  21 3021-6001 / 9898-0141
>  http://www.peta5.com.br/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32230] Re: form[0][0][0].insert()

2009-10-05 Thread annet

Hi Denes,

Thanks for the extensive answer to my question. Both the digression
and sample code were very helpful.

Kind regards,

Annet.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32229] column ... is not unique

2009-10-05 Thread mika

hi!

The problem is that traceback shows that column in my db is not
unique. In code, there was 'unique=True',
but I changed it. The problem still occurs. What should I do?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---