[web2py] Re: Get the ID of the just inserted row

2011-12-23 Thread lyn2py
Use form.vars.id to get the id of the new record inserted

More about it here:
http://web2py.com/books/default/chapter/29/7#SQLFORM
(search form.vars.id to get to the paragraph concerned)

On Dec 23, 3:01 pm, Thomas Dall'Agnese 
wrote:
> Hi,
>
> Let say I have 2 tables:
>
> db.define_table('post', Field('content'))
> db.define_table('comment', Field('content'), Field('post', 'reference post))
>
> When I add a "post" (through a FORM), I would like to automatically add 3
> comments that refer to that post.
> How can I retrieve the ID of the just inserted post and add the
> comments referring to it?
>
> Currently, I handle to form to add a post like this:
> def add_post():
>    form = SQLFORM(db.post)
>    if form.validate():
>        try:
>            comments = generateAutoComments()
>        except Exception, e:
>            response.flash = "Errors generating comments (%s)" % e.message
>        else:
>            if form.process().accepted:
>                # I guess here I would like to add all the comments to that
> just added post?
>                response.flash = 'Post added!'
>    return locals()


Re: [web2py] Re: Get the ID of the just inserted row

2011-12-23 Thread Thomas Dall'Agnese
Thanks for your prompt response.

Best Regards,

Thomas

Sent from Android
On Dec 23, 2011 5:02 PM, "lyn2py"  wrote:

> Use form.vars.id to get the id of the new record inserted
>
> More about it here:
> http://web2py.com/books/default/chapter/29/7#SQLFORM
> (search form.vars.id to get to the paragraph concerned)
>
> On Dec 23, 3:01 pm, Thomas Dall'Agnese 
> wrote:
> > Hi,
> >
> > Let say I have 2 tables:
> >
> > db.define_table('post', Field('content'))
> > db.define_table('comment', Field('content'), Field('post', 'reference
> post))
> >
> > When I add a "post" (through a FORM), I would like to automatically add 3
> > comments that refer to that post.
> > How can I retrieve the ID of the just inserted post and add the
> > comments referring to it?
> >
> > Currently, I handle to form to add a post like this:
> > def add_post():
> >form = SQLFORM(db.post)
> >if form.validate():
> >try:
> >comments = generateAutoComments()
> >except Exception, e:
> >response.flash = "Errors generating comments (%s)" % e.message
> >else:
> >if form.process().accepted:
> ># I guess here I would like to add all the comments to
> that
> > just added post?
> >response.flash = 'Post added!'
> >return locals()


[web2py] Re: Development of the Framework

2011-12-23 Thread Simon Lukell
I also did Python first, web second and was fortunate enough to have
the time to compare pretty much every single framework out there.  The
main reasons web2py is my preferred framework:

- it is lean and easy to understand 'all the way down'
- this means you are not forced into doing anything the $FRAMEWORK way
- it can run anywhere (even embedded and against almost any database
engine. I'm running all our apps in dev on my phone)
- it is extremely productive to develop with
- the documentation and community support is outstanding (and as I
said, if needed, just read the source in gluon -it is awesome)

In short, we achieve the best mix of freedom (implementation and
deployment), productivity and support, which makes most tech sense to
me and business sense to our agency.

With a Python programming background, I agree that the criticisms
against web2py indeed lack merit when actually having a deeper look.
In fact, the way web2py works at its core makes a lot of sense to me
in a web context.


Re: [web2py] Re: ssl certificate?

2011-12-23 Thread nils
Hi, Ive used go daddy,  works perfect for me and they are cheap
Regards,
Nils
On Dec 23, 2011 4:49 a.m., "guruyaya"  wrote:

> I've used it myself, but note this certificate is not insured in any
> way, and it allows a pretty weak protection, in the free edition. It
> also fails to work with wget (you can add some extra params to make it
> work with wget, but most people don't want this hussle).
> The quiestion is, what is this certificate for? The free edition was
> good eanogth to prevent errors, when being transfered to google, when
> I wanted to retrieve contacts for google. I guess it's good for the
> admin, or to allow secured logins. But I wouldn't use to for web
> services (as I cannot trust it to work with command line clients), and
> avoid it for web payments (it's not insured at all).
> I have no idea if the none free edition of startssl.
>
> On Dec 22, 6:04 pm, Angelo Compagnucci 
> wrote:
> > This on is free and it works well
> >
> > http://www.startssl.com/?app=1
> >
> > They make simple validation, the certificate is ready in minutes and the
> > certificate is a fully featured one!
> >
> > I use it!
> >
> > 2011/12/22 Massimo Di Pierro 
> >
> > > Any advice on where to buy a chap ssl certificate?
> >
> > > Please advice ONLY about services you have personally used already.
> >
> > > Massimo
> >
> > --
> > Profile:http://www.gild.com/compagnucciangelo
> > Register on Gild:http://www.gild.com/referral/compagnucciangelo


Re: [web2py] web2py sitting behind load balancer showing lb IP not client IP

2011-12-23 Thread nils
Hi, what load balancer are you using?
Regards,
Nils
On Dec 23, 2011 5:17 a.m., "Dave"  wrote:

> Since I've moved my installation behind a load balancer all my session
> IP addresses show as the back-side IP of the load balancer, not the
> real client IP.
>
> Have any of you figured out a way to pull the {X-Forwarded-For} entry
> from the HTTP environment for the "remote_addr" instead?


[web2py] format parameter not working?

2011-12-23 Thread Thomas Dall'Agnese
Hi,

I set the format of a table to a given field, and reference it in another table.
Unfortunately, the format seems to be ignored and instead of a combobox there 
is a textfield where I can input manually the id of the referenced table.

I am using the trunk version.
Do I need to set up anything else for it to work?


[web2py] Re: ssl certificate?

2011-12-23 Thread LightDot
What do you mean by "it's not insured"? Do you refer to the sign up checks 
or to the lack of actual insurance provided by some insurance company?

As I see it, the sign up process is not much different than with any other 
budget certificate issuer. The difference is only the price.

Regards

On Friday, December 23, 2011 5:49:39 AM UTC+1, guruyaya wrote:
>
> I've used it myself, but note this certificate is not insured in any 
> way, and it allows a pretty weak protection, in the free edition. It 
> also fails to work with wget (you can add some extra params to make it 
> work with wget, but most people don't want this hussle). 
> The quiestion is, what is this certificate for? The free edition was 
> good eanogth to prevent errors, when being transfered to google, when 
> I wanted to retrieve contacts for google. I guess it's good for the 
> admin, or to allow secured logins. But I wouldn't use to for web 
> services (as I cannot trust it to work with command line clients), and 
> avoid it for web payments (it's not insured at all). 
> I have no idea if the none free edition of startssl. 
>
> On Dec 22, 6:04 pm, Angelo Compagnucci  
> wrote: 
> > This on is free and it works well 
> > 
> > http://www.startssl.com/?app=1 
> > 
> > They make simple validation, the certificate is ready in minutes and the 
> > certificate is a fully featured one! 
> > 
> > I use it! 
> > 
> > 2011/12/22 Massimo Di Pierro  
> > 
> > > Any advice on where to buy a chap ssl certificate? 
> > 
> > > Please advice ONLY about services you have personally used already. 
> > 
> > > Massimo 
> > 
> > -- 
> > Profile:http://www.gild.com/compagnucciangelo 
> > Register on Gild:http://www.gild.com/referral/compagnucciangelo



[web2py] best way to create a cert for web2py server?

2011-12-23 Thread António Ramos
hello i´m having some errors with a cert i created with openssl

i have a lot of
SSL3_READ_BYTES: tlsv1 alert unknown ca



I dont know if this is a problem.
The users connect with no problem to we2py but it hapens 2 or 3 times a
week that i have to restart web2py because no one can access it.


I ask you all , what is the best way and free, to create a certificate for
web2py server
openssl?
example please...

thank you


Re: [web2py] How do I aggregate accounts using OAuth & web2py?

2011-12-23 Thread Matthew
Thank you, Mic!

[web2py] Get the ID of a row in a virtual field?

2011-12-23 Thread Thomas Dall'Agnese
Hi,

Is it possible to get the ID of a row in a virtual field?

I tried the following piece of code to virtually get the number of comments 
of a given post (assuming two tables "post" and "comment" where a "comment" 
entry can have a "post", so a post as many comments):
db.post.virtual_comments_nb= Field.Virtual(lambda row: db(db.comment.post 
== row.id).count())

But the key "id" is not in the object "row".
The key "key" neither.

How can I get the row ID in the lambda?


[web2py] Re: Get the ID of the just inserted row

2011-12-23 Thread Anthony
You have two options -- you can let the .process() method handle the 
insert, in which case the record id will be in form.vars.id after that, or 
you can do the insert manually, in which case the id will be returned by 
the .insert() method (i.e., id = db.post.insert(**dict(form.vars))).

Note, I don't think you can leave things as you have, with both 
form.validate() and form.process() being called. The validation process 
executed in .validate() checks the _formkey token in the session and then 
replaces it with a new one -- it is a one-time token to prevent double form 
submission and CSRF attacks. The .process() method also goes through the 
validation process, so when it checks the _formkey value in the session, it 
will no longer match. I suppose you could hack this process and re-assign 
the _formkey value in the session (or in request.post_vars), but it might 
be cleaner to do a manual insert, as described 
here: http://web2py.com/book/default/chapter/07#SQLFORM-without-database-IO.

Anthony

On Friday, December 23, 2011 2:01:59 AM UTC-5, Thomas Dall'Agnese wrote:
>
> Hi,
>
> Let say I have 2 tables:
>
> db.define_table('post', Field('content'))
> db.define_table('comment', Field('content'), Field('post', 'reference 
> post))
>
> When I add a "post" (through a FORM), I would like to automatically add 3 
> comments that refer to that post.
> How can I retrieve the ID of the just inserted post and add the 
> comments referring to it?
>
> Currently, I handle to form to add a post like this:
> def add_post():
>form = SQLFORM(db.post)
>if form.validate():
>try:
>comments = generateAutoComments()
>except Exception, e:
>response.flash = "Errors generating comments (%s)" % e.message
>else:
>if form.process().accepted:
># I guess here I would like to add all the comments to that 
> just added post?
>response.flash = 'Post added!'
>return locals()
>


[web2py] Re: format parameter not working?

2011-12-23 Thread Anthony
Can you show your code?

On Friday, December 23, 2011 6:08:25 AM UTC-5, Thomas Dall'Agnese wrote:
>
> Hi,
>
> I set the format of a table to a given field, and reference it in another 
> table.
> Unfortunately, the format seems to be ignored and instead of a combobox 
> there is a textfield where I can input manually the id of the referenced 
> table.
>
> I am using the trunk version.
> Do I need to set up anything else for it to work?
>
>

[web2py] Re: Get the ID of the just inserted row

2011-12-23 Thread Thomas Dall'Agnese
Hi Anthony,

Thanks for your answer.
I used the form.vars.id way.

And indeed, I had to change my process because the form.process().acceptedwas 
false after doing a 
form.validate().
So I changed the form.validate() with form.process().accepted and delete 
the inserted post if an exception is raised trying to add the comments to 
that post.

def add_post():
   form = SQLFORM(db.post)
   if form.process().accepted:
   try:
   comments = ('comment one', 'comment two', 'comment three')
   for comment in comments:
   db.comment.insert(post=form.vars.id, comment=comment)
   except Exception, e:
   response.flash = "Errors generating comments (%s)" % e.message
   db(db.post.id == form.vars.id).delete()
   else:
   response.flash = 'Post added!'
   return dict(form=form)

Works well, thanks!

Cheers,

Thomas


Re: [web2py] Get the ID of a row in a virtual field?

2011-12-23 Thread Marin Pranjić
Instead of row.id, try: row.post.id :-)


Marin

On Fri, Dec 23, 2011 at 2:34 PM, Thomas Dall'Agnese <
thomas.dallagn...@gmail.com> wrote:

> Hi,
>
> Is it possible to get the ID of a row in a virtual field?
>
> I tried the following piece of code to virtually get the number of
> comments of a given post (assuming two tables "post" and "comment" where a
> "comment" entry can have a "post", so a post as many comments):
> db.post.virtual_comments_nb= Field.Virtual(lambda row: db(db.comment.post
> == row.id).count())
>
> But the key "id" is not in the object "row".
> The key "key" neither.
>
> How can I get the row ID in the lambda?
>


Re: [web2py] Routes help for wordpress style urls

2011-12-23 Thread Anthony

>
> No. The problem is that the router doesn't introspect the controller, and 
> it doesn't know what its function names are. So it assumes that 2011 is a 
> function in the default controller.
>
> For this to work, it's necessary to provide the router with a list of 
> valid functions in the default controller: functions = [index, whatever, 
> ...].
>

Oh, right. I was thinking there was something like controllers='DEFAULT' 
for functions, but you have to list the functions explicitly. 


Re: [web2py] Get the ID of a row in a virtual field?

2011-12-23 Thread Thomas Dall'Agnese
It works, thanks!

In the examples, they can call directly row.field_name.
Why do I have to specify the table name as well in my case? 
(row.tablename.fieldbame)

Is it a mistake in the book or is my case different than the examples?
Book 
example: 
http://www.web2py.com/book/default/chapter/06#New-style-virtual-fields-(experimental)


Re: [web2py] Get the ID of a row in a virtual field?

2011-12-23 Thread Thomas Dall'Agnese
Another question: the virtual field is not displayed in the SQLTABLE() html 
rendering but is correctly displayed in the JSON rendering, is it normal?

[web2py] Re: newbie: How to match REST URL and extract path params

2011-12-23 Thread Anthony
All the elements of the URL after the controller and function are 
request.args (except the query string, of course). You could have a 
function called company(), and then companyid and storeid would be in 
request.args(0) and request.args(2), respectively. Or you might want a more 
general function, like api(), and then "company", companyid, "store", and 
storeid would be request.args[0:4]. If desired, you could hide the "api" 
function from the URL via routes.py.

Anthony

On Thursday, December 22, 2011 1:00:57 PM UTC-5, dum coder wrote:
>
> Hello everyone, i'm new to Python and web2py , In Java Jersey REST 
> framework i can map a REST URL to a function and get all the path 
> parameters eg., 
>
> /comapany/{comapnyid}/store/{storeid} 
>
> can be mapped to a particular function and companyid and storeid are 
> accessible as 
> parameters to function. 
>
> i'm trying to find how can i accomplish similar functionality in 
> web2py, where 
>
> GET /comapany/apple/store/567 
>
> gets mapped to a function and in side function i can retrieve 
> companyid and storeid variables. 
>
> I looked at function parse_as_rest but seems like it tried to run 
> query against db, in  my 
> case i just want to retrieve path parameters and then call other rest 
> api  in other systems 
>
>
> thanks 
>


[web2py] Re: format parameter not working?

2011-12-23 Thread Thomas Dall'Agnese
Sure.

db.define_table('comment',
Field('user', type='reference auth_user',
  label=T('User')),
Field('date_added', type='datetime',
  label=T('Date Added')),
Field('error_type', type='reference error_type',
  label=T('Error Type')),
Field('balise', type='reference balise',
  label=T('Balise')),
Field('content', type='string', notnull=True, required=True,
  label=T('Content')),
auth.signature,
format='%(content)s',
migrate=settings.migrate)


db.define_table('balise',
Field('name', type='string', notnull=True, required=True,
  label=T('Name')),
auth.signature,
format='%(name)s',
migrate=settings.migrate)

db.define_table('balise_archive',db.balise,Field('current_record','reference 
balise',readable=False,writable=False))


db.define_table('error_type',
Field('name', type='string', notnull=True, required=True,
  label=T('Name')),
auth.signature,
format='%(name)s',
migrate=settings.migrate)

When I add a COMMENT, I would like to see a  for the USER, BALISE 
and ERROR_TYPE.
However, only the USER is correctly displayed as a .
BALISE and ERROR_TYPE are text inputs:




What am I doing wrong?



[web2py] Re: Many-to-many admin form

2011-12-23 Thread Bruce Wade
I am guessing from the lack of responses this is not possible with Web2py's
current admin?

On Wed, Dec 21, 2011 at 4:49 PM, Bruce Wade  wrote:

> Hello, I know django has this ability so I am assuming web2py also does.
> (Here is to hoping :D)
>
> First the models:
> db.define_table('adreports',
> Field('reporttype', unique=True)
> )
>
> db.define_table('ads',
> Field('member_id', db.auth_user, default=auth.user_id),
> Field('points', 'integer', default=0),
> Field('url'),
> Field('language'),
> Field('location'),
> Field('accepted', 'boolean', default=False),
> Field('viewable', 'boolean'),
> Field('updated_at','datetime', default=request.now),
> Field('added_at','datetime', default=request.now)
> )
>
> db.define_table('keywords',
> Field('isapproved', 'boolean', default=False),
> Field('key')
> )
>
> db.define_table('ad_report',
> Field('ad_id', db.ads),
> Field('reportad_id', db.adreports)
> )
>
> db.define_table('ad_keyword',
> Field('ad_id', db.ads),
> Field('keyword_id', db.keywords)
> )
>
> db.ads.url.requires = (IS_URL(), IS_NOT_IN_DB(db, db.ads.url))
>
> db.ad_report.ad_id.requires = IS_IN_DB(db, db.ads.id, "%(url)s")
> db.ad_report.reportad_id.requires = IS_IN_DB(db, db.adreports.id,
> "%(reporttype)s")
>
> db.ad_keyword.ad_id.requires = IS_IN_DB(db, db.ads.id, "%(url)s")
> db.ad_keyword.keyword_id.requires = IS_IN_DB(db, db.keywords.id,
> "%(key)s")
>
> --
> Now I would like to be able, from the admin create a new ad and on the
> same page add multiple keywords and/or reports for the ad. This would have
> to happen with creating a new ad as well as when editing an existing ad.
>
> With Django you use: admin.TabularInline and inlines on admin.ModelAdmin
> classes
>
> https://docs.djangoproject.com/en/dev/ref/contrib/admin/#inlinemodeladmin-objects
>
> Has something similar being developed for web2py admin application?
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.warplydesigned.com
> http://www.fitnessfriendsfinder.com
>



-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com


Re: [web2py] Re: ssl certificate?

2011-12-23 Thread Angelo Compagnucci
I used it in production, it not differs from any other certification.
Startssl CA is included in all modern browsers and operating system, so the
certs they issues are valid ones.

2011/12/23 LightDot 

> What do you mean by "it's not insured"? Do you refer to the sign up checks
> or to the lack of actual insurance provided by some insurance company?
>
> As I see it, the sign up process is not much different than with any other
> budget certificate issuer. The difference is only the price.
>
> Regards
>
>
> On Friday, December 23, 2011 5:49:39 AM UTC+1, guruyaya wrote:
>
>> I've used it myself, but note this certificate is not insured in any
>> way, and it allows a pretty weak protection, in the free edition. It
>> also fails to work with wget (you can add some extra params to make it
>> work with wget, but most people don't want this hussle).
>> The quiestion is, what is this certificate for? The free edition was
>> good eanogth to prevent errors, when being transfered to google, when
>> I wanted to retrieve contacts for google. I guess it's good for the
>> admin, or to allow secured logins. But I wouldn't use to for web
>> services (as I cannot trust it to work with command line clients), and
>> avoid it for web payments (it's not insured at all).
>> I have no idea if the none free edition of startssl.
>>
>> On Dec 22, 6:04 pm, Angelo Compagnucci 
>> wrote:
>> > This on is free and it works well
>> >
>> > http://www.startssl.com/?app=1
>> >
>> > They make simple validation, the certificate is ready in minutes and
>> the
>> > certificate is a fully featured one!
>> >
>> > I use it!
>> >
>> > 2011/12/22 Massimo Di Pierro 
>> >
>> > > Any advice on where to buy a chap ssl certificate?
>> >
>> > > Please advice ONLY about services you have personally used already.
>> >
>> > > Massimo
>> >
>> > --
>> > Profile:http://www.gild.com/**compagnucciangelo
>> > Register on 
>> > Gild:http://www.gild.com/**referral/compagnucciangelo
>>
>


-- 
Profile: http://www.gild.com/compagnucciangelo
Register on Gild: http://www.gild.com/referral/compagnucciangelo


Re: [web2py] Get the ID of a row in a virtual field?

2011-12-23 Thread Richard Vézina
Maybe an error in the book... Table_name has to be present for
disambiguation in case there the same field name is present in many
table... Imagine you use viritual field in the context of a join where your
other table having the same field name is joint into that request...

Richard

On Fri, Dec 23, 2011 at 9:09 AM, Thomas Dall'Agnese <
thomas.dallagn...@gmail.com> wrote:

> It works, thanks!
>
> In the examples, they can call directly row.field_name.
> Why do I have to specify the table name as well in my case?
> (row.tablename.fieldbame)
>
> Is it a mistake in the book or is my case different than the examples?
> Book example:
> http://www.web2py.com/book/default/chapter/06#New-style-virtual-fields-(experimental)
>


Re: [web2py] Re: Many-to-many admin form

2011-12-23 Thread Alvaro Lizama Molina
The web2py admin works diferently to the django admin.

The web2py admin is for install apps and manage instances.

2011/12/23 Bruce Wade 

> I am guessing from the lack of responses this is not possible with
> Web2py's current admin?
>
>
> On Wed, Dec 21, 2011 at 4:49 PM, Bruce Wade  wrote:
>
>> Hello, I know django has this ability so I am assuming web2py also does.
>> (Here is to hoping :D)
>>
>> First the models:
>> db.define_table('adreports',
>> Field('reporttype', unique=True)
>> )
>>
>> db.define_table('ads',
>> Field('member_id', db.auth_user, default=auth.user_id),
>> Field('points', 'integer', default=0),
>> Field('url'),
>> Field('language'),
>> Field('location'),
>> Field('accepted', 'boolean', default=False),
>> Field('viewable', 'boolean'),
>> Field('updated_at','datetime', default=request.now),
>> Field('added_at','datetime', default=request.now)
>> )
>>
>> db.define_table('keywords',
>> Field('isapproved', 'boolean', default=False),
>> Field('key')
>> )
>>
>> db.define_table('ad_report',
>> Field('ad_id', db.ads),
>> Field('reportad_id', db.adreports)
>> )
>>
>> db.define_table('ad_keyword',
>> Field('ad_id', db.ads),
>> Field('keyword_id', db.keywords)
>> )
>>
>> db.ads.url.requires = (IS_URL(), IS_NOT_IN_DB(db, db.ads.url))
>>
>> db.ad_report.ad_id.requires = IS_IN_DB(db, db.ads.id, "%(url)s")
>> db.ad_report.reportad_id.requires = IS_IN_DB(db, db.adreports.id,
>> "%(reporttype)s")
>>
>> db.ad_keyword.ad_id.requires = IS_IN_DB(db, db.ads.id, "%(url)s")
>> db.ad_keyword.keyword_id.requires = IS_IN_DB(db, db.keywords.id,
>> "%(key)s")
>>
>> --
>> Now I would like to be able, from the admin create a new ad and on the
>> same page add multiple keywords and/or reports for the ad. This would have
>> to happen with creating a new ad as well as when editing an existing ad.
>>
>> With Django you use: admin.TabularInline and inlines on admin.ModelAdmin
>> classes
>>
>> https://docs.djangoproject.com/en/dev/ref/contrib/admin/#inlinemodeladmin-objects
>>
>> Has something similar being developed for web2py admin application?
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/brucelwade
>> http://www.wadecybertech.com
>> http://www.warplydesigned.com
>> http://www.fitnessfriendsfinder.com
>>
>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.warplydesigned.com
> http://www.fitnessfriendsfinder.com
>



-- 
Alvaro Lizama Molina  - http://alvarolizama.net


Re: [web2py] Get the ID of a row in a virtual field?

2011-12-23 Thread Thomas Dall'Agnese
I see, thanks for your explanation.

Cheers,

Thomas


On Sat, Dec 24, 2011 at 12:06 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> Maybe an error in the book... Table_name has to be present for
> disambiguation in case there the same field name is present in many
> table... Imagine you use viritual field in the context of a join where your
> other table having the same field name is joint into that request...
>
> Richard
>
>
> On Fri, Dec 23, 2011 at 9:09 AM, Thomas Dall'Agnese <
> thomas.dallagn...@gmail.com> wrote:
>
>> It works, thanks!
>>
>> In the examples, they can call directly row.field_name.
>> Why do I have to specify the table name as well in my case?
>> (row.tablename.fieldbame)
>>
>> Is it a mistake in the book or is my case different than the examples?
>> Book example:
>> http://www.web2py.com/book/default/chapter/06#New-style-virtual-fields-(experimental)
>>
>
>


Re: [web2py] Get the ID of a row in a virtual field?

2011-12-23 Thread Richard Vézina
I think that SQLTABLE need you to specify the columns you want to expose...
So it should need that you specify the virtual field in the "columns="
parameter under that format tablename.fieldname. I read also that columns
will be replace by fields so have a look to the doc about that...

Richard

On Fri, Dec 23, 2011 at 9:11 AM, Thomas Dall'Agnese <
thomas.dallagn...@gmail.com> wrote:

> Another question: the virtual field is not displayed in the SQLTABLE()
> html rendering but is correctly displayed in the JSON rendering, is it
> normal?


Re: [web2py] Re: Many-to-many admin form

2011-12-23 Thread Bruce Wade
I understand that, but you can also use the database portion to create new
data. That is mainly the part I am talking about.

When clicking database then insert in a table, it would be nice if the
relationships could be linked on that insert. This would make performing
inserts more efficiently.

Anyway which files should I start looking at to see how I can implement
this functionality for myself and anyone else who wants it?

Best Regards,
Bruce

On Fri, Dec 23, 2011 at 7:05 AM, Alvaro Lizama Molina wrote:

> The web2py admin works diferently to the django admin.
>
> The web2py admin is for install apps and manage instances.
>
>
> 2011/12/23 Bruce Wade 
>
>> I am guessing from the lack of responses this is not possible with
>> Web2py's current admin?
>>
>>
>> On Wed, Dec 21, 2011 at 4:49 PM, Bruce Wade  wrote:
>>
>>> Hello, I know django has this ability so I am assuming web2py also does.
>>> (Here is to hoping :D)
>>>
>>> First the models:
>>> db.define_table('adreports',
>>> Field('reporttype', unique=True)
>>> )
>>>
>>> db.define_table('ads',
>>> Field('member_id', db.auth_user, default=auth.user_id),
>>> Field('points', 'integer', default=0),
>>> Field('url'),
>>> Field('language'),
>>> Field('location'),
>>> Field('accepted', 'boolean', default=False),
>>> Field('viewable', 'boolean'),
>>> Field('updated_at','datetime', default=request.now),
>>> Field('added_at','datetime', default=request.now)
>>> )
>>>
>>> db.define_table('keywords',
>>> Field('isapproved', 'boolean', default=False),
>>> Field('key')
>>> )
>>>
>>> db.define_table('ad_report',
>>> Field('ad_id', db.ads),
>>> Field('reportad_id', db.adreports)
>>> )
>>>
>>> db.define_table('ad_keyword',
>>> Field('ad_id', db.ads),
>>> Field('keyword_id', db.keywords)
>>> )
>>>
>>> db.ads.url.requires = (IS_URL(), IS_NOT_IN_DB(db, db.ads.url))
>>>
>>> db.ad_report.ad_id.requires = IS_IN_DB(db, db.ads.id, "%(url)s")
>>> db.ad_report.reportad_id.requires = IS_IN_DB(db, db.adreports.id,
>>> "%(reporttype)s")
>>>
>>> db.ad_keyword.ad_id.requires = IS_IN_DB(db, db.ads.id, "%(url)s")
>>> db.ad_keyword.keyword_id.requires = IS_IN_DB(db, db.keywords.id,
>>> "%(key)s")
>>>
>>> --
>>> Now I would like to be able, from the admin create a new ad and on the
>>> same page add multiple keywords and/or reports for the ad. This would have
>>> to happen with creating a new ad as well as when editing an existing ad.
>>>
>>> With Django you use: admin.TabularInline and inlines on admin.ModelAdmin
>>> classes
>>>
>>> https://docs.djangoproject.com/en/dev/ref/contrib/admin/#inlinemodeladmin-objects
>>>
>>> Has something similar being developed for web2py admin application?
>>> --
>>> Regards,
>>> Bruce Wade
>>> http://ca.linkedin.com/in/brucelwade
>>> http://www.wadecybertech.com
>>> http://www.warplydesigned.com
>>> http://www.fitnessfriendsfinder.com
>>>
>>
>>
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/brucelwade
>> http://www.wadecybertech.com
>> http://www.warplydesigned.com
>> http://www.fitnessfriendsfinder.com
>>
>
>
>
> --
> Alvaro Lizama Molina  - http://alvarolizama.net
>



-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com


[web2py] Parsing of username field during register

2011-12-23 Thread greenguerilla
Hi,

I noticed something strange when testing the registration of users.

If I attempt to register as user: 'My Name' (note the space), the form
validation passes and I get an 'email sent' message.
What actually happens though, is the the username gets inserted into
the db as 'my'.
I'm fine with the lowercasing but I would rather strip the spaces and
insert the user as 'myname'
I have been searching for a hook to do this and I have tried the two
methods:

auth.settings.register_onvalidation = clean_username
auth.settings.register_onaccept = clean_username

Where 'clean_username' is a function to strip all the spaces from the
entered text.
My problem is that the username has already been stripped by the time
it gets this far. Strangely enough this doesn't happen for the
username field in the login form.

Does anywhere know where this might be happening and how I can
override it?

Thanks,

John


Re: [web2py] best way to create a cert for web2py server?

2011-12-23 Thread Richard Vézina
You can have a look into the web2py/scripts folder. There is web2py setup
scripts for different distros... You maybe read the command related to SSL
certificate creation and configuration with web2py and try to do the same
thing manually... Or you can just use the setup script... I never have
problem with SSL generate and configured with the setup script... But I
didn't put SSL in place for user, just for appadmin...

Hope it helps.

Richard

2011/12/23 António Ramos 

> hello i´m having some errors with a cert i created with openssl
>
> i have a lot of
> SSL3_READ_BYTES: tlsv1 alert unknown ca
>
>
>
> I dont know if this is a problem.
> The users connect with no problem to we2py but it hapens 2 or 3 times a
> week that i have to restart web2py because no one can access it.
>
>
> I ask you all , what is the best way and free, to create a certificate for
> web2py server
> openssl?
> example please...
>
> thank you
>
>
>
>


[web2py] Re: format parameter not working?

2011-12-23 Thread Anthony
In order for the validators for a reference field to be created 
automatically, I think the referenced tables have to be defined first 
(otherwise the validators cannot be defined because they refer to the 
referenced table). So, try defining db.comment after the other tables that 
it references.

Anthony

On Friday, December 23, 2011 9:16:15 AM UTC-5, Thomas Dall'Agnese wrote:
>
> Sure.
>
> db.define_table('comment',
> Field('user', type='reference auth_user',
>   label=T('User')),
> Field('date_added', type='datetime',
>   label=T('Date Added')),
> Field('error_type', type='reference error_type',
>   label=T('Error Type')),
> Field('balise', type='reference balise',
>   label=T('Balise')),
> Field('content', type='string', notnull=True, required=True,
>   label=T('Content')),
> auth.signature,
> format='%(content)s',
> migrate=settings.migrate)
>
> 
> db.define_table('balise',
> Field('name', type='string', notnull=True, required=True,
>   label=T('Name')),
> auth.signature,
> format='%(name)s',
> migrate=settings.migrate)
>
> db.define_table('balise_archive',db.balise,Field('current_record','reference 
> balise',readable=False,writable=False))
>
> 
> db.define_table('error_type',
> Field('name', type='string', notnull=True, required=True,
>   label=T('Name')),
> auth.signature,
> format='%(name)s',
> migrate=settings.migrate)
>
> When I add a COMMENT, I would like to see a  for the USER, BALISE 
> and ERROR_TYPE.
> However, only the USER is correctly displayed as a .
> BALISE and ERROR_TYPE are text inputs:
>
>
> 
>
>
> What am I doing wrong?
>
>

Re: [web2py] Re: format parameter not working?

2011-12-23 Thread Thomas Dall'Agnese
Correct!

It works now, thanks!

[image: Screenshot at 2011-12-24 00:29:10.png]

Best Regards,

Thomas


On Sat, Dec 24, 2011 at 12:26 AM, Anthony  wrote:

> In order for the validators for a reference field to be created
> automatically, I think the referenced tables have to be defined first
> (otherwise the validators cannot be defined because they refer to the
> referenced table). So, try defining db.comment after the other tables that
> it references.
>
> Anthony
>
>
> On Friday, December 23, 2011 9:16:15 AM UTC-5, Thomas Dall'Agnese wrote:
>>
>> Sure.
>>
>> db.define_table('comment',
>> Field('user', type='reference auth_user',
>>   label=T('User')),
>> Field('date_added', type='datetime',
>>   label=T('Date Added')),
>> Field('error_type', type='reference error_type',
>>   label=T('Error Type')),
>> Field('balise', type='reference balise',
>>   label=T('Balise')),
>> Field('content', type='string', notnull=True, required=True,
>>   label=T('Content')),
>> auth.signature,
>> format='%(content)s',
>> migrate=settings.migrate)
>>
>> ##**##
>> db.define_table('balise',
>> Field('name', type='string', notnull=True, required=True,
>>   label=T('Name')),
>> auth.signature,
>> format='%(name)s',
>> migrate=settings.migrate)
>>
>> db.define_table('balise_**archive',db.balise,Field('**current_record','reference
>> balise',readable=False,**writable=False))
>>
>> ##**##
>> db.define_table('error_type',
>> Field('name', type='string', notnull=True, required=True,
>>   label=T('Name')),
>> auth.signature,
>> format='%(name)s',
>> migrate=settings.migrate)
>>
>> When I add a COMMENT, I would like to see a  for the USER, BALISE
>> and ERROR_TYPE.
>> However, only the USER is correctly displayed as a .
>> BALISE and ERROR_TYPE are text inputs:
>>
>>
>> 
>>
>>
>> What am I doing wrong?
>>
>>
<>

[web2py] Re: Many-to-many admin form

2011-12-23 Thread DenesL


On Dec 23, 10:11 am, Bruce Wade  wrote:

> Anyway which files should I start looking at to see how I can implement
> this functionality for myself and anyone else who wants it?

Look for controller appadmin under your or any other app folder.


Re: [web2py] Routes help for wordpress style urls

2011-12-23 Thread Jonathan Lundell
On Dec 23, 2011, at 6:04 AM, Anthony wrote:

> No. The problem is that the router doesn't introspect the controller, and it 
> doesn't know what its function names are. So it assumes that 2011 is a 
> function in the default controller.
> 
> For this to work, it's necessary to provide the router with a list of valid 
> functions in the default controller: functions = [index, whatever, ...].
> 
> Oh, right. I was thinking there was something like controllers='DEFAULT' for 
> functions, but you have to list the functions explicitly. 

It'd be possible to do that, of course, duplicating (or sharing) the dispatch 
logic, but we don't. The overhead to do so would be fairly high in a cgi 
environment, too.

[web2py] Re: Parsing of username field during register

2011-12-23 Thread Anthony
By default, the 'username' field gets the following validators:

(IS_MATCH('[\w\.\-]+'), IS_NOT_IN_DB(db, table.username))

The IS_MATCH is doing the truncating. Actually, I think that's a bug -- 
IS_MATCH isn't supposed to transform the input, only check the regex 
pattern. For now, though, I suppose you could overwrite that tuple with 
your own validators:

auth.settings.table_user.username.requires = [IS_MATCH('[\w\.\- ]+'),
IS_NOT_IN_DB(db, auth.settings.table_user.username)]

Note, I added a space to the IS_MATCH regex.

Anthony

On Friday, December 23, 2011 10:11:44 AM UTC-5, greenguerilla wrote:
>
> Hi, 
>
> I noticed something strange when testing the registration of users. 
>
> If I attempt to register as user: 'My Name' (note the space), the form 
> validation passes and I get an 'email sent' message. 
> What actually happens though, is the the username gets inserted into 
> the db as 'my'. 
> I'm fine with the lowercasing but I would rather strip the spaces and 
> insert the user as 'myname' 
> I have been searching for a hook to do this and I have tried the two 
> methods: 
>
> auth.settings.register_onvalidation = clean_username 
> auth.settings.register_onaccept = clean_username 
>
> Where 'clean_username' is a function to strip all the spaces from the 
> entered text. 
> My problem is that the username has already been stripped by the time 
> it gets this far. Strangely enough this doesn't happen for the 
> username field in the login form. 
>
> Does anywhere know where this might be happening and how I can 
> override it? 
>
> Thanks, 
>
> John 
>


[web2py] Re: Parsing of username field during register

2011-12-23 Thread DenesL

IS_MATCH is using the default strict=False parameter in this case, so
it returns the part that matches.

Using strict=True it won't match:

>>> IS_MATCH('[\w\.\-]+', strict=True)('my name')
('my name', 'invalid expression')

Anyways, userids are not supposed to have blanks.


On Dec 23, 10:46 am, Anthony  wrote:
> By default, the 'username' field gets the following validators:
>
> (IS_MATCH('[\w\.\-]+'), IS_NOT_IN_DB(db, table.username))
>
> The IS_MATCH is doing the truncating. Actually, I think that's a bug --
> IS_MATCH isn't supposed to transform the input, only check the regex
> pattern. For now, though, I suppose you could overwrite that tuple with
> your own validators:
>
> auth.settings.table_user.username.requires = [IS_MATCH('[\w\.\- ]+'),
>     IS_NOT_IN_DB(db, auth.settings.table_user.username)]
>
> Note, I added a space to the IS_MATCH regex.
>
> Anthony
>
>
>
>
>
>
>
> On Friday, December 23, 2011 10:11:44 AM UTC-5, greenguerilla wrote:
>
> > Hi,
>
> > I noticed something strange when testing the registration of users.
>
> > If I attempt to register as user: 'My Name' (note the space), the form
> > validation passes and I get an 'email sent' message.
> > What actually happens though, is the the username gets inserted into
> > the db as 'my'.
> > I'm fine with the lowercasing but I would rather strip the spaces and
> > insert the user as 'myname'
> > I have been searching for a hook to do this and I have tried the two
> > methods:
>
> > auth.settings.register_onvalidation = clean_username
> > auth.settings.register_onaccept = clean_username
>
> > Where 'clean_username' is a function to strip all the spaces from the
> > entered text.
> > My problem is that the username has already been stripped by the time
> > it gets this far. Strangely enough this doesn't happen for the
> > username field in the login form.
>
> > Does anywhere know where this might be happening and how I can
> > override it?
>
> > Thanks,
>
> > John


[web2py] Re: best way to create a cert for web2py server?

2011-12-23 Thread Mirek Zvolský
Here good article, how to create certificates itselves, better than
selfsigned:
http://www.garex.net/apache

Or StartSSL.


[web2py] Re: How to make a function to download a file?

2011-12-23 Thread DenesL

Look at the code samples under
http://web2py.com/books/default/chapter/29/10#CSV


On Dec 22, 10:09 pm, thstart  wrote:
> I want the visitors to be able to download a CSV file.
>
> here is my code:
> def download():
>         response.headers['Content-Type'] = 'text/csv'
>         attachment = 'attachment;filename=' + file+ '.csv'
>         response.headers['Content-Disposition'] = attachment
>
>         content = ',,'
>         raise HTTP(200,str(content),
>                    **{'Content-Type':'text/csv',
>                       'Content-Disposition':attachment + ';'})
>
> When I click on the link download, I get 'Undefined' in the browser
> and nothing is downloaded.
>
> What is wrong?


Re: [web2py] Routes help for wordpress style urls

2011-12-23 Thread Joseph Jude
routers = dict(
  BASE = dict(default_application = 'init',
default_controller = 'default',
default_function = 'index',
functions = ['index'],
),
)

With the above routes, admin doesn't work. i.e: localhost:8080/admin/index 
throws a password pg but after that the control goes to /admin/site and it 
throws an error 'This webpage has a redirect loop'.

How to resolve this?
Thx,
Joseph


[web2py] Re: How to make smartgrid redirect to edit after creating new record?

2011-12-23 Thread Cliff
Hmm... doesn't seem to work.

Controller below.  As you can see, I've solved the puzzle to my
satisfaction, but I would like to know why the call to oncreate
misfires.

def handle_create(form):
# never happens
print 'hello, world'

def index():
fields = [db.owner.name, db.dog.id]
db.dog.represent = '%(name)s'

# Just making sure we can detect a new owner request
if len(request.args) > 2 and request.args[-1] == 'owner' and\
   request.args[-2] == 'new':
print 'new one'

form = SQLFORM.smartgrid(
db.owner,
ui = 'jquery-ui',
deletable=False,
oncreate = dict(owner=[handle_create]),
)

# this works
# also how I have detected successful creates in the past
if len(request.args) > 2 and request.args[-1] == 'owner' and\
   request.args[-2] == 'new' and form[2].process().accepted:
print 'accepted it'



return dict(form=form)


On Dec 22, 11:56 pm, Cliff  wrote:
> Thanks.
>
> That's pretty close to what I was using, but I didn't have the syntax
> just right.
>
> Cliff Kachinske
>
> On Dec 22, 6:06 pm, Adi  wrote:
>
>
>
>
>
>
>
> > this is what i'm doing:
>
> > in a smartgrid use oncreate = dict(purchase_order=[po_oncreation]),
>
> > that takes you to your function after record is created, where you know the
> > id. The argument you use is form.
>
> > def po_oncreation(form):
> >     auth.archive
> >     last_id = form1.vars.id
> >     ...


[web2py] Re: ssl certificate?

2011-12-23 Thread Massimo Di Pierro
I have bought a certificate from GKG.net sine I have tried some of the
other suggested solutions and asked lots of questions and the process
was very convoluted. Eventually got stuck because web2py.com does not
run an email server and I could not verify ownership. Since I bought
the domain from GKG.net, they did not ask any question. They just
emailed me the certificate and costed only $19 for  one year.

pdfbuy should work fine with ssl now. Thanks for your advice.

Massimo

On Dec 23, 8:39 am, Angelo Compagnucci 
wrote:
> I used it in production, it not differs from any other certification.
> Startssl CA is included in all modern browsers and operating system, so the
> certs they issues are valid ones.
>
> 2011/12/23 LightDot 
>
>
>
>
>
>
>
>
>
> > What do you mean by "it's not insured"? Do you refer to the sign up checks
> > or to the lack of actual insurance provided by some insurance company?
>
> > As I see it, the sign up process is not much different than with any other
> > budget certificate issuer. The difference is only the price.
>
> > Regards
>
> > On Friday, December 23, 2011 5:49:39 AM UTC+1, guruyaya wrote:
>
> >> I've used it myself, but note this certificate is not insured in any
> >> way, and it allows a pretty weak protection, in the free edition. It
> >> also fails to work with wget (you can add some extra params to make it
> >> work with wget, but most people don't want this hussle).
> >> The quiestion is, what is this certificate for? The free edition was
> >> good eanogth to prevent errors, when being transfered to google, when
> >> I wanted to retrieve contacts for google. I guess it's good for the
> >> admin, or to allow secured logins. But I wouldn't use to for web
> >> services (as I cannot trust it to work with command line clients), and
> >> avoid it for web payments (it's not insured at all).
> >> I have no idea if the none free edition of startssl.
>
> >> On Dec 22, 6:04 pm, Angelo Compagnucci 
> >> wrote:
> >> > This on is free and it works well
>
> >> >http://www.startssl.com/?app=1
>
> >> > They make simple validation, the certificate is ready in minutes and
> >> the
> >> > certificate is a fully featured one!
>
> >> > I use it!
>
> >> > 2011/12/22 Massimo Di Pierro 
>
> >> > > Any advice on where to buy a chap ssl certificate?
>
> >> > > Please advice ONLY about services you have personally used already.
>
> >> > > Massimo
>
> >> > --
> >> > Profile:http://www.gild.com/**compagnucciangelo
> >> > Register on 
> >> > Gild:http://www.gild.com/**referral/compagnucciangelo
>
> --
> Profile:http://www.gild.com/compagnucciangelo
> Register on Gild:http://www.gild.com/referral/compagnucciangelo


Re: [web2py] Routes help for wordpress style urls

2011-12-23 Thread Jonathan Lundell
On Dec 23, 2011, at 9:14 AM, Joseph Jude wrote:

> routers = dict(
>   BASE= dict(default_application = 'init',
>   default_controller = 'default',
>   default_function = 'index',
>   functions = ['index'],
> ),
> )
> 
> With the above routes, admin doesn't work. i.e: localhost:8080/admin/index 
> throws a password pg but after that the control goes to /admin/site and it 
> throws an error 'This webpage has a redirect loop'.
> 
> How to resolve this?
> 

Try this (or something like it). Everything you put it BASE applies to all 
apps, so the functions= line in particular needs to go in an app-specific 
router.

I also omitted the init/default/index definitions, since they're already the 
defaults.


routers = dict(
  init  = dict(functions = ['index']),
)



Re: [web2py] Routes help for wordpress style urls

2011-12-23 Thread Anthony
On Friday, December 23, 2011 12:14:32 PM UTC-5, Joseph Jude wrote:
>
> routers = dict(
>   BASE = dict(default_application = 'init',
> default_controller = 'default',
> default_function = 'index',
> functions = ['index'],
> ),
> )
>
> With the above routes, admin doesn't work. i.e: localhost:8080/admin/index 
> throws a password pg but after that the control goes to /admin/site and it 
> throws an error 'This webpage has a redirect loop'.
>

I guess it's using your functions list for all apps, and you have only 
listed one function ('index') there. Instead, I think functions can be a 
dictionary with a key for each app, so maybe try:

functions = dict(init=['index', plus other functions in 
/init/controllers/default.py])

Not sure if you'll need to bother with an explicit entry for 'admin'.

Anthony 


[web2py] Re: How to make smartgrid redirect to edit after creating new record?

2011-12-23 Thread Adi
this works:

grid=SQLFORM.smartgrid(db.purchase_order, details=False, 
links_in_grid=True,
maxtextlengths={'purchase_order.po_number':15,},
maxtextlength=30,
paginate=20,
sortable=True,

orderby=dict(purchase_order=[~db.purchase_order.modified_on], ),
oncreate = dict(purchase_order=[po_oncreation]),
csv=False,
ui='jquery-ui',
links=dict(purchase_order=[lambda row: 
A('Duplicate',
_class='button', 
_href=URL('duplicate_purchase_order',args=[row.id])), lambda row: A('Print',
_class='button', 
_href=URL('print_all',args=[row.id]))]),
user_signature=False, onupdate=auth.archive,
)


def po_oncreation(form1):

auth.archive

last_id = form1.vars.id

row = db(db.purchase_order.id==last_id).select().first()

str_po_number = row.po_number + str(row.id)
row.po_number = str_po_number
row.update_record()

#response.flash = 'Added a Purchase Order'

session.flash = 'Added a Purchase Order'
return





[web2py] Re: web2py sitting behind load balancer showing lb IP not client IP

2011-12-23 Thread Dave
I can't make changes to the load balancer. The x-forwarded-for is
populated but I can not change the config so the source up is kept the
same. If I could, that would have been my first choice.

The network between the lb and web server isn't routed so the ip
source must be the local LAN RFC1018 address not the Internet source.

On Dec 23, 5:42 am, nils  wrote:
> Hi, what load balancer are you using?
> Regards,
> Nils
> On Dec 23, 2011 5:17 a.m., "Dave"  wrote:
>
>
>
>
>
>
>
> > Since I've moved my installation behind a load balancer all my session
> > IP addresses show as the back-side IP of the load balancer, not the
> > real client IP.
>
> > Have any of you figured out a way to pull the {X-Forwarded-For} entry
> > from the HTTP environment for the "remote_addr" instead?


[web2py] Re: Many-to-many admin form

2011-12-23 Thread Cliff
Bruce, you are more brave than me ;)

I always like to get the parent record committed in the database
before adding child records.

that way you know the ID of the parent record and it has the minimal
required fieldset safely saved away.  If there's a session
interruption you don't have some potential orphan child records
floating around somewhere.

If you've solved those kinds of concerns, please share it with us.

Thanks,
Cliff Kachinske

On Dec 23, 10:34 am, DenesL  wrote:
> On Dec 23, 10:11 am, Bruce Wade  wrote:
>
> > Anyway which files should I start looking at to see how I can implement
> > this functionality for myself and anyone else who wants it?
>
> Look for controller appadmin under your or any other app folder.


Re: [web2py] Re: Many-to-many admin form

2011-12-23 Thread Bruce Wade
I have solved these kinds of concerns with pyramid based applications using
sqlalchemy. However I need to look into the core of how Web2py handles
things to figure out the best way.

Sqlachemy allows you to put everything in:
1) Transactions
2) Sessions

So on submit you first create the parent record:
ad = Ad()
session.add(ad)
session.flush()

Now you have access to ad.id (parent id)

report = Report(...)
report.ad_id = ad.id
session.add(report)

Now if you used Sqlachemy relationships
ad.reports.append(report) # use this instead of report.ad_id = ad.id
session.flush()

Or in the case of having multiple children created before creating the
parent on a web form. You just submit all the form data at once and loop
through all reports.

ad = Ad(...)
session.add(ad)
session.flush()

get list of all reports in form submit
for report in reports:
  session.add(report)
  ad.reports.append(report)
session.flush()

If anything fails the transaction automatically roles everything back.

Or a easier solution is to only enable the children on edits. So you first
create the parent, then you can view/edit/delete children on the parent
edit page.

--
Regards,
Bruce

On Fri, Dec 23, 2011 at 10:00 AM, Cliff  wrote:

> Bruce, you are more brave than me ;)
>
> I always like to get the parent record committed in the database
> before adding child records.
>
> that way you know the ID of the parent record and it has the minimal
> required fieldset safely saved away.  If there's a session
> interruption you don't have some potential orphan child records
> floating around somewhere.
>
> If you've solved those kinds of concerns, please share it with us.
>
> Thanks,
> Cliff Kachinske
>
> On Dec 23, 10:34 am, DenesL  wrote:
> > On Dec 23, 10:11 am, Bruce Wade  wrote:
> >
> > > Anyway which files should I start looking at to see how I can implement
> > > this functionality for myself and anyone else who wants it?
> >
> > Look for controller appadmin under your or any other app folder.
>



-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com


Re: [web2py] Re: Many-to-many admin form

2011-12-23 Thread Anthony
web2py wraps each request in a single transaction by default, so if you 
make multiple inserts during a request and the request ultimately fails due 
to an error, the inserts should be rolled back automatically. 
See http://web2py.com/books/default/chapter/29/4#Workflow 
and http://web2py.com/books/default/chapter/29/6#commit-and-rollback.

Anthony

On Friday, December 23, 2011 1:22:34 PM UTC-5, Detectedstealth wrote:
>
> I have solved these kinds of concerns with pyramid based applications 
> using sqlalchemy. However I need to look into the core of how Web2py 
> handles things to figure out the best way.
>
> Sqlachemy allows you to put everything in:
> 1) Transactions
> 2) Sessions
>
> So on submit you first create the parent record:
> ad = Ad()
> session.add(ad)
> session.flush()
>
> Now you have access to ad.id (parent id)
>
> report = Report(...)
> report.ad_id = ad.id
> session.add(report)
>
> Now if you used Sqlachemy relationships
> ad.reports.append(report) # use this instead of report.ad_id = ad.id
> session.flush()
>
> Or in the case of having multiple children created before creating the 
> parent on a web form. You just submit all the form data at once and loop 
> through all reports.
>
> ad = Ad(...)
> session.add(ad)
> session.flush()
>
> get list of all reports in form submit
> for report in reports:
>   session.add(report)
>   ad.reports.append(report)
> session.flush()
>
> If anything fails the transaction automatically roles everything back.
>
> Or a easier solution is to only enable the children on edits. So you first 
> create the parent, then you can view/edit/delete children on the parent 
> edit page.
>
> --
> Regards,
> Bruce
>
> On Fri, Dec 23, 2011 at 10:00 AM, Cliff  wrote:
>
>> Bruce, you are more brave than me ;)
>>
>> I always like to get the parent record committed in the database
>> before adding child records.
>>
>> that way you know the ID of the parent record and it has the minimal
>> required fieldset safely saved away.  If there's a session
>> interruption you don't have some potential orphan child records
>> floating around somewhere.
>>
>> If you've solved those kinds of concerns, please share it with us.
>>
>> Thanks,
>> Cliff Kachinske
>>
>> On Dec 23, 10:34 am, DenesL  wrote:
>> > On Dec 23, 10:11 am, Bruce Wade  wrote:
>> >
>> > > Anyway which files should I start looking at to see how I can 
>> implement
>> > > this functionality for myself and anyone else who wants it?
>> >
>> > Look for controller appadmin under your or any other app folder.
>>
>
>
>
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.warplydesigned.com
> http://www.fitnessfriendsfinder.com
>  


[web2py] Re: How to make smartgrid redirect to edit after creating new record?

2011-12-23 Thread Cliff
Adi,

Is this 1.99.4?

Is your controller named 'purchase_order'?

Thanks,
Cliff

On Dec 23, 12:44 pm, Adi  wrote:
> this works:
>
>     grid=SQLFORM.smartgrid(db.purchase_order, details=False,
> links_in_grid=True,
>                         maxtextlengths={'purchase_order.po_number':15,},
>                         maxtextlength=30,
>                         paginate=20,
>                         sortable=True,
>
> orderby=dict(purchase_order=[~db.purchase_order.modified_on], ),
>                         oncreate = dict(purchase_order=[po_oncreation]),
>                         csv=False,
>                         ui='jquery-ui',
>                         links=dict(purchase_order=[lambda row:
> A('Duplicate',
>                             _class='button',
> _href=URL('duplicate_purchase_order',args=[row.id])), lambda row: A('Print',
>                             _class='button',
> _href=URL('print_all',args=[row.id]))]),
>                         user_signature=False, onupdate=auth.archive,
>                         )
>
> def po_oncreation(form1):
>
>     auth.archive
>
>     last_id = form1.vars.id
>
>     row = db(db.purchase_order.id==last_id).select().first()
>
>     str_po_number = row.po_number + str(row.id)
>     row.po_number = str_po_number
>     row.update_record()
>
>     #response.flash = 'Added a Purchase Order'
>
>     session.flash = 'Added a Purchase Order'
>     return


[web2py] question about onvalidation function

2011-12-23 Thread Richard
Hello,

In the book there is this example :

db.define_table('numbers',
Field('a', 'integer'),
Field('b', 'integer'),
Field('c', 'integer', readable=False, writable=False))

def my_form_processing(form):
c = form.vars.a * form.vars.b
if c < 0:
   form.errors.b = 'a*b cannot be negative'
else:
   form.vars.c = c

def insert_numbers():
   form = SQLFORM(db.numbers)
   if form.process(onvalidation=my_form_processing).accepted:
   session.flash = 'record inserted'
   redirect(URL())
   return dict(form=form)


Where "my_form_processing" function is called without bracket and
arguments...

I try to do this that failed :

def my_form_processing(table_name, form):
form.vars.field1 = table_name # I know useless, it just
demonstration for purpose of my question...

...

 if form.process(onvalidation=my_form_processing(request.args(0),
form)).accepted:

Then I did :

def my_form_processing(form):
form.vars.field1 = request.args(0)

...

 if form.process(onvalidation=my_form_processing).accepted:

That actually works...

I would like to make sure that I understand onvalidation properly...

Is "my_form_processing" just a extension of the "insert_numbers()"
function?

And if so, does it have access to all the same variables
(environnement) of "inser_numbers()"??

Thank you!

Richard




[web2py] Re: How to make smartgrid redirect to edit after creating new record?

2011-12-23 Thread Adi
Hi Cliff,
No. The name of the controller is "default", but the table, on which 
smartgrid is operating is called "purchase_order".

Yes, it is the latest version. 1.99.4


[web2py] Re: How to make smartgrid redirect to edit after creating new record?

2011-12-23 Thread Adi
Hi Cliff,
No. The name of the controller is "default", but the table, on which 
smartgrid is operating is called "purchase_order".

Yes, it is the latest version. 1.99.4


[web2py] Re: question about onvalidation function

2011-12-23 Thread Massimo Di Pierro
onvalidation = my_form_processing

registers a callback (called after validation and before accepting).
This does not work

def my_form_processing(table_name, form):     form.vars.field1 =
table_name # I know useless, it just

because the callback function must take a single parameter, the form.
You can do instead

def my_form_processing(form):
    form.vars.field1 = form.table.name # I know useless, it just

Hope this helps.


On Dec 23, 1:32 pm, Richard  wrote:
> Hello,
>
> In the book there is this example :
>
> db.define_table('numbers',
>     Field('a', 'integer'),
>     Field('b', 'integer'),
>     Field('c', 'integer', readable=False, writable=False))
>
> def my_form_processing(form):
>     c = form.vars.a * form.vars.b
>     if c < 0:
>        form.errors.b = 'a*b cannot be negative'
>     else:
>        form.vars.c = c
>
> def insert_numbers():
>    form = SQLFORM(db.numbers)
>    if form.process(onvalidation=my_form_processing).accepted:
>        session.flash = 'record inserted'
>        redirect(URL())
>    return dict(form=form)
>
> Where "my_form_processing" function is called without bracket and
> arguments...
>
> I try to do this that failed :
>
> def my_form_processing(table_name, form):
>     form.vars.field1 = table_name # I know useless, it just
> demonstration for purpose of my question...
>
> ...
>
>  if form.process(onvalidation=my_form_processing(request.args(0),
> form)).accepted:
>
> Then I did :
>
> def my_form_processing(form):
>     form.vars.field1 = request.args(0)
>
> ...
>
>  if form.process(onvalidation=my_form_processing).accepted:
>
> That actually works...
>
> I would like to make sure that I understand onvalidation properly...
>
> Is "my_form_processing" just a extension of the "insert_numbers()"
> function?
>
> And if so, does it have access to all the same variables
> (environnement) of "inser_numbers()"??
>
> Thank you!
>
> Richard


Re: [web2py] Re: question about onvalidation function

2011-12-23 Thread Richard Vézina
Thanks for explanation...

But I am unable to do what you explain because I try to make a kind of
virtual table to form submission... So I need the "virtual table name" I
pass by request.args(0) to access some dict that I build to make my virtual
table to work...

May I request "request.args(0)" form "my_form_processing" if the only thing
"my_form_processing" get is the form?

It works once, but I think it not working every time. I mean I get my own
"my_form_processing" function to works with request.args(0), but it not
seems to work anymore after restart web2py (local dev with rocket built-in
server).

Thanks

Richard

On Fri, Dec 23, 2011 at 4:13 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> onvalidation = my_form_processing
>
> registers a callback (called after validation and before accepting).
> This does not work
>
> def my_form_processing(table_name, form): form.vars.field1 =
> table_name # I know useless, it just
>
> because the callback function must take a single parameter, the form.
> You can do instead
>
> def my_form_processing(form):
> form.vars.field1 = form.table.name # I know useless, it just
>
> Hope this helps.
>
>
> On Dec 23, 1:32 pm, Richard  wrote:
> > Hello,
> >
> > In the book there is this example :
> >
> > db.define_table('numbers',
> > Field('a', 'integer'),
> > Field('b', 'integer'),
> > Field('c', 'integer', readable=False, writable=False))
> >
> > def my_form_processing(form):
> > c = form.vars.a * form.vars.b
> > if c < 0:
> >form.errors.b = 'a*b cannot be negative'
> > else:
> >form.vars.c = c
> >
> > def insert_numbers():
> >form = SQLFORM(db.numbers)
> >if form.process(onvalidation=my_form_processing).accepted:
> >session.flash = 'record inserted'
> >redirect(URL())
> >return dict(form=form)
> >
> > Where "my_form_processing" function is called without bracket and
> > arguments...
> >
> > I try to do this that failed :
> >
> > def my_form_processing(table_name, form):
> > form.vars.field1 = table_name # I know useless, it just
> > demonstration for purpose of my question...
> >
> > ...
> >
> >  if form.process(onvalidation=my_form_processing(request.args(0),
> > form)).accepted:
> >
> > Then I did :
> >
> > def my_form_processing(form):
> > form.vars.field1 = request.args(0)
> >
> > ...
> >
> >  if form.process(onvalidation=my_form_processing).accepted:
> >
> > That actually works...
> >
> > I would like to make sure that I understand onvalidation properly...
> >
> > Is "my_form_processing" just a extension of the "insert_numbers()"
> > function?
> >
> > And if so, does it have access to all the same variables
> > (environnement) of "inser_numbers()"??
> >
> > Thank you!
> >
> > Richard
>


[web2py] Re: new book now available in HTML (english, japanese, italian)

2011-12-23 Thread Brian M
Looking good Massimo - thank you so much for making the book available 
online!

I did come across one bug:

http://web2py.com/books/default/reference/29/ReportLab results in "invalid 
function (default/reference)"

[web2py] Re: new book now available in HTML (english, japanese, italian)

2011-12-23 Thread Massimo Di Pierro
That URL does not exist, is there a link to it somewhere?

On Dec 23, 3:46 pm, Brian M  wrote:
> Looking good Massimo - thank you so much for making the book available
> online!
>
> I did come across one bug:
>
> http://web2py.com/books/default/reference/29/ReportLabresults in "invalid
> function (default/reference)"


Re: [web2py] Edit / Update Database

2011-12-23 Thread Richard Vézina
I think what you try to do is a kind of bulk insert or bulk update...

I write my own bulk update function with a SQLTABLE table displaying the
rows that will be update and a SQLFORM.factory form for handling the
submission... Then you just manually process records base on the id of the
rows you have selected...

In that particular case of use of I had to find a way to make sure no
records change of state between the time the form is displayed to the end
user and the time he finally submit the form... I calculate a md5_hash for
every rows then pass it to the form as a hidden field then check for every
row if there were still the same hash before actually update the row...

It works for me this way cause I had really simple update to make to all
the records (just one field was updated will the same value for every
record).

You may search the mailing-list Massimo had propose something ressembling
to this (I can't find it back) :

rows = db(...).select(db...)

form = SQLFORM.factory(*[Field(f+'_%s'%r.id, default=r[f]) for r in rows
for f in r])
if form.process().accepted:
for key,value in form.vars.items():
   db(db[request.args(0)].id==key[3:]).update(reviewed_by = 1)
   db.commit()


There is no easy way to do what you want to do I think... At least there is
noting as easy as form = crud.create_bulk(...) or crud.update_bulk(...)

Richard



On Fri, Dec 23, 2011 at 2:00 AM, lyn2py  wrote:

> It is simple to edit or update if it only involves one table
> (SQLFORM).
>
> However I have combined tables into a form using SQLFORM.factory and
> also SQLFORM.factory + append fields
>
> How should I go about updating a form with combined tables (+ append
> fields)?
>
> I have read
>
> http://web2py.com/books/default/chapter/29/7#SQLFORM-and-insert/update/delete
> but it doesn't cover how to use SQLFORM.factory with record edits.
>
> Thanks!


[web2py] Edit / Update Database

2011-12-23 Thread Anthony
Have you seen 
http://web2py.com/books/default/chapter/29/7#One-form-for-multiple-tables?


Re: [web2py] Re: question about onvalidation function

2011-12-23 Thread Anthony
If my_form_processing is defined in your controller or a model, it should have 
access to the request object.


[web2py] Re: web2py sitting behind load balancer showing lb IP not client IP

2011-12-23 Thread pbreit
What web server are you running? On Nginx there's a module to take the 
x-forwarded-for and make it the client ip.

http://wiki.nginx.org/HttpRealIpModule


[web2py] Re: best way to create a cert for web2py server?

2011-12-23 Thread pbreit
If you create your own cert with OpenSSL, many or most browsers are going 
to warn the user that it's not a "real" cert.

You can get an SSL cert from most domain registers or hosting companies 
(ie, GoDaddy, NameCheap, Enom, etc).

Also, there is one free provider:
http://www.startssl.com/?app=1


Re: [web2py] Re: best way to create a cert for web2py server?

2011-12-23 Thread Michele Comitini
If you want to create your own certs with your own ca you can use this
simple web2py app:

https://simpatica.googlecode.com

mic


2011/12/24 pbreit :
> If you create your own cert with OpenSSL, many or most browsers are going to
> warn the user that it's not a "real" cert.
>
> You can get an SSL cert from most domain registers or hosting companies (ie,
> GoDaddy, NameCheap, Enom, etc).
>
> Also, there is one free provider:
> http://www.startssl.com/?app=1


[web2py] Re: Edit / Update Database

2011-12-23 Thread lyn2py
You are right there's no easy way to do it.
Turns out to stick with SQLFORM instead.

SQLFORM.factory for inserts are great, but not updates.

Thanks Richard!

On Dec 24, 6:30 am, Richard Vézina 
wrote:
> I think what you try to do is a kind of bulk insert or bulk update...
>
> I write my own bulk update function with a SQLTABLE table displaying the
> rows that will be update and a SQLFORM.factory form for handling the
> submission... Then you just manually process records base on the id of the
> rows you have selected...
>
> In that particular case of use of I had to find a way to make sure no
> records change of state between the time the form is displayed to the end
> user and the time he finally submit the form... I calculate a md5_hash for
> every rows then pass it to the form as a hidden field then check for every
> row if there were still the same hash before actually update the row...
>
> It works for me this way cause I had really simple update to make to all
> the records (just one field was updated will the same value for every
> record).
>
> You may search the mailing-list Massimo had propose something ressembling
> to this (I can't find it back) :
>
> rows = db(...).select(db...)
>
> form = SQLFORM.factory(*[Field(f+'_%s'%r.id, default=r[f]) for r in rows
> for f in r])
> if form.process().accepted:
>     for key,value in form.vars.items():
>            db(db[request.args(0)].id==key[3:]).update(reviewed_by = 1)
>            db.commit()
>
> There is no easy way to do what you want to do I think... At least there is
> noting as easy as form = crud.create_bulk(...) or crud.update_bulk(...)
>
> Richard
>
>
>
>
>
>
>
> On Fri, Dec 23, 2011 at 2:00 AM, lyn2py  wrote:
> > It is simple to edit or update if it only involves one table
> > (SQLFORM).
>
> > However I have combined tables into a form using SQLFORM.factory and
> > also SQLFORM.factory + append fields
>
> > How should I go about updating a form with combined tables (+ append
> > fields)?
>
> > I have read
>
> >http://web2py.com/books/default/chapter/29/7#SQLFORM-and-insert/updat...
> > but it doesn't cover how to use SQLFORM.factory with record edits.
>
> > Thanks!


[web2py] virtual field question

2011-12-23 Thread Nik Go
When I try to access the  ad1 table from appadmin, a message is displayed
"Invalid Query 'name'" and the table isn't displayed. No exceptions or
tickets are generated. If I comment out the virtual field, it works fine.

What is wrong in my virtual field definition below?

geo.define_table('country'
  ,Field('id_un', 'id')
  ,Field('iso2_0', 'string', length=2)
  ,Field('iso3_0', 'string', length=3)
  ,Field('name', 'string', length=50)
  ,migrate=False
  ,format='%(name)s')
geo.define_table('ad1'
  ,Field('id_un', geo.country, writable=False)
  ,Field('id_1', 'id')
  ,Field('name', 'string', length=50)
  ,Field('iso_1', 'string', length=3)
  ,migrate=False)
geo.ad1.vname=Field.Virtual(lambda r: "%s, %s" % (r.name,
geo.country(r.id_un).iso3_0))


[web2py] virtual field question

2011-12-23 Thread Nik Go
When I try to access the  ad1 table from appadmin, a message is displayed
"Invalid Query 'name'" and the table isn't displayed. No exceptions or
tickets are generated. If I comment out the virtual field, it works fine.

What is wrong in my virtual field definition below?

geo.define_table('country'
  ,Field('id_un', 'id')
  ,Field('iso2_0', 'string', length=2)
  ,Field('iso3_0', 'string', length=3)
  ,Field('name', 'string', length=50)
  ,migrate=False
  ,format='%(name)s')
geo.define_table('ad1'
  ,Field('id_un', geo.country, writable=False)
  ,Field('id_1', 'id')
  ,Field('name', 'string', length=50)
  ,Field('iso_1', 'string', length=3)
  ,migrate=False)
geo.ad1.vname=Field.Virtual(lambda r: "%s, %s" % (r.name,
geo.country(r.id_un).iso3_0))


[web2py] virtual field question

2011-12-23 Thread Nik Go
When I try to access the  ad1 table from appadmin, a message is displayed
"Invalid Query 'name'" and the table isn't displayed. No exceptions or
tickets are generated. If I comment out the virtual field, it works fine.

What is wrong in my virtual field definition below?

geo.define_table('country'
  ,Field('id_un', 'id')
  ,Field('iso2_0', 'string', length=2)
  ,Field('iso3_0', 'string', length=3)
  ,Field('name', 'string', length=50)
  ,migrate=False
  ,format='%(name)s')
geo.define_table('ad1'
  ,Field('id_un', geo.country, writable=False)
  ,Field('id_1', 'id')
  ,Field('name', 'string', length=50)
  ,Field('iso_1', 'string', length=3)
  ,migrate=False)
geo.ad1.vname=Field.Virtual(lambda r: "%s, %s" % (r.name,
geo.country(r.id_un).iso3_0))


[web2py] Re: Many-to-many admin form

2011-12-23 Thread Vincent
This something I would definitely be interested in seeing, as well as
input forms for many-to-many in general (not just admin).

Thanks
Vincent

On Dec 23, 12:50 pm, Anthony  wrote:
> web2py wraps each request in a single transaction by default, so if you
> make multiple inserts during a request and the request ultimately fails due
> to an error, the inserts should be rolled back automatically.
> Seehttp://web2py.com/books/default/chapter/29/4#Workflow
> andhttp://web2py.com/books/default/chapter/29/6#commit-and-rollback.
>
> Anthony
>
>
>
>
>
>
>
> On Friday, December 23, 2011 1:22:34 PM UTC-5, Detectedstealth wrote:
>
> > I have solved these kinds of concerns with pyramid based applications
> > using sqlalchemy. However I need to look into the core of how Web2py
> > handles things to figure out the best way.
>
> > Sqlachemy allows you to put everything in:
> > 1) Transactions
> > 2) Sessions
>
> > So on submit you first create the parent record:
> > ad = Ad()
> > session.add(ad)
> > session.flush()
>
> > Now you have access to ad.id (parent id)
>
> > report = Report(...)
> > report.ad_id = ad.id
> > session.add(report)
>
> > Now if you used Sqlachemy relationships
> > ad.reports.append(report) # use this instead of report.ad_id = ad.id
> > session.flush()
>
> > Or in the case of having multiple children created before creating the
> > parent on a web form. You just submit all the form data at once and loop
> > through all reports.
>
> > ad = Ad(...)
> > session.add(ad)
> > session.flush()
>
> > get list of all reports in form submit
> > for report in reports:
> >   session.add(report)
> >   ad.reports.append(report)
> > session.flush()
>
> > If anything fails the transaction automatically roles everything back.
>
> > Or a easier solution is to only enable the children on edits. So you first
> > create the parent, then you can view/edit/delete children on the parent
> > edit page.
>
> > --
> > Regards,
> > Bruce
>
> > On Fri, Dec 23, 2011 at 10:00 AM, Cliff  wrote:
>
> >> Bruce, you are more brave than me ;)
>
> >> I always like to get the parent record committed in the database
> >> before adding child records.
>
> >> that way you know the ID of the parent record and it has the minimal
> >> required fieldset safely saved away.  If there's a session
> >> interruption you don't have some potential orphan child records
> >> floating around somewhere.
>
> >> If you've solved those kinds of concerns, please share it with us.
>
> >> Thanks,
> >> Cliff Kachinske
>
> >> On Dec 23, 10:34 am, DenesL  wrote:
> >> > On Dec 23, 10:11 am, Bruce Wade  wrote:
>
> >> > > Anyway which files should I start looking at to see how I can
> >> implement
> >> > > this functionality for myself and anyone else who wants it?
>
> >> > Look for controller appadmin under your or any other app folder.
>
> > --
> > --
> > Regards,
> > Bruce Wade
> >http://ca.linkedin.com/in/brucelwade
> >http://www.wadecybertech.com
> >http://www.warplydesigned.com
> >http://www.fitnessfriendsfinder.com


[web2py] Janrain auth not working

2011-12-23 Thread Chux
Just downloaded and installed web2py version 1.99.4 (2011-12-14 14:4614) ..

I created a new app, and Janrain auth was enabled as standard, but required 
creating a private/janrain.key file, and inserting the ID within .. Later 
had to add the domain upon seeing errors .. So, now in that file, I have:
domain:ID

I then try to login with my google-id and that seems to work, except I 
cannot get onto the application after authentication ..
I get an error message on the web browser that says:


Not Found

The requested URL /mytest/default/user/login was not found on this server.
==

I struggled with this for a while, before I realized the cause:
The nextpage after login was forwarding me to a URL based on the default 
http port of 80, and not the virtual hosted port of :81 I am using for 
web2py .. Changing the URL on the browser while the error was displayed to '
http://localhost:81/mytest/default/index' .. has solved the problem 

I reckon this should be changed so the webserver context being used for the 
app is maintained, else it may not be usable for production .. except only 
in cases where web2py is deployed on port-80 .. 


[web2py] Re: Janrain auth not working

2011-12-23 Thread Chux
This seems even more significant than I realized .. 

It seems after getting in by manually editing the URL, after janrain auth, 
I am unable to use the admin application .. it now claims, admin interface 
is disabled because password file was not found.

I have now disabled janrain by deleting the janran.key file .. and then 
restarting the web server (apache) .. still can't get into admin interface 
..
I have even regenerated the admin password .. still no change
cleared my web browser cache ,, and tried with firefox (was using chromium 
before) .. still no change.

In fact it appears as if using any port besides 80 for web2py deployment 
under apache using mod_wsgi is likely not to work well .. Please, can 
someone help me confirm this.

Thanks.



Re: [web2py] Web2Py on Kubuntu 11.10

2011-12-23 Thread Miroslav Gojic
This is very nice,
I was presently surprise when during setup my system when I discovered
package web2py.

Thanks for link, I will make update of my web2py...

Regards


- - Miroslav Gojic - -


2011/12/23 José Luis Redrejo Rodríguez 

>
>
> 2011/12/22 miroslavgojic 
>
>> Today I make installation of Kubuntu 11.10 on my VM.
>>
>> In packages I find Web2py and on one click it was instated
>>
>> After some  time (1 minute) my Web2py is started
>>
>> Thanks
>>
>> Miroslav
>
>
> Hi Miroslav,
> Ubuntu/Kubuntu packages are taken from Debian, but they're not updated
> very often. If your package is not the latest web2py version you can use
>  gdebi and install always the latest version from:
> http://packages.debian.org/sid/all/python-web2py/download
>
> Regards.
> José L.
>


Re: [web2py] Re: Janrain auth not working

2011-12-23 Thread Marin Pranjić
Do you have parameters_81.py file in web2py folder?

On Sat, Dec 24, 2011 at 5:01 AM, Chux  wrote:

> This seems even more significant than I realized ..
>
> It seems after getting in by manually editing the URL, after janrain auth,
> I am unable to use the admin application .. it now claims, admin interface
> is disabled because password file was not found.
>
> I have now disabled janrain by deleting the janran.key file .. and then
> restarting the web server (apache) .. still can't get into admin interface
> ..
> I have even regenerated the admin password .. still no change
> cleared my web browser cache ,, and tried with firefox (was using chromium
> before) .. still no change.
>
> In fact it appears as if using any port besides 80 for web2py deployment
> under apache using mod_wsgi is likely not to work well .. Please, can
> someone help me confirm this.
>
> Thanks.
>
>