[web2py] Re: no email field in auth_user

2015-02-18 Thread Annet


I had a similar issue, the problem was the validator on email:


requires =  is_unique_email

is_unique_email = [
IS_EMAIL(error_message=self.messages.invalid_email),
IS_NOT_IN_DB(db, '%s.email' % settings.table_user_name,
 error_message=self.messages.email_taken)]

redefining the validator might resolve the issue:

db2.auth_user.email.requires = 
IS_EMPTY_OR(IS_EMAIL(error_message=self.messages.invalid_email),
IS_NOT_IN_DB(db, '%s.email' % settings.table_user_name,
 error_message=self.messages.email_taken))

I guess the email field did not show up in the form?

In the admin interface ignore_rw = True so in those forms the emial field 
will show up even if you set
writable and readable to False


I hope this helps you resolve the issue.

Annet 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Problem with JSON

2015-02-18 Thread Ivan Gazzola
Ok, solved :)

The issue was in some changes in Jquery.

Now JQuery parses ajax response before than it is passed to success 
function, so js fails if I call "parse" on it:

risposta=JSON.parse(json);
  ^^^

THX

Ivan
Il giorno lunedì 16 febbraio 2015 21:12:17 UTC+1, Niphlod ha scritto:
>
> uhm. what does your shell print out of this ?
>
>
> response.json({'html' : XML('bar')})
>
>
>
> mine does
>
> u'{"html": "bar"}'
>
>
>
> so it's not the issue you're describing.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: IMPORTANT - WEB2PY CONSULTING

2015-02-18 Thread Francisco Costa
Some of the web2py content should be colaborative, maybe a wiki or a file 
in github so developers could provide changes

On Tuesday, 17 February 2015 01:21:32 UTC, Massimo Di Pierro wrote:
>
> We have always been listing companies that do web2py support. Eventually 
> we should have a certification program for consultants but that is another 
> story.
>
> On Monday, 16 February 2015 18:42:41 UTC-6, Ramkrishan Bhatt wrote:
>>
>> Massimo site is enough or we need to pass some test to get include 
>> officially. Or any legal formality we need to do to become official web2py 
>> cunsultant. 
>> I also request if you can classified with domain/industry/solutions 
>> expert.
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Facebook buttons and ajax

2015-02-18 Thread Gael Princivalle
So this part:

(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/it_IT/sdk.js#xfbml=1&version=v2.0
";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
 
Have to be placed in the .load file.
Yes I've tried also like that, taking off the same script from the layout 
file.
The result is the same, the Facebook script load only the first time.

As the Facebook sdk was always giving an ID error I've create an app ID in 
Facebook and now the new Facebook script is:

  window.fbAsyncInit = function() {
FB.init({
  appId  : 'mypappid',
  xfbml  : true,
  version: 'v2.2'
});
  };

  (function(d, s, id){
 var js, fjs = d.getElementsByTagName(s)[0];
 if (d.getElementById(id)) {return;}
 js = d.createElement(s); js.id = id;
 js.src = "//connect.facebook.net/it_IT/sdk.js";
 fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));


But problem still the same.
And as there's not a js error I don't know what to do.

An idea?

Il giorno martedì 17 febbraio 2015 17:58:37 UTC+1, Niphlod ha scritto:
>
> if you have a piece of script that *depends/works on/does something to* 
> on elements placed in the LOAD()ed component, you need to initialize the 
> "piece" inside the LOAD()ed fragment, not on the one containing it.
>
> On Tuesday, February 17, 2015 at 10:36:22 AM UTC+1, Gael Princivalle wrote:
>>
>> Hello all.
>>
>> I have in a web site a lateral menu with categories that change datas in 
>> a .load file, displayed in a div, with ajax.
>> Something like that:
>> A link in the lateral menu:
>> {{=A(category.name,callback=URL('prod','prod.load', vars=dict(category_id
>> =category.id), user_signature=True), target="div_prod")}}
>>
>> The div where I display the datas:
>> {{=LOAD('prod','prod.load', ajax=True, target='div_prod')}}
>>
>> It works fine.
>>
>> I've add Facebook button's Like and Share without problems in the layout 
>> like that:
>> At the beginning of the body:
>> 
>> (function(d, s, id) {
>>   var js, fjs = d.getElementsByTagName(s)[0];
>>   if (d.getElementById(id)) return;
>>   js = d.createElement(s); js.id = id;
>>   js.src = "//
>> connect.facebook.net/it_IT/sdk.js#xfbml=1&version=v2.0";
>>   fjs.parentNode.insertBefore(js, fjs);
>> }(document, 'script', 'facebook-jssdk'));
>>
>> At the end of the body:
>> {{if request.function != 'products':}}
>> 
>> 
>> > data-href="{{=URL(args=request.args, 
>> vars=request.vars, scheme=True, host=True)}}" data-layout="button_count" 
>> data-action="like" data-show-faces="true" data-share="true">
>> 
>> 
>> {{pass}}
>>
>> Now I would like to link these buttons to specific products.
>> I've put a test in the layout for not displaying the facebook buttons if 
>> the page is "products" .
>> So I would be able to add these buttons inside the .load file.
>>
>> The problem is that there are displayed (so processed by Facebook script) 
>> only when the complete page product.html is loaded.
>> If I stay on the products page changing datas in the .load file, buttons 
>> are not displayed.
>>
>> Someone have a solution or almost an explanation ?
>>
>> Thanks, regards.
>>
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] The best NoSQL? PostgreSQL

2015-02-18 Thread Michele Comitini
of course ;-)

http://www.linuxjournal.com/content/postgresql-nosql-database

mic

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] dynamic IS_DATE_IN_RANGE validator

2015-02-18 Thread Ovidio Marinho
Example:

v = *IS_DATE_IN_RANGE*(minimum=datetime.date(2008,1,1),
maximum=datetime.date(2009,12,31), format="%m/%d/%Y",error_message="oops")

   [image: http://itjp.net.br] 
http://itjp.net.b r
  *Ovidio Marinho Falcao Neto*
ovidio...@gmail.com
  Diretoria de Desenvolvimento
   João Pessoa- Paraiba
 Brasil
  Fone: +55(83) 8826-9088

2015-02-17 20:15 GMT-03:00 Francisco Costa :

> Is it possible to have a validator for dates in define_tables to end_date
> be bigger than start_date?
>
> db.define_table(
> 'events',
> Field('id', required=True, unique=True),
> Field('name', 'string', required=True),
> Field('start_date', 'date', required=True),
> Field('end_date', 'date', required=False),
> )
> db.events.start_date.requires = IS_DATE(format=T('%Y-%m-%d'),
> error_message=T('enter date as %(format)s'))
> db.events.end_date.requires = IS_EMPTY_OR(IS_DATE_IN_RANGE(format=T(
> '%Y-%m-%d'), minimum=*??*, maximum=None, error_message=T('enter date
> as %(format)s')))
>
>
> How do you define the *minimum* to be bigger than the start_date?
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: dynamic IS_DATE_IN_RANGE validator

2015-02-18 Thread Leonel Câmara
Hey,

You need to use onvalidation:

http://www.web2py.com/books/default/chapter/29/07/forms-and-validators#onvalidation

I guess you could also set the requires for db.events.end_date in the 
controller if you have request.vars.start_date but then you would have to 
validate start_date first too and it would get messy. I would use a simple 
IS_DATE validator for end_date and then would do the check on onvalidation.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: orderby field empty always in first place

2015-02-18 Thread Leonel Câmara
Example 2 query solution:


def events():
events = db(db.events.end_date == None).select()
events.records += db(db.events.end_date != None).select(orderby=~db.
events.end_date).records
return locals()



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] IPython Vim and Web2py shell

2015-02-18 Thread Thomas Bellembois
Hello,

Is there any way to attach vim with the vim-ipython plugin
(https://github.com/ivanov/vim-ipython) to an existing Web2py shell ?

I would like to be able to start my application in shell mode:
./web2py.py -a foo -S myapp -M

And then attach vim to this shell instance:
:IPython --existing kernel-12345.json
or
:IPython --existing --shell=12345

Thanks

Thomas

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Testing and web2py - especially appadmin

2015-02-18 Thread Richard Vézina
Hello Niphold,

What is the advantage of Behave over Lettuce or other (or why you choose
Behave)?

You didn't implement Unit test, is it because Vinicius already demonstrate
it or because other consideration?

Thanks

Richard



On Mon, Feb 16, 2015 at 5:00 PM, Niphlod  wrote:

> first to the party, latest to the thread.
>
> https://github.com/niphlod/welcome_augmented
>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: The best NoSQL? PostgreSQL

2015-02-18 Thread Willoughby
But even the author admits that's a lie :-)

"Fine, perhaps I'm exaggerating a bit here. PostgreSQL was and always will 
be relational and transactional, and adding these new data types hasn't 
changed that. "

On Wednesday, February 18, 2015 at 6:25:20 AM UTC-5, Michele Comitini wrote:
>
> of course ;-)
>
> http://www.linuxjournal.com/content/postgresql-nosql-database
>
> mic
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py][OT] HTTP/2 Finalized

2015-02-18 Thread Richard Vézina
http://tech.slashdot.org/story/15/02/18/1358230/http2-finalized

Richard

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: please help test binaries

2015-02-18 Thread Dave S
Enter code here...



On Friday, February 13, 2015 at 10:19:23 PM UTC-8, Massimo Di Pierro wrote:
>
> Can you please help us test the binaries?
>
> http://www.web2py.com/examples/static/nightly/web2py_win.zip
> http://www.web2py.com/examples/static/nightly/web2py_osx.zip
>
>
I also tested the Windows binary, on W7, by extracting onto the previous 
version.  Seems to run my simple app okay.

I get this version descriptor:

2.9.12-stable+timestamp.2015.02.17.18.04.32
(Running on Rocket 1.2.6, Python 2.7.9)
(from the admin app; you can't copy the string show by the "console panel" 
, where the activity display and the radio buttons are.)


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: orderby field empty always in first place

2015-02-18 Thread Dave S


On Wednesday, February 18, 2015 at 4:22:11 AM UTC-8, Leonel Câmara wrote:
>
> Example 2 query solution:
>
>
> def events():
> events = db(db.events.end_date == None).select()
> events.records += db(db.events.end_date != None).select(orderby=~db.
> events.end_date).records
> return locals()
>
>
>
Ah, clever!  I would have been returning two different events objects.. 
 (I'd also be inclined to use an orderby on the first query, on the 
start_date, but that's a minor detail.)

/dps
 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] How to copy and move a file from the admin interface?

2015-02-18 Thread François Delpierre
Hi,

>From the admin interface, it's easy to create a new file or to delete it, 
but how do I move one to an other folder, or just copy an existing one to a 
new file name?
This is one of the few operation I still need a shell on the server for.


Regards,

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: The best NoSQL? PostgreSQL

2015-02-18 Thread Michele Comitini
If you are interested this is more to the point, and from a postgresql guy:

https://wiki.postgresql.org/images/b/b4/Pg-as-nosql-pgday-fosdem-2013.pdf

even if it is fun to read, it's not a joke.

2015-02-18 16:10 GMT+01:00 Willoughby :

> But even the author admits that's a lie :-)
>
> "Fine, perhaps I'm exaggerating a bit here. PostgreSQL was and always
> will be relational and transactional, and adding these new data types
> hasn't changed that. "
>
>
> On Wednesday, February 18, 2015 at 6:25:20 AM UTC-5, Michele Comitini
> wrote:
>>
>> of course ;-)
>>
>> http://www.linuxjournal.com/content/postgresql-nosql-database
>>
>> mic
>>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: The best NoSQL? PostgreSQL

2015-02-18 Thread Richard Vézina
Nice reading,

Thanks Michele

Richard

On Wed, Feb 18, 2015 at 11:17 AM, Michele Comitini <
michele.comit...@gmail.com> wrote:

> If you are interested this is more to the point, and from a postgresql guy:
>
> https://wiki.postgresql.org/images/b/b4/Pg-as-nosql-pgday-fosdem-2013.pdf
>
> even if it is fun to read, it's not a joke.
>
> 2015-02-18 16:10 GMT+01:00 Willoughby :
>
>> But even the author admits that's a lie :-)
>>
>> "Fine, perhaps I'm exaggerating a bit here. PostgreSQL was and always
>> will be relational and transactional, and adding these new data types
>> hasn't changed that. "
>>
>>
>> On Wednesday, February 18, 2015 at 6:25:20 AM UTC-5, Michele Comitini
>> wrote:
>>>
>>> of course ;-)
>>>
>>> http://www.linuxjournal.com/content/postgresql-nosql-database
>>>
>>> mic
>>>
>>  --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] New Application Wizard trouble

2015-02-18 Thread Kelvin Nyota
I have just finished creating my new website with the New Application 
Wizard, but could not find the website i have created through 
http://www.web2py.com/demo_admin/wizard/index. I have checked everywhere on 
my documents, the place where in installed Web2py and extracted it, my 
desktop but could not find it. I also tried to check my email spam folder 
when i thought it was sent through the email i registered with on step 1 
after I finished the final step on step 5. Please help me get the website 
back because i don't feel like i have the expertise to do it from scratch.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py session error: ('NoneType' object is not callable)

2015-02-18 Thread Jason Lee
It did not solve the issue.


On Tuesday, February 17, 2015 at 8:50:15 AM UTC-5, Jason Lee wrote:
>
> I will attempt to try now.
>
> On Monday, February 16, 2015 at 12:37:22 AM UTC-5, Massimo Di Pierro wrote:
>>
>> can you check if the latest nightly build fixes the problem. Actually you 
>> do not have to replace all the code but only web2py/gluon/storage.py from 
>> the git repo.
>>
>> Does it solve the problem?
>>
>> On Sunday, 15 February 2015 17:55:27 UTC-6, Jason Lee wrote:
>>>
>>> I am storing the sessions in a mysql database called users.
>>>
>>> I dropped and created the users database again.  I still get the error.
>>>
>>>
>>>
>>> On Wednesday, February 11, 2015 at 11:12:18 AM UTC-5, Jason Lee wrote:

 I am storing the session data in a database.

 I am using the latest web2py.

 I have deleted everything, reinstalled fresh, deleted the database and 
 rebuilt it and I still get this error.

 The error occurs when I reboot the system.  I can fix it by restarting 
 apache2 service once the server has rebooted.


 I have a number of serverrs doing this.  It only started when I 
 upgraded.

 Error details;

 Traceback (most recent call last):
   File "/usr/share/www-data/web2py/gluon/main.py", line 435, in wsgibase
 session.connect(request, response)
   File "/usr/share/www-data/web2py/gluon/globals.py", line 934, in connect
 session_pickled = pickle.dumps(self, pickle.HIGHEST_PROTOCOL)
 TypeError: 'NoneType' object is not callable




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: DAL database adapter only validates datetime on read.

2015-02-18 Thread MDSIII
Controller:

def creategoodevent():
"""
create a record with a string for the datetime field that is formatted 
like isoformat() i.e. '%Y-%m-%d %H:%M:%S.%f'
"""
dt_str = request.now.isoformat(' ')
new_id = db.myevent.insert(name=dt_str,
dt=dt_str,
good='yes'
)
return new_id

def createbadevent():
"""
create a record with a string for the datetime field that is formatted 
like isoformat() i.e. '%Y-%m-%dT%H:%M:%S.%f'
"""
dt_str = request.now.isoformat()
new_id = db.myevent.insert(name=dt_str,
dt=dt_str,
good='no'
)
return new_id

def readbadevents():
"""
read the good events
"""
rows = db(db.myevent.good == 'no').select()
return dict(rows = rows)

def readgoodevents():
"""
read the good events
"""
rows = db(db.myevent.good == 'yes').select()
return dict(rows = rows)

Model:

db.define_table('myevent',
Field('name', 'string'),
Field('dt', 'datetime'),
Field('good', 'string')
)


On Sunday, February 15, 2015 at 12:40:46 PM UTC-8, Niphlod wrote:
>
> please show us your code (the one you're using for inserting the value), 
> and the model... so we can track down the anomaly
>
> On Friday, February 13, 2015 at 12:31:44 AM UTC+1, MDSIII wrote:
>>
>> I'm inserting a row with a value for a datetime type field such as 
>> '2015-02-12T14:43:52.113000'.
>>
>> The DAL lets me do the insert but errors in the adapter when I do a 
>> select that includes this row/column.
>>
>> I realize the string does not match the datetime.isoformat(' ') that the 
>> dbapi adapter expects on read but why doesn't it also do validation on 
>> write.
>>
>> I suspect the answer is to do my own type checking or leverage default 
>> SQLFORM validator?
>>
>> Thanks,
>> Max
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] can't type forward slash in editor

2015-02-18 Thread dangnearhere
Day 1 newbie. I feel I have entered a new wonderland of capabilities, and 
lucky to have found web2py, with all the noise being made about flask and 
django. Flask is all "now to do this you have to install that" and django's 
"awesome documentation" made me want to give up. Web2py on the other hand 
seems to be teaching itself, and the tutorial I'm watching is great. But 
one problem:

I typed this html correctly (see closing tags) but this is what shows up on 
the screen, and I can't save it because web2py knows it's wrong:

def hello():
return Hello World

Neither the forward slash on the main keyboard or the number pad works in 
the editor:
http://127.0.0.1:8000/admin/default/edit/app1/controllers/test.py?id=controllers__test__py

Tested the key, it works. The question mark works in general and on the 
editor, it types a forward slash anywhere else including the url bar of the 
same page. I have never encountered this anywhere before.

I made a different test file in controllers and also a test file in view, 
no forward slash is possible in either editor.

Nothing wrong with this keyboard: 


Thanks.

Scott

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Google Appengine Geo Headers

2015-02-18 Thread Sébastien Loix
Hi Niphlod,

I haven't been able to try in another application, this is my first app on 
Google Engine.
I just printed the request.env to see if the X-AppEngine-CityLatLong' 
header was in it and didn't see it.

So you're saying that it is something I should check on GAE side then?

thanks for your help.

El martes, 17 de febrero de 2015, 21:56:58 (UTC+1), Niphlod escribió:
>
> web2py doesn't discard any header all of them are exactly as they are 
> passed to the wsgi adapter and are in request.env   ... are you able to 
> extract that header in any other wsgi application (web2py or not ) ?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Reuse code in multiple views

2015-02-18 Thread Moiz Nagpurwala
Thanks Leonel for the reply.

Putting the repeating code in a separate html file and including that file 
in appropriate places worked for me.

Thanks a lot.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] web2py Scheduler with Postgres creates "idle in transaction" connections

2015-02-18 Thread stingpan
web2py version: 2.9.12-stable
Postgres server: 9.1

I have 3 databases for my application, only one is designated for Scheduler 
and its tables. What I noticed is that when I start scheduler (using 
upstart deployment and running "start web2py-scheduler" as root), all 3 
databases are immediately connected to. These connections become "idle in 
transaction" (using ps aux | grep postgres)  which sometimes causes locking 
problems when I attempt make changes to the databases (either through the 
app or executing a script).  I'm assuming that Scheduler makes these kinds 
of connections so we can use DAL when defining the task functions. However 
the tasks I have set up for Scheduler calls a standalone script that does 
not rely on web2py or DAL and uses pyscopg2 to access/modify the other 2 
databases. Is there a way I can have Scheduler run without holding up the 
other 2 databases? 

Here's a snippet of my Scheduler set up:

from gluon.scheduler import Scheduler

scheduler_db = DAL(config.get('connection'), pool_size=10, migrate=False)

scheduler = Scheduler(
scheduler_db,
heartbeat = 5,
migrate = '',
tasks = dict(
taskA = taskA,
taskB = taskB
)
)


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] (foreign key constraint failed)

2015-02-18 Thread Smruti Prakash Mohanty
Hi

I am using the web2py default auth table for user registration.

I am having an additional table defined as such:

db.define_table('nsksystem',
Field('email_id', db.auth_user,length=512, label = 'Email 
ID'),
Field('nskname', length=128, default='', label = 'Machine 
Name'),
Field('nskpassword', 'password', length=512,readable=False, 
label='Machine Password'),
Field('confirmnskpassword', 'password', 
length=512,readable=False, label='Confirm Machine Password'),
Field('nreleaseid',length=128, default='',label = 
'Release'),
Field('isCordinator','boolean',default='', label = 'Is 
Co-ordinator'))


db.nsksystem.email_id.requires = 
IS_NOT_EMPTY(error_message=auth.messages.is_empty)
db.nsksystem.email_id.requires = IS_IN_DB(db,'auth_user.email','%(email)s')
db.nsksystem.nreleaseid.requires = 
IS_NOT_EMPTY(error_message=auth.messages.is_empty)
db.nsksystem.nskname.requires = 
IS_NOT_EMPTY(error_message=auth.messages.is_empty)
db.nsksystem.confirmnskpassword.requires = IS_EXPR('value==%s' % 
repr(request.vars.get('nskpassword', None)),error_message='Passwords do not 
match')
db.nsksystem.isCordinator.requires=IS_NOT_IN_DB(db(db.nsksystem.nreleaseid 
== request.vars.nreleaseid), 'nsksystem.isCordinator', 
error_message='Co-ordinator Already exist for specified release')

In my Controller:

def uregistration(): ##---> For my user registration
form=SQLFORM(db.auth_user)
if form.process().accepted:
response.flash = 'User is registered. Redirecting to machine 
registration'
redirect(URL('mregistration')) #-> After registration it goes 
to another page for machine registration.
elif form.errors:
response.flash = 'Form has errors'
else:
response.flash = 'Please fill out the form'
return dict(form=form)


def mregistration():  ##---> for machine registration page
form=SQLFORM(db.nsksystem) 
if form.process().accepted:
response.flash = 'Machine is registered to user. Please go to Login 
page.'
redirect(URL('index'))
elif form.errors:
response.flash = 'Form has errors'
else:
response.flash = 'Please fill out the form'
return dict(form=form)

Now after I have registered the user, i am being redirected to Machine 
registration page. After i enter all the details in Machine registration 
page I get this error:

Traceback (most recent call last):
  File "gluon/restricted.py", line 224, in restricted
  File "C:/web2py/applications/click/controllers/default.py" 
, line 
63, in 
  File "gluon/globals.py", line 393, in 
  File "C:/web2py/applications/click/controllers/default.py" 
, line 
30, in mregistration
if form.process().accepted:
  File "gluon/html.py", line 2303, in process
  File "gluon/html.py", line 2240, in validate
  File "gluon/sqlhtml.py", line 1677, in accepts
  File "gluon/dal/objects.py", line 724, in insert
  File "gluon/dal/adapters/base.py", line 715, in insert
IntegrityError: foreign key constraint failed

Error snapshot  (foreign key constraint failed) 
 
  Function argument list
  
(self=, 
table=,
 fields=[(, '123456'), 
(, 'vodka.ind.codefactory.com'), 
(, 0), 
(, True), 
(, 'AAA'), 
(, '123456')])


I wonder why i dont see the email address that i select in the machine 
registration page. (, 0) in the Function 
argument list refers to email id or only ID.

I am confused. Unfortunately i cant turn the constraint validation off as it is 
a requirement.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] if form.process().accepted: workings

2015-02-18 Thread Annet
I' ve got the following function:

def lander_form():
nodeID = get_ID(auth, session)

folder = 'nodeID' + str(nodeID)
db.lnd_page.image.uploadfolder = 
os.path.join(request.env.applications_parent, 'applications',
  'dbmodel', 'static', 
'uploads', folder)
db.lnd_page.width.requires = IS_EMPTY_OR(IS_INT_IN_RANGE(0,501, 
error_message='maxWidth is 500 pixels'))

 record = db.lnd_page(nodeID=nodeID, id=request.args(1, cast=int))
 
form = SQLFORM(db.lnd_page, record, deletable=True, showid=False,
   formstyle=bootstrap3, hidden=dict(nodeID=nodeID),
   upload=URL('dbmodel', 'static/uploads', folder, 
args=request.vars.image))

if hasattr(request.vars.image, 'filename'):
form.vars.imageFilename = request.vars.image.filename

if form.process().accepted:
if record and form.vars.image__delete:
file = record.image

os.remove(os.path.join(request.env.applications_parent,'applications',
   'dbmodel', 'static', 'uploads', 
folder, file))
record.update_record(image=None, imageFileName=None)
x_flash(session, None, 'success', 'success')
redirect(rdrctUrl)
elif form.errors:
x_flash(response, None, 'danger', 'error')
else:
x_flash(response, None, 'info', 'default')

return locals()

Since checking the form.vars.image__delete and submitting the form did not
remove the image file, I wrote the code after: if form.process().accepted:
It does exactly what I intended, however, I don't understand why :-(

Why do I stille have access to record and form after: if 
form.process().accepted:


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: IMPORTANT - WEB2PY CONSULTING

2015-02-18 Thread Leonel Câmara
Hey Massimo,

Please add us:

Company: I Am Consultoria
Incorporated: Portugal
website: http://i-am.pt

Mention to web2py can be seen here:
http://i-am.pt/gallery-whatwedo.html

We will be updating our website (for some reason this keeps being delayed 
by other projects) but the design is decent enough I think.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: please help test binaries

2015-02-18 Thread Dave S


On Wednesday, February 18, 2015 at 7:58:36 AM UTC-8, Dave S wrote:
>
> Enter code here...
>
>
>
> On Friday, February 13, 2015 at 10:19:23 PM UTC-8, Massimo Di Pierro wrote:
>>
>> Can you please help us test the binaries?
>>
>> http://www.web2py.com/examples/static/nightly/web2py_win.zip
>> http://www.web2py.com/examples/static/nightly/web2py_osx.zip
>>
>>
> I also tested the Windows binary, on W7, by extracting onto the previous 
> version.  Seems to run my simple app okay.
>
> I get this version descriptor:
>
> 2.9.12-stable+timestamp.2015.02.17.18.04.32
> (Running on Rocket 1.2.6, Python 2.7.9)
> (from the admin app; you can't copy the string show by the "console panel" 
> , where the activity display and the radio buttons are.)
>
>
>
Further testing by downloading to a fresh machine, also W7, unzipping (to 
the H: drive instead of C:), and using appadmin to install a pack of the 
same silly app.  Version code is now

2.9.12-stable+timestamp.2015.02.18.17.09.53
(Running on Rocket 1.2.6, Python 2.7.9)


/dps

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: no email field in auth_user

2015-02-18 Thread José Eloy
Thanks guys for your answers:

I'm using a standard SQLFORM to create my form:

form = SQLFORM(db2.auth_user, submit_button="Aceptar", deletable=True, 
showid=False, formstyle='divs', _id='form_administrador')

Where is the problem?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: if form.process().accepted: workings

2015-02-18 Thread Niphlod
what are you expecting precisely ? if the problem is that upon record 
deletion the corresponding file in the uploads folder is not deleted, mind 
that it's a standard behaviour unless in the field you specify 
autodelete=True

On Wednesday, February 18, 2015 at 7:41:05 PM UTC+1, Annet wrote:
>
> I' ve got the following function:
>
> def lander_form():
> nodeID = get_ID(auth, session)
>
> folder = 'nodeID' + str(nodeID)
> db.lnd_page.image.uploadfolder = 
> os.path.join(request.env.applications_parent, 'applications',
>   'dbmodel', 'static', 
> 'uploads', folder)
> db.lnd_page.width.requires = IS_EMPTY_OR(IS_INT_IN_RANGE(0,501, 
> error_message='maxWidth is 500 pixels'))
>
>  record = db.lnd_page(nodeID=nodeID, id=request.args(1, cast=int))
>  
> form = SQLFORM(db.lnd_page, record, deletable=True, showid=False,
>formstyle=bootstrap3, hidden=dict(nodeID=nodeID),
>upload=URL('dbmodel', 'static/uploads', folder, 
> args=request.vars.image))
>
> if hasattr(request.vars.image, 'filename'):
> form.vars.imageFilename = request.vars.image.filename
>
> if form.process().accepted:
> if record and form.vars.image__delete:
> file = record.image
> 
> os.remove(os.path.join(request.env.applications_parent,'applications',
>'dbmodel', 'static', 'uploads', 
> folder, file))
> record.update_record(image=None, imageFileName=None)
> x_flash(session, None, 'success', 'success')
> redirect(rdrctUrl)
> elif form.errors:
> x_flash(response, None, 'danger', 'error')
> else:
> x_flash(response, None, 'info', 'default')
>
> return locals()
>
> Since checking the form.vars.image__delete and submitting the form did not
> remove the image file, I wrote the code after: if form.process().accepted:
> It does exactly what I intended, however, I don't understand why :-(
>
> Why do I stille have access to record and form after: if 
> form.process().accepted:
>
>
> Kind regards,
>
> Annet
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Google Appengine Geo Headers

2015-02-18 Thread Niphlod
maybe it's just GAE not inserting that header because you're developing on 
your local machine.

On Wednesday, February 18, 2015 at 3:52:59 PM UTC+1, Sébastien Loix wrote:
>
> Hi Niphlod,
>
> I haven't been able to try in another application, this is my first app on 
> Google Engine.
> I just printed the request.env to see if the X-AppEngine-CityLatLong' 
> header was in it and didn't see it.
>
> So you're saying that it is something I should check on GAE side then?
>
> thanks for your help.
>
> El martes, 17 de febrero de 2015, 21:56:58 (UTC+1), Niphlod escribió:
>>
>> web2py doesn't discard any header all of them are exactly as they are 
>> passed to the wsgi adapter and are in request.env   ... are you able to 
>> extract that header in any other wsgi application (web2py or not ) ?
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Testing and web2py - especially appadmin

2015-02-18 Thread Niphlod
the idea behind the project was to have BDD done. Vinicius was covering 
already unittesting. IMHO web applications (or, at least, the ones I code) 
rely on too many pieces you can't test without a live browser. Once that 
concept sinks in, you'll quickly realize that unittesting is too limited 
when coupled with a real browser, hence BDD. 
Behave is just one library, and IMHO is more usable than Lettuce (or was at 
the time at least), but given it is/was a project from scratch, it's not an 
hard requirement, more of a personal choice.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Facebook buttons and ajax

2015-02-18 Thread Niphlod
I don't know how the fb script works. The point is that if it works on an 
element that is present on the page AFTER being LOAD()ed, at the time you 
run the script on the "container" the LOAD()ed piece is likely not to be 
there already. 

On Wednesday, February 18, 2015 at 11:26:08 AM UTC+1, Gael Princivalle 
wrote:
>
> So this part:
> 
> (function(d, s, id) {
>   var js, fjs = d.getElementsByTagName(s)[0];
>   if (d.getElementById(id)) return;
>   js = d.createElement(s); js.id = id;
>   js.src = "//
> connect.facebook.net/it_IT/sdk.js#xfbml=1&version=v2.0";
>   fjs.parentNode.insertBefore(js, fjs);
> }(document, 'script', 'facebook-jssdk'));
>  
> Have to be placed in the .load file.
> Yes I've tried also like that, taking off the same script from the layout 
> file.
> The result is the same, the Facebook script load only the first time.
>
> As the Facebook sdk was always giving an ID error I've create an app ID in 
> Facebook and now the new Facebook script is:
> 
>   window.fbAsyncInit = function() {
> FB.init({
>   appId  : 'mypappid',
>   xfbml  : true,
>   version: 'v2.2'
> });
>   };
>
>   (function(d, s, id){
>  var js, fjs = d.getElementsByTagName(s)[0];
>  if (d.getElementById(id)) {return;}
>  js = d.createElement(s); js.id = id;
>  js.src = "//connect.facebook.net/it_IT/sdk.js";
>  fjs.parentNode.insertBefore(js, fjs);
>}(document, 'script', 'facebook-jssdk'));
> 
>
> But problem still the same.
> And as there's not a js error I don't know what to do.
>
> An idea?
>
> Il giorno martedì 17 febbraio 2015 17:58:37 UTC+1, Niphlod ha scritto:
>>
>> if you have a piece of script that *depends/works on/does something to* 
>> on elements placed in the LOAD()ed component, you need to initialize the 
>> "piece" inside the LOAD()ed fragment, not on the one containing it.
>>
>> On Tuesday, February 17, 2015 at 10:36:22 AM UTC+1, Gael Princivalle 
>> wrote:
>>>
>>> Hello all.
>>>
>>> I have in a web site a lateral menu with categories that change datas in 
>>> a .load file, displayed in a div, with ajax.
>>> Something like that:
>>> A link in the lateral menu:
>>> {{=A(category.name,callback=URL('prod','prod.load', vars=dict(
>>> category_id=category.id), user_signature=True), target="div_prod")}}
>>>
>>> The div where I display the datas:
>>> {{=LOAD('prod','prod.load', ajax=True, target='div_prod')}}
>>>
>>> It works fine.
>>>
>>> I've add Facebook button's Like and Share without problems in the layout 
>>> like that:
>>> At the beginning of the body:
>>> 
>>> (function(d, s, id) {
>>>   var js, fjs = d.getElementsByTagName(s)[0];
>>>   if (d.getElementById(id)) return;
>>>   js = d.createElement(s); js.id = id;
>>>   js.src = "//
>>> connect.facebook.net/it_IT/sdk.js#xfbml=1&version=v2.0";
>>>   fjs.parentNode.insertBefore(js, fjs);
>>> }(document, 'script', 'facebook-jssdk'));
>>>
>>> At the end of the body:
>>> {{if request.function != 'products':}}
>>> 
>>> 
>>> >> data-href="{{=URL(args=request.args, 
>>> vars=request.vars, scheme=True, host=True)}}" data-layout="button_count" 
>>> data-action="like" data-show-faces="true" data-share="true">
>>> 
>>> 
>>> {{pass}}
>>>
>>> Now I would like to link these buttons to specific products.
>>> I've put a test in the layout for not displaying the facebook buttons if 
>>> the page is "products" .
>>> So I would be able to add these buttons inside the .load file.
>>>
>>> The problem is that there are displayed (so processed by Facebook 
>>> script) only when the complete page product.html is loaded.
>>> If I stay on the products page changing datas in the .load file, buttons 
>>> are not displayed.
>>>
>>> Someone have a solution or almost an explanation ?
>>>
>>> Thanks, regards.
>>>
>>>
>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: (foreign key constraint failed)

2015-02-18 Thread Niphlod
a little bit of wording around "unfortunately I can't turn off"

it's not that having constraints in place is limiting your app. It's 
because something REAALLY wrong with your application that that error pops 
up (and it'll pop up with any other backend). I'd be more inclined to say 
"thanks a lot web2py, I can't turn it off, or else, I'm going to be really 
screwed once I put this on production".

Back on topic

Field('email_id', db.auth_user,length=512, label = 'Email ID')

this is a FK to the field *id* of the table *auth_user*. length doesn't 
obviously go there (as it's an integer) and the validation you're imposing 
is totally wrong

db.nsksystem.email_id.requires = IS_IN_DB(db,'auth_user.email','%(email)s') 

Are you sure you planned your model the way you're supposed to use it ? 
IMHO you're expecting that field to contain an email, not an id.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Problem with JSON

2015-02-18 Thread Niphlod
to be fair, I think you encountered a minor glitch response.json() 
now sets the content-type to application/json (something that your app 
should have done already, but probably overlooked).
Returning a json string with text/html as content-type made jquery not 
aware that that string was a json, but only a string in the need to be 
parsed.
Moreover, JSON(something) is NOT a jquery function, it's a browser one, and 
not available on all browsers. That piece of code would never have worked 
on e.g. IE7. 
Now the response is instead a json string "signalled" to be a json object, 
and jquery parses it correctly

 for the future...Don't EVER overlook content-type. Read about 
"dataType" on jquery's ajax(). 


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: New Application Wizard trouble

2015-02-18 Thread Dave S


On Tuesday, February 17, 2015 at 12:11:47 PM UTC-8, Kelvin Nyota wrote:
>
> I have just finished creating my new website with the New Application 
> Wizard, but could not find the website i have created through 
> http://www.web2py.com/demo_admin/wizard/index. I have checked everywhere 
> on my documents, the place where in installed Web2py and extracted it, my 
> desktop but could not find it. I also tried to check my email spam folder 
> when i thought it was sent through the email i registered with on step 1 
> after I finished the final step on step 5. Please help me get the website 
> back because i don't feel like i have the expertise to do it from scratch.
>

Okay, what did you do?   Did you visit 
http://www.web2py.com/demo_admin/default/site>, and click on a 
"Manage" button?  And when that expanded, did you select "Pack all" or 
"Pack Custom"?  If you did, you should find a file named something like 
"web2py.app.demo_app1.w2p" in your Downloads directory.  You can then bring 
up the Appadmin page for you local copy of Web2Py, and use the "Upload and 
install packed application" form to install that file in your own 
environment.

Good luck!

/dps

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: DAL database adapter only validates datetime on read.

2015-02-18 Thread Niphlod
that's pretty much expected: the general rule is that if you want your 
fields validated at insert level, you shouldn't use insert() but 
validate_and_insert().
this, however, it's only an issue with SQLite (mainly) because it doesn't 
have a native datetime field, so it doesn't complain even if you try to 
insert in it a string value, as 'foobar'. other backends (with native 
support) will happily reject the insert because they do their own 
validation .


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py Scheduler with Postgres creates "idle in transaction" connections

2015-02-18 Thread Niphlod
uhm, the problem is more subtle. 

The main process of the scheduler is like a shell opened on that 
application... it needs to reads models to see the scheduler 
definition. I guess that this means that it will also connect to all the 
databases defined in models, even if it will effectively send/receive 
commands only on the scheduler_db. 
Those "additional" connections are not needed as a matter of fact, but 
shouldn't block anything too: they're idle and never used.

Every spawned process (the one that will process the task) needs to execute 
models, else your task won't be able to access, e.g. "db", and, to be fair, 
they won't be able to "see" the tasks definitions in the first place. Those 
connections are used, but the connections are kept open just for the time 
the task gets processed (the spawned process dies as soon as the task 
finishes). 

Let me check if there is a workaround for the  connections on the main 
process. I'll get back to you (at most in a few days)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Return object from represent method of field

2015-02-18 Thread Dave S


On Tuesday, February 17, 2015 at 6:31:26 PM UTC-8, Leonardo Pires Felix 
wrote:
>
> Also, there is a way to represent two types, text and html?
>
> For example, if i want to make a tooltip of a date fiel, to make things 
> clean and easy for the user, I would do:
>
>
> 
>
> That is a the return of the represent field:
> dt_str = valor.strftime("%d/%m/%Y")
> return SPAN(dt_str, **{'_data-toggle': "tooltip",
>'_data-placement': "top",
>'_title': valor.strftime("%A").title()})
>
> But if i try to export that. I'll get the html on the export file.
>
There is a way to separate the HTML of the text that will be represented in 
> export? Like a represent_html and represent_text?
>


SPAN() let's you wrap stuff with XML(), as do most helpers.
http://www.web2py.com/books/default/chapter/29/05/the-views#SPAN>
I don't fully grok your arguments SPAN() above, but I suspect XML() is what 
you're looking for.

(the usual named arguments that SPAN() accepts, like _style, are as far as 
my mind has expanded)

/dps


/dps
 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: can't type forward slash in editor

2015-02-18 Thread Dave S


On Wednesday, February 18, 2015 at 7:56:04 AM UTC-8, dangne...@juno.com 
wrote:
>
> Day 1 newbie. I feel I have entered a new wonderland of capabilities, and 
> lucky to have found web2py, with all the noise being made about flask and 
> django. Flask is all "now to do this you have to install that" and django's 
> "awesome documentation" made me want to give up. Web2py on the other hand 
> seems to be teaching itself, and the tutorial I'm watching is great. But 
> one problem:
>
> I typed this html correctly (see closing tags) but this is what shows up 
> on the screen, and I can't save it because web2py knows it's wrong:
>
> def hello():
> return Hello World
>
> Neither the forward slash on the main keyboard or the number pad works in 
> the editor:
>

Not sure if this is what's zapping you, but the web2py "ide" editor likes 
to provide close tags as soon as you've entered the open tag.  You could 
have a close tag for BODY and HTML sitting there when you try to type your 
own close tag.

My vague memory of something I did last week says "it will let you", but 
maybe not.

You can, of course, edit the file outside of the "ide" editor; I often use 
emacs on a linux system.  Notepad on Windows isn't so good (doesn't 
understand linux line endings), but I think Wordpad works, and certainly 
NoteTab Light.

Good luck!

/dps

 

>
> http://127.0.0.1:8000/admin/default/edit/app1/controllers/test.py?id=controllers__test__py
>
> Tested the key, it works. The question mark works in general and on the 
> editor, it types a forward slash anywhere else including the url bar of the 
> same page. I have never encountered this anywhere before.
>
> I made a different test file in controllers and also a test file in view, 
> no forward slash is possible in either editor.
>
> Nothing wrong with this keyboard: 
> 
>
> Thanks.
>
> Scott
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py Scheduler with Postgres creates "idle in transaction" connections

2015-02-18 Thread Niphlod
uhm^3. The code is quite unfixable as it is (launching scheduler with 
web2py.py -K appname). Remember that the only thing I'm trying to fix is 
the main process using idle connections to all databases defined in the 
models of you app.

However, there's a small unknown trick: the scheduler can be started on its 
own, and process happily tasks defined in applications, as long as 
they are reachable from within the path you're launching it.
The former translates to: if you are on the same path web2py is in, you can 
use another commandline to launch the scheduler, whose main process will 
only be aware of the "db_sched" connection.
Small fixes are needed to make the "unknown trick" work again (up until now 
the "trick" hasn't been tested much) but the working file is here 
 .

You should start as

cd web2py # <<-- path where web2py.py is
python gluon/scheduler.py -u *uri_of_the_db* -f *folder* -L 0 -b 2


where:
- *uri_of_the_db* is the database uri (i.e. *postgresql://.*, mind that 
for sqlite, you should pass the entire relative path, as in 
*sqlite:///applications/appname/databases/storage.sqlite*)
- *folder* is the relative folder where the database tables are (i.e. 
*applications/appname/databases/* )
- the number after -L is the logging level (0 all, 100 nothing)
- the number after -b is the heartbeat in seconds

Please try it and see if the idle connections are still there or not.



On Wednesday, February 18, 2015 at 10:04:45 PM UTC+1, Niphlod wrote:
>
> uhm, the problem is more subtle. 
>
> The main process of the scheduler is like a shell opened on that 
> application... it needs to reads models to see the scheduler 
> definition. I guess that this means that it will also connect to all the 
> databases defined in models, even if it will effectively send/receive 
> commands only on the scheduler_db. 
> Those "additional" connections are not needed as a matter of fact, but 
> shouldn't block anything too: they're idle and never used.
>
> Every spawned process (the one that will process the task) needs to 
> execute models, else your task won't be able to access, e.g. "db", and, to 
> be fair, they won't be able to "see" the tasks definitions in the first 
> place. Those connections are used, but the connections are kept open just 
> for the time the task gets processed (the spawned process dies as soon as 
> the task finishes). 
>
> Let me check if there is a workaround for the  connections on the main 
> process. I'll get back to you (at most in a few days)
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: How to copy and move a file from the admin interface?

2015-02-18 Thread Dave S


On Wednesday, February 18, 2015 at 8:12:45 AM UTC-8, François Delpierre 
wrote:
>
> Hi,
>
> From the admin interface, it's easy to create a new file or to delete it, 
> but how do I move one to an other folder, or just copy an existing one to a 
> new file name?
> This is one of the few operation I still need a shell on the server for.
>
>
Shooting from the hip, there's opening 2 editor windows and cuttenpaiste 
the file contents.  You are right that there doesn't seem to be an "ide" 
link or button for the job.

(I took a quick look at the "design" page (from the "Edit" menu), then went 
to lunch before finishing this.  Sorry for the chimmachurri stains.)

/dps


 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: (foreign key constraint failed)

2015-02-18 Thread Anthony
Did this solve your problem?

On Wednesday, February 18, 2015 at 5:07:02 AM UTC-5, Smruti Prakash Mohanty 
wrote:
>
> Hi
>
> I am using the web2py default auth table for user registration.
>
> I am having an additional table defined as such:
>
> db.define_table('nsksystem',
> Field('email_id', db.auth_user,length=512, label = 'Email 
> ID'),
> Field('nskname', length=128, default='', label = 'Machine 
> Name'),
> Field('nskpassword', 'password', 
> length=512,readable=False, label='Machine Password'),
> Field('confirmnskpassword', 'password', 
> length=512,readable=False, label='Confirm Machine Password'),
> Field('nreleaseid',length=128, default='',label = 
> 'Release'),
> Field('isCordinator','boolean',default='', label = 'Is 
> Co-ordinator'))
>
>
> db.nsksystem.email_id.requires = 
> IS_NOT_EMPTY(error_message=auth.messages.is_empty)
> db.nsksystem.email_id.requires = IS_IN_DB(db,'auth_user.email','%(email)s')
> db.nsksystem.nreleaseid.requires = 
> IS_NOT_EMPTY(error_message=auth.messages.is_empty)
> db.nsksystem.nskname.requires = 
> IS_NOT_EMPTY(error_message=auth.messages.is_empty)
> db.nsksystem.confirmnskpassword.requires = IS_EXPR('value==%s' % 
> repr(request.vars.get('nskpassword', None)),error_message='Passwords do not 
> match')
> db.nsksystem.isCordinator.requires=IS_NOT_IN_DB(db(db.nsksystem.nreleaseid 
> == request.vars.nreleaseid), 'nsksystem.isCordinator', 
> error_message='Co-ordinator Already exist for specified release')
>
> In my Controller:
>
> def uregistration(): ##---> For my user registration
> form=SQLFORM(db.auth_user)
> if form.process().accepted:
> response.flash = 'User is registered. Redirecting to machine 
> registration'
> redirect(URL('mregistration')) #-> After registration it goes 
> to another page for machine registration.
> elif form.errors:
> response.flash = 'Form has errors'
> else:
> response.flash = 'Please fill out the form'
> return dict(form=form)
>
>
> def mregistration():  ##---> for machine registration page
> form=SQLFORM(db.nsksystem) 
> if form.process().accepted:
> response.flash = 'Machine is registered to user. Please go to 
> Login page.'
> redirect(URL('index'))
> elif form.errors:
> response.flash = 'Form has errors'
> else:
> response.flash = 'Please fill out the form'
> return dict(form=form)
>
> Now after I have registered the user, i am being redirected to Machine 
> registration page. After i enter all the details in Machine registration 
> page I get this error:
>
> Traceback (most recent call last):
>   File "gluon/restricted.py", line 224, in restricted
>   File "C:/web2py/applications/click/controllers/default.py" 
> , line 
> 63, in 
>   File "gluon/globals.py", line 393, in 
>   File "C:/web2py/applications/click/controllers/default.py" 
> , line 
> 30, in mregistration
> if form.process().accepted:
>   File "gluon/html.py", line 2303, in process
>   File "gluon/html.py", line 2240, in validate
>   File "gluon/sqlhtml.py", line 1677, in accepts
>   File "gluon/dal/objects.py", line 724, in insert
>   File "gluon/dal/adapters/base.py", line 715, in insert
> IntegrityError: foreign key constraint failed
>
> Error snapshot  (foreign key constraint 
> failed)  
>   Function argument list
>   
> (self=, 
> table= (id,email_id,nskname,nskpassword,confirmnskpassword,nreleaseid,isCordinator)>,
>  fields=[(, '123456'), 
> (, 'vodka.ind.codefactory.com'), 
> (, 0), 
> (, True), 
> (, 'AAA'), 
> (, '123456')])
>
>
> I wonder why i dont see the email address that i select in the machine 
> registration page. (, 0) in the Function 
> argument list refers to email id or only ID.
>
> I am confused. Unfortunately i cant turn the constraint validation off as it 
> is a requirement.
> 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: no email field in auth_user

2015-02-18 Thread Anthony
I cannot reproduce the problem -- if I set the readable and writable 
attributes of the email field to False, I get no email field in any form 
based on db.auth_user, and I am able to submit new records. There must be 
some additional code somewhere you haven't shown that is resetting those 
attributes.

Anthony

On Wednesday, February 18, 2015 at 3:01:46 PM UTC-5, José Eloy wrote:
>
> Thanks guys for your answers.
>
> I'm using a standard SQLFORM to create my form:
>
> form = SQLFORM(db2.auth_user, submit_button="Aceptar", 
> formstyle='divs', _id='form_administrador')
>
> Where is the problem?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: if form.process().accepted: workings

2015-02-18 Thread Anthony


> Since checking the form.vars.image__delete and submitting the form did not
> remove the image file, I wrote the code after: if form.process().accepted:
> It does exactly what I intended, however, I don't understand why :-(
>
> Why do I stille have access to record and form after: if 
> form.process().accepted:
>

What exactly is confusing? Are you not expecting to be able to do anything 
with the "record" object after calling form.process()? If so, why?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: web2py Scheduler with Postgres creates "idle in transaction" connections

2015-02-18 Thread Michele Comitini
idle connection are one thing and they can be fine.
idle in transaction, usually happens when there is a missing commit and the
transaction stays open, delivering all sorts of locking over the long term
usually a commit or rollback before the fork should solve the problem.

2015-02-18 23:09 GMT+01:00 Niphlod :

> uhm^3. The code is quite unfixable as it is (launching scheduler with
> web2py.py -K appname). Remember that the only thing I'm trying to fix is
> the main process using idle connections to all databases defined in the
> models of you app.
>
> However, there's a small unknown trick: the scheduler can be started on
> its own, and process happily tasks defined in applications, as long as
> they are reachable from within the path you're launching it.
> The former translates to: if you are on the same path web2py is in, you
> can use another commandline to launch the scheduler, whose main process
> will only be aware of the "db_sched" connection.
> Small fixes are needed to make the "unknown trick" work again (up until
> now the "trick" hasn't been tested much) but the working file is here
>  .
>
> You should start as
>
> cd web2py # <<-- path where web2py.py is
> python gluon/scheduler.py -u *uri_of_the_db* -f *folder* -L 0 -b 2
>
>
> where:
> - *uri_of_the_db* is the database uri (i.e. *postgresql://.*, mind
> that for sqlite, you should pass the entire relative path, as in
> *sqlite:///applications/appname/databases/storage.sqlite*)
> - *folder* is the relative folder where the database tables are (i.e.
> *applications/appname/databases/* )
> - the number after -L is the logging level (0 all, 100 nothing)
> - the number after -b is the heartbeat in seconds
>
> Please try it and see if the idle connections are still there or not.
>
>
>
>
> On Wednesday, February 18, 2015 at 10:04:45 PM UTC+1, Niphlod wrote:
>>
>> uhm, the problem is more subtle.
>>
>> The main process of the scheduler is like a shell opened on that
>> application... it needs to reads models to see the scheduler
>> definition. I guess that this means that it will also connect to all the
>> databases defined in models, even if it will effectively send/receive
>> commands only on the scheduler_db.
>> Those "additional" connections are not needed as a matter of fact, but
>> shouldn't block anything too: they're idle and never used.
>>
>> Every spawned process (the one that will process the task) needs to
>> execute models, else your task won't be able to access, e.g. "db", and, to
>> be fair, they won't be able to "see" the tasks definitions in the first
>> place. Those connections are used, but the connections are kept open just
>> for the time the task gets processed (the spawned process dies as soon as
>> the task finishes).
>>
>> Let me check if there is a workaround for the  connections on the main
>> process. I'll get back to you (at most in a few days)
>>
>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] how to use groupby and sum() in query or grid?

2015-02-18 Thread Michael Beller
Given:

db.define_table('items',
Field('country'),
Field('state'),
Field(''product'),
Field(sales', 'integer')

Can you show total sales by country and state?

I can groupby in a grid using groupby=db.items.country|db.items.state but I 
can't find how to include the db.items.sales.sum()

I've been playing with this hack:
https://groups.google.com/forum/#!searchin/web2py/using$20groupby$20and$20sum$20in$20query%7Csort:date/web2py/2dMx-UHbmVs/dAz_V3NWOH4J

I can also just use a query and format the table myself (I don't strictly 
need a grid). 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py spreadsheet.py - does it use cache.ram correctly?

2015-02-18 Thread chris_g
>From what I can see, the call in the index function works fine, but the 
problem is in all calls to the callback.
Would it work better with a session data instead of cache.ram?


On Monday, February 16, 2015 at 4:24:51 PM UTC+11, Massimo Di Pierro wrote:
>
> I was wrong in saying I was wrong. The example in spreadsheet.py says:
>
> def callback():   
> 
>  return cache.ram('sheet1', lambda: None, 
> None).process(request)   
>   
>  
> def index():   
>
>  # standard spreadsheet method 
> 
>  sheet = cache.ram('sheet1',   
> 
>  lambda: Sheet(10, 10, URL(r=request, f='callback')), 0)
>
> so the index() function stores a Sheet object in the cache.ram, the 
> callback function retrieves it and calls a method of that object. Notice 
> there is a problem. This only works when you have a single process sharing 
> cache.ram.
>
> On Sunday, 15 February 2015 21:08:11 UTC-6, Massimo Di Pierro wrote:
>>
>> That line is clearly wrong!
>>
>> On Sunday, 15 February 2015 19:06:31 UTC-6, chris_g wrote:
>>>
>>>
>>> I am taking a look at the spreadsheet controller in 
>>> /examples/spreadsheet in web2py Version 2.9.12 (on CentOS 6.6) .
>>>
>>> The callback function is throwing this error.
>>>
>>>
>>> Traceback (most recent call last):
>>>   File "/var/www/web2py/gluon/restricted.py", line 224, in restricted
>>> exec ccode in environment
>>>   File 
>>> "/var/www/web2py/applications/examples/controllers/spreadsheet.py", line 
>>> 12, in 
>>>   File "/var/www/web2py/gluon/globals.py", line 393, in 
>>> self._caller = lambda f: f()
>>>   File 
>>> "/var/www/web2py/applications/examples/controllers/spreadsheet.py", line 4, 
>>> in callback
>>> return cache.ram('sheet1', lambda: None, None).process(request)
>>> AttributeError: 'NoneType' object has no attribute 'process'
>>>
>>>
>>> I can't see other examples of code that call a ram.cache().process() 
>>> method. Is this code using some defunct functionality?
>>>
>>> I can see a lot of uses for this spreadsheet module and would be very 
>>> happy to assist with getting it working out of the box.
>>>
>>> Does anyone have a working example that they can point me to?
>>>
>>> Chris
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: if form.process().accepted: workings

2015-02-18 Thread Annet
Thanks you both for your replies.

@Niphlod,

I did set autodelete=True and the file gets deleted when I delete the 
entire record,
however, when I check the delete checkbox related to the upload field, the 
file
does not get deleted and the field is not to None.

I guess the issue is related to:

folder = 'nodeID' + str(nodeID)
db.lnd_page.image.uploadfolder = 
os.path.join(request.env.applications_parent, 'applications',
'dbmodel', 'static', 'uploads', folder)


@Anthony,

What exactly is confusing? Are you not expecting to be able to do anything 
> with the "record" object after calling form.process()? If so, why?
>

Yes, because after the form has been accepted and processed, i.e the record 
has been 
updated or deleted I expected the record to be no longer accessible.


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.