[web2py] Re: Unable to run web2py_no_console.exe (v2.14.6)

2016-06-14 Thread Arglanir
In the meantime I have updated my launching script in order to start 
web2py.exe minimized, if web2py_no_console.exe does not create a 
"web2py.pid" file.

Le mardi 14 juin 2016 21:21:22 UTC+2, Arglanir a écrit :
>
> Thank you. As I said, web2py.exe works.
> The goal is to deploy web2py on Windows computers that may not have any 
> Python installed. So web2py.py will not be executable on them.
>
> Am I the only one that has this problem ? I reproduced this problem on a 
> laptop using Windows 7 I think.
>
> Le mardi 14 juin 2016 13:10:45 UTC+2, Marlysson Silva a écrit :
>>
>> Try to download the source version of code, there are a file .py that 
>> it's possible executable from terminal without problems , and still can to 
>> see the code of framework , the windows version just have .exe and the code 
>> (framework) stay obfuscated.
>>
>>
>> Em segunda-feira, 13 de junho de 2016 17:23:19 UTC-3, Arglanir escreveu:
>>>
>>> Hello everyone,
>>> I just unpacked the last version into an empty folder. Then I try to 
>>> launch using a command line:
>>>
>>>-  web2py_no_console.exe
>>>-  web2py_no_console.exe -p 8003
>>>-  web2py_no_console.exe -p 8003 -i 0.0.0.0
>>>-  web2py_no_console.exe -p 8003 -i 0.0.0.0 -a  -l 
>>>web2py.log -d web2py.pid
>>>
>>> But everytime I see in the process manager that this program stops after 
>>> 1 or 2 seconds.
>>> If I go to the URL where it's supposed to be accessible, there is no 
>>> response as is to be expected.
>>> The files web2py.log and web2py.pid are not produced.
>>>
>>> Web2py.exe by the way works totally as expected.
>>>
>>> What can I do in order to get more information on this problem?
>>>
>>> I use Windows 10 professional 64 bits.
>>>
>>> (Note that I have also no tested every release since the start of 
>>> web2py... the last time I tried it and it worked was with web2py version... 
>>> 2.2.1 (-: )
>>>
>>

-- 
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] Key Error when try to access records in DB tables

2016-06-14 Thread Joe
I can't understand what could possibly cause this. When I submit the form, 
the form is processed, the page is redirected, email sent and the records 
stored in the DB table as expected.
But, when I click on the ID number of the row in the table, trying to 
access the records, as I always do, I get a .

The form in the controller:
form = SQLFORM(db.table_name)

This never happened before, so I have no idea what the problem is. Can 
anyone help me with this?

Thanks very much.

Joe

-- 
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] generic.docx ?

2016-06-14 Thread H. Das
Would it be possible in web2py to create a generic.docx (word document, 
odf, or similar) template that can convert from HTML? Basically it should 
work just like generic.pdf. Thanks, love you guys.

-- 
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: Pure HTML form

2016-06-14 Thread Jeff Riley
Oh lord folks.  I had the same name for two fields.  That was my only 
problem.  Thank you all very much.


On Monday, June 13, 2016 at 6:27:20 PM UTC-5, Jeff Riley wrote:

> Hello all.  So sorry to bother you again.  Since I have to overlay form 
> fields on top of a canvas, I have to build pure HTML form elements (at 
> least that is all I can think to do).  My problem is when I submit the form 
> I am getting errors in form even though I am filling out every field.  I am 
> attaching all the relevant code if someone would not mind having a look.  I 
> do really appreciate the help.
>

-- 
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 debug weasyprint error - failed to load a library: cairo / cairo-2

2016-06-14 Thread Michael Beller
I posted this on the pythonanywhere (PAW) forums also but I think it may be 
web2py specific (or at least specific to the PAW/web2py combination) ...

I'm using weasyprint to generate a PDF.  It's working on my local dev 
environment and my PAW personal account.

On a new PAW account it fails on:
from weasyprint import HTML, CSS

with the error:
OSError: dlopen() failed to load a library: cairo / cairo-2

On the new PAW account, the import works in a python console (just not from 
within the web2py app).

As far as I can tell, the original and new PAW accounts are identical.  I 
also recently create a new virtualenv on the new account to try and isolate 
the library/package that may be out of sync but I'm getting the same error.

Any ideas how to debug?

-- 
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 open parent window from javascript

2016-06-14 Thread Alex Glaros
never mind answered 
here: 
http://stackoverflow.com/questions/32107617/web2py-pass-a-variable-from-view-to-controller

-- 
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: ReferenceError: web2py is not defined

2016-06-14 Thread Manuele Pesenti
Il 14/06/16 23:22, Manuele Pesenti ha scritto:
>
> Yes! It fixes the bug. I'll open the issue.
>
> Thanks to Everyone! :)
>
> M.
>
just opened: https://github.com/web2py/web2py/issues/1364

Best regards

M.

-- 
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: ReferenceError: web2py is not defined

2016-06-14 Thread Manuele Pesenti
Il 14/06/16 21:19, Anthony ha scritto:
> es, looks like a bug here:
> https://github.com/web2py/web2py/blob/master/applications/welcome/static/js/web2py-bootstrap3.js#L14.
> Should be:
>
> |
> $.web2py.validate_entropy($(this));
> |
>
> See if that change works, and please file a Github issue.
>
> Thanks.
>
> Anthony

Yes! It fixes the bug. I'll open the issue.

Thanks to Everyone! :)

M.

-- 
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 open parent window from javascript

2016-06-14 Thread Alex Glaros
conditional javascript below correctly opens new window

$("#alexTree").fancytree({
checkbox: true,
selectMode: 3,
source: {url: tree_url},
dataType: "json",
postProcess: function(event, data){
data.result = convertData(data.response);
},
select: function(event, data) {
window.open(data.node.data.alexLink, "_blank");
}
});

but I don't want new additional window, just want parent URL to redirect. 
This seems to be illegal in javascript

below is my attempt to get around this but receive "Not Authorized" error. 

Is there a better way to redirect parent from javaScript?

var destination = "{{=URL(c='default/view_suggestions.html')}}";

$("#alexTree").fancytree({
checkbox: true,
selectMode: 3,
source: {url: tree_url},
dataType: "json",
postProcess: function(event, data){
data.result = convertData(data.response);
},
select: function(event, data) {
parent.window.location = destination;
}
});
});

thanks,

Alex Glaros

-- 
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: Unable to run web2py_no_console.exe (v2.14.6)

2016-06-14 Thread Arglanir
Thank you. As I said, web2py.exe works.
The goal is to deploy web2py on Windows computers that may not have any 
Python installed. So web2py.py will not be executable on them.

Am I the only one that has this problem ? I reproduced this problem on a 
laptop using Windows 7 I think.

Le mardi 14 juin 2016 13:10:45 UTC+2, Marlysson Silva a écrit :
>
> Try to download the source version of code, there are a file .py that it's 
> possible executable from terminal without problems , and still can to see 
> the code of framework , the windows version just have .exe and the code 
> (framework) stay obfuscated.
>
>
> Em segunda-feira, 13 de junho de 2016 17:23:19 UTC-3, Arglanir escreveu:
>>
>> Hello everyone,
>> I just unpacked the last version into an empty folder. Then I try to 
>> launch using a command line:
>>
>>-  web2py_no_console.exe
>>-  web2py_no_console.exe -p 8003
>>-  web2py_no_console.exe -p 8003 -i 0.0.0.0
>>-  web2py_no_console.exe -p 8003 -i 0.0.0.0 -a  -l 
>>web2py.log -d web2py.pid
>>
>> But everytime I see in the process manager that this program stops after 
>> 1 or 2 seconds.
>> If I go to the URL where it's supposed to be accessible, there is no 
>> response as is to be expected.
>> The files web2py.log and web2py.pid are not produced.
>>
>> Web2py.exe by the way works totally as expected.
>>
>> What can I do in order to get more information on this problem?
>>
>> I use Windows 10 professional 64 bits.
>>
>> (Note that I have also no tested every release since the start of 
>> web2py... the last time I tried it and it worked was with web2py version... 
>> 2.2.1 (-: )
>>
>

-- 
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: ReferenceError: web2py is not defined

2016-06-14 Thread Anthony
Yes, looks like a bug here: 
https://github.com/web2py/web2py/blob/master/applications/welcome/static/js/web2py-bootstrap3.js#L14.
 
Should be:

$.web2py.validate_entropy($(this));

See if that change works, and please file a Github issue.

Thanks.

Anthony

On Tuesday, June 14, 2016 at 5:55:59 AM UTC-4, Manuele wrote:
>
> Hi! 
>
> I found some client side trouble using the validator IS_STRONG. 
>
> Using this validator for such a field of a table and then visiting the 
> admin and trying to add a new record the debugger console shows thi error: 
>
> ReferenceError: web2py is not defined1 web2py-bootstrap3.js:14:6 
>
> At this link you can find the page source I got: 
> http://paste.debian.net/739046/ 
>
> Maybe it's a bug? 
>
> Thanks a lot 
> Cheers 
>
> Manuele 
>

-- 
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] ReferenceError: web2py is not defined

2016-06-14 Thread Richard Vézina
Which version of web2py, trunk?

I guess you should open a issue on github, but provide the exact path to
reproduce the problem...

Richard

On Tue, Jun 14, 2016 at 2:56 PM, Manuele Pesenti 
wrote:

> Il 14/06/16 17:56, Richard Vézina ha scritto:
> > You miss web2py-bootstrap3.js in your app? Was that error with default
> > welcome or your app?
>
> First I got in my app (in wich I rewrote all the layout) but I noticed
> that I get the same error using the appadmin... the error is raised in
> web2py-bootstrap3.js so it is loaded... and so it is web2py.js (before
> web2py-bootstrap3.js) as you can see in the source of the page I
> linked... so I can't understand what is the problem...
>
> thanks a lot
>
> Cheers
>
> M.
>
> --
> 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] ReferenceError: web2py is not defined

2016-06-14 Thread Manuele Pesenti
Il 14/06/16 17:56, Richard Vézina ha scritto:
> You miss web2py-bootstrap3.js in your app? Was that error with default
> welcome or your app?

First I got in my app (in wich I rewrote all the layout) but I noticed
that I get the same error using the appadmin... the error is raised in
web2py-bootstrap3.js so it is loaded... and so it is web2py.js (before
web2py-bootstrap3.js) as you can see in the source of the page I
linked... so I can't understand what is the problem...

thanks a lot

Cheers

M.

-- 
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] simple file uploader to database as a plugin

2016-06-14 Thread Vic Ding

Hi all,
I know it's 2 things in one post: how to make a file uploader as a plugin?
It should upload a file store it in the database and keep a record of the 
table and record to which it belong to (associate the uploaded file with a 
record in another table). 

model is plugin_upload_file.py

db.define_table('plugin_upload_file',
auth.signature,
Field('title', 'string'),
Field('description', 'text'),
Field('upload_file', 'upload'),
Field('table_name', 'string'),
Field('record_id', 'integer'),
format = '%(title)s'
)



I have controller/plugin_upload_file.py

def index():

table_name = request.args(0)
record_id = request.args(1, cast=long)

## pre-fill the table_name and record_id
db.plugin_upload_file.table_name.default = table_name
db.plugin_upload_file.record_id.default = record_id

plugin_upload_file_form = SQLFORM(db.plugin_upload_file).process()
if plugin_upload_file_form.accepted:
response.flash=T('File saved')
redirect(URL('index', args=(table_name, record_id)))
else:
response.flash=T('Error')

return locals()


Finally the view in view/plugin_upload_file/index.html

{{=plugin_upload_file_form}}


It works when I directly access the index page, however when I LOAD it to 
other pages it stops working. No ticket, no error. 

{{=LOAD('plugin_upload_file', 'index', args=('item', item_id), 
user_signature=True)}}



Any idea?

Thanks
Vic

-- 
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: XML(sanitize=True) and incorrect HTML

2016-06-14 Thread Anthony
In gluon.sanitizer.XssCleaner:

def handle_endtag(self, tag):
bracketed = '' % tag
self.in_disallowed.pop()
if tag not in self.permitted_tags:
if (not self.strip_disallowed):
self.result += xssescape(bracketed)
elif tag in self.open_tags:
self.result += bracketed
self.open_tags.remove(tag)

maybe change the third line to:

self.in_disallowed and self.in_disallowed.pop()

Note sure if that will cause any other problems.

Feel free to file a Github issue.

Anthony


On Tuesday, June 14, 2016 at 2:06:28 PM UTC-4, Kirill Shatalaev wrote:
>
> Hello.
>
> XML crashes while trying to sanitize some sorts of incorrect html.
>
> For example:
>
> a = '' # wrong html
> b = XML(a, sanitize=True)
>
>  pop from empty list
>
> I suppose this is a severe bug.
>

-- 
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: SELECT without duplicates for a specific field

2016-06-14 Thread Dave S


On Tuesday, June 14, 2016 at 6:55:43 AM UTC-7, Gael Princivalle wrote:
>
> With inner joins orderby works but not groupby.
>
> db(db.table.reference == db.referencedtable.id).select(db.table.ALL, 
> orderby=db.referencedtable.Field)
> Works.
>
> db(db.table.reference == db.referencedtable.id).select(db.table.ALL, 
> orderby=db.referencedtable.Field, groupby=db.table.reference)
> Give a Ticket:
> column "table.id " must appear in the GROUP BY clause 
> or be used in an aggregate function LINE 1: SELECT "table"."id"...
>
> Someone have a solution ?
>
> Is that error coming from the DAL query parser, or from the DB itself?  If 
the latter, you should be able to look at the SQL generated.

/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] XML(sanitize=True) and incorrect HTML

2016-06-14 Thread Kirill Shatalaev
Hello.

XML crashes while trying to sanitize some sorts of incorrect html.

For example:

a = '' # wrong html
b = XML(a, sanitize=True)

 pop from empty list

I suppose this is a severe bug.

-- 
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] ReferenceError: web2py is not defined

2016-06-14 Thread Richard Vézina
You miss web2py-bootstrap3.js in your app? Was that error with default
welcome or your app?

On Tue, Jun 14, 2016 at 5:55 AM, Manuele Pesenti 
wrote:

> Hi!
>
> I found some client side trouble using the validator IS_STRONG.
>
> Using this validator for such a field of a table and then visiting the
> admin and trying to add a new record the debugger console shows thi error:
>
> ReferenceError: web2py is not defined1 web2py-bootstrap3.js:14:6
>
> At this link you can find the page source I got:
> http://paste.debian.net/739046/
>
> Maybe it's a bug?
>
> Thanks a lot
> Cheers
>
> Manuele
>
> --
> 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: is it safe to create url in javascript?

2016-06-14 Thread Alex Glaros
got it, thanks Stuart

-- 
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: what is syntax for recursive join?

2016-06-14 Thread Alex Glaros
Niphlod, good insight regarding managing response times. Thanks for 
pointing the right direction.

Alex

-- 
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: jquery-pjax

2016-06-14 Thread Niphlod
great, simple, done.

On Tuesday, June 14, 2016 at 2:34:22 PM UTC+2, Carlos Cesar Caballero wrote:
>
> Hi everyone, have you any experience with 
> https://github.com/defunkt/jquery-pjax and web2py? it looks really 
> interesting. 
>
> Greetings. 
>
> -- 
> Este mensaje le ha llegado mediante el servicio de correo electronico que 
> ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
> Nacional de Salud. La persona que envia este correo asume el compromiso de 
> usar el servicio a tales fines y cumplir con las regulaciones establecidas 
>
> Infomed: http://www.sld.cu/ 
>
>

-- 
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: SELECT without duplicates for a specific field

2016-06-14 Thread Gael Princivalle
With inner joins orderby works but not groupby.

db(db.table.reference == db.referencedtable.id).select(db.table.ALL, orderby
=db.referencedtable.Field)
Works.

db(db.table.reference == db.referencedtable.id).select(db.table.ALL, orderby
=db.referencedtable.Field, groupby=db.products.cm1)
Give a Ticket:
column "products.id" must appear in the GROUP BY clause or be used in an 
aggregate function LINE 1: SELECT "products"."id"...

Someone have a solution ?

Il giorno martedì 14 giugno 2016 09:59:54 UTC+2, Tribo Eila ha scritto:
>
> Try  INNER JOINS.
>
> On Monday, June 13, 2016 at 6:31:33 PM UTC+3, Gael Princivalle wrote:
>>
>> New model:
>> db.define_table('categories):
>> Field('title', type='string'))
>> 
>> db.define_table('products'):
>> Field('code', type='string'),
>> Field('category', reference 'categories'))
>>
>> With groupby I obtain a good result.
>>
>> results = db(db.products).select(db.products.category, groupby=db.
>> products.category)
>>
>> But I need to order the results by the category title.
>>
>> If I do like that:
>> results = db(db.products).select(db.products.category, orderby=db.product
>> .category.title, groupby=db.products.category)
>>
>> Ticket is : 'Field' object has no attribute 'title'
>>
>> Is there a way to order these results, or make a query that selct only 
>> the categories in db.categories that are in db.products ?
>>
>> Il giorno giovedì 9 giugno 2016 12:56:57 UTC+2, tim.n...@conted.ox.ac.uk 
>> ha scritto:
>>>
>>> Looks like you want a subquery.  You'll need to decide which of the 
>>> items to choose when you have a given category_code.
>>> Say you want the first item with a given category code:
>>>
>>> sub_query = db()._select(db.products.id.min(), groupby=db.products.
>>> category_code)
>>> results = db(db.products.id.belongs(sub_query)).select()
>>>
>>>
>>> On Wednesday, 8 June 2016 15:10:33 UTC+1, Gael Princivalle wrote:
>>>
 Hello.

 Is there a way to select some rows without duplicates for a specific 
 field ?

 MODEL:
 db.define_table('products'):
 Field('code', type='string'),
 Field('category_code', type='integer'))

 ROWS:
 code / category_code
 A1125 / 3
 C2214 / 2
 D235 / 3
 Z886 / 1

 I would like to make a select that give this result:
 code / category_code
 A1125 / 3
 C2214 / 2
 Z886 / 1

 Someone have an idea ?

 Thanks.




-- 
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] jquery-pjax

2016-06-14 Thread Carlos Cesar Caballero Díaz
Hi everyone, have you any experience with 
https://github.com/defunkt/jquery-pjax and web2py? it looks really 
interesting.


Greetings.

--
Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

--
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: SELECT without duplicates for a specific field

2016-06-14 Thread Gael Princivalle
Thanks you Marlysson but it was not the missing 's'. Ticket is:
'Field' object has no attribute 'title'

Il giorno martedì 14 giugno 2016 12:53:24 UTC+2, Marlysson Silva ha scritto:
>
> results = db(db.products).select(db.products.category, orderby=db.products
> .category.title, groupby=db.products.category)
>
> You probability forget the "s" at name of table "products" , I think it so
> .
>
> Em segunda-feira, 13 de junho de 2016 12:31:33 UTC-3, Gael Princivalle 
> escreveu:
>>
>> New model:
>> db.define_table('categories):
>> Field('title', type='string'))
>> 
>> db.define_table('products'):
>> Field('code', type='string'),
>> Field('category', reference 'categories'))
>>
>> With groupby I obtain a good result.
>>
>> results = db(db.products).select(db.products.category, groupby=db.
>> products.category)
>>
>> But I need to order the results by the category title.
>>
>> If I do like that:
>> results = db(db.products).select(db.products.category, orderby=db.product
>> .category.title, groupby=db.products.category)
>>
>> Ticket is : 'Field' object has no attribute 'title'
>>
>> Is there a way to order these results, or make a query that selct only 
>> the categories in db.categories that are in db.products ?
>>
>> Il giorno giovedì 9 giugno 2016 12:56:57 UTC+2, tim.n...@conted.ox.ac.uk 
>> ha scritto:
>>>
>>> Looks like you want a subquery.  You'll need to decide which of the 
>>> items to choose when you have a given category_code.
>>> Say you want the first item with a given category code:
>>>
>>> sub_query = db()._select(db.products.id.min(), groupby=db.products.
>>> category_code)
>>> results = db(db.products.id.belongs(sub_query)).select()
>>>
>>>
>>> On Wednesday, 8 June 2016 15:10:33 UTC+1, Gael Princivalle wrote:
>>>
 Hello.

 Is there a way to select some rows without duplicates for a specific 
 field ?

 MODEL:
 db.define_table('products'):
 Field('code', type='string'),
 Field('category_code', type='integer'))

 ROWS:
 code / category_code
 A1125 / 3
 C2214 / 2
 D235 / 3
 Z886 / 1

 I would like to make a select that give this result:
 code / category_code
 A1125 / 3
 C2214 / 2
 Z886 / 1

 Someone have an idea ?

 Thanks.




-- 
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: I am trying to change the background image every 5 seconds like this but this doesn't seem to work?

2016-06-14 Thread Anthony
The URL is in Javascript. In:

var baseUrl = '{{=URL('static', 'images')}}'

the part in curly braces is Python, which gets executed on the server 
before the page is sent to the browser. In the browser, you will end up 
with HTML that looks like:

var baseUrl = '/yourapp/static/images';

That's a Javascript variable. Now write the Javascript code to generate a 
random integer, append the integer and file extension to the baseURL, and 
set the document background to that URL.

Anthony


On Tuesday, June 14, 2016 at 8:05:11 AM UTC-4, Emmanuel Dsouza wrote:
>
> But how do I opened a random d.jpg through Javascript to a URL that is in 
> Python? 
>
> On Tuesday, June 14, 2016 at 5:14:13 PM UTC+5:30, Anthony wrote:
>>
>> No, you're still attempting to run Python code in Javascript. You must 
>> write actual Javascript code -- no Python. You should only be using Python 
>> to create the base URL -- for example:
>>
>> var baseUrl = '{{=URL('static', 'images')}}';
>> [everything else is Javascript]
>>
>> Anthony
>>
>> On Tuesday, June 14, 2016 at 7:38:15 AM UTC-4, Emmanuel Dsouza wrote:
>>>
>>> Thank you Anthony but still it is not going through!
>>> Could you check why:
>>>
>>> {{extend 'layout.html'}}
>>> 
>>> window.setInterval(function(){
>>> {{i=URL('static','images/%d.jpg' %(randint(0,2)))}}
>>>   document.body.style.background = url("{{=i}}");
>>> }, 5000);
>>> 
>>>
>>>
>>> Even this one doesn't work:
>>>
>>> {{extend 'layout.html'}}
>>> 
>>> window.setInterval(function(){
>>> {{f=["lightblue","pink","green"]}}
>>> {{z=f[randint(0,2)]}}
>>> document.body.style.background = {{=z}};
>>> }, 5000);
>>> 
>>>
>>>
>>> On Tuesday, June 14, 2016 at 12:29:52 PM UTC+5:30, Anthony wrote:

 Actually, in this case, you don't really need to bother with Ajax. 
 Instead, just implement the random integer generation in Javascript and 
 use 
 the random integer to generate the URL in Javascript.

 For future reference, though, the third argument to the ajax() function 
 can be ":eval" (which tells it to evaluate the returned value as JS code) 
 or a JS function (which will be passed the returned value). See the 
 documentation.

 Anthony

 On Tuesday, June 14, 2016 at 1:58:32 AM UTC-4, Emmanuel Dsouza wrote:
>
> I was obviously waiting for your reply only.
> Ok Anthony I got what you said. But how do I get a variable through an 
> ajax call? Ajax only updates a tag id, right?
> How do I edit this to make it work?
>
> in controller:
>
> def index():
> return locals()
>
> in model:
>
> def retimage():
> from random import randint
> i=randint(0,2)
> return URL('static','images/%d.jpg' %(i))
>
> in view:
>
> {{extend 'layout.html'}}
> 
> window.setInterval(function(){
> {{getimage=retimage()}}
>   document.body.style.background-image = url("{{=getimage}}");
> }, 500);
> 
>
>
> I am confused on how to get a variable value though ajax calls. Please 
> help me on this.
>
> On Monday, June 13, 2016 at 8:46:28 PM UTC+5:30, Anthony wrote:
>>
>> You cannot call Python functions on the server from Javascript code 
>> running in the browser. The following line:
>>
>> {{getimage=retimage()}}
>>
>> will be called exactly once on the server *before *the HTML page is 
>> ever sent to the browser, and it will not result in anything being 
>> written 
>> into the Javascript code (if you look at the page source in the browser, 
>> you will see nothing there).
>>
>> If you need to retrieve images from the server without reloading the 
>> page, you must use Ajax.
>>
>> Anthony
>>
>>
>> On Monday, June 13, 2016 at 5:30:47 AM UTC-4, Emmanuel Dsouza wrote:
>>>
>>> CONTROLLER:
>>>
>>> def retimage():
>>> 
>>> k=["URL('static','images/1.jpg')","URL('static','images/2.jpg')","URL('static','images/3.jpg')"]
>>> from random import randint
>>> i=randint(0,2)
>>> return k[i]
>>> def index():
>>> return locals()
>>>
>>> VIEW:
>>>
>>> {{extend 'layout.html'}}
>>> 
>>> window.setInterval(function(){
>>> {{getimage=retimage()}}
>>>   document.body.background = url("{{=getimage}}");
>>> }, 5000);
>>> 
>>>
>>>
>>>
>>> How should I correct this?
>>>
>>

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

[web2py] Re: I am trying to change the background image every 5 seconds like this but this doesn't seem to work?

2016-06-14 Thread Emmanuel Dsouza
But how do I opened a random d.jpg through Javascript to a URL that is in 
Python? 

On Tuesday, June 14, 2016 at 5:14:13 PM UTC+5:30, Anthony wrote:
>
> No, you're still attempting to run Python code in Javascript. You must 
> write actual Javascript code -- no Python. You should only be using Python 
> to create the base URL -- for example:
>
> var baseUrl = '{{=URL('static', 'images')}}';
> [everything else is Javascript]
>
> Anthony
>
> On Tuesday, June 14, 2016 at 7:38:15 AM UTC-4, Emmanuel Dsouza wrote:
>>
>> Thank you Anthony but still it is not going through!
>> Could you check why:
>>
>> {{extend 'layout.html'}}
>> 
>> window.setInterval(function(){
>> {{i=URL('static','images/%d.jpg' %(randint(0,2)))}}
>>   document.body.style.background = url("{{=i}}");
>> }, 5000);
>> 
>>
>>
>> Even this one doesn't work:
>>
>> {{extend 'layout.html'}}
>> 
>> window.setInterval(function(){
>> {{f=["lightblue","pink","green"]}}
>> {{z=f[randint(0,2)]}}
>> document.body.style.background = {{=z}};
>> }, 5000);
>> 
>>
>>
>> On Tuesday, June 14, 2016 at 12:29:52 PM UTC+5:30, Anthony wrote:
>>>
>>> Actually, in this case, you don't really need to bother with Ajax. 
>>> Instead, just implement the random integer generation in Javascript and use 
>>> the random integer to generate the URL in Javascript.
>>>
>>> For future reference, though, the third argument to the ajax() function 
>>> can be ":eval" (which tells it to evaluate the returned value as JS code) 
>>> or a JS function (which will be passed the returned value). See the 
>>> documentation.
>>>
>>> Anthony
>>>
>>> On Tuesday, June 14, 2016 at 1:58:32 AM UTC-4, Emmanuel Dsouza wrote:

 I was obviously waiting for your reply only.
 Ok Anthony I got what you said. But how do I get a variable through an 
 ajax call? Ajax only updates a tag id, right?
 How do I edit this to make it work?

 in controller:

 def index():
 return locals()

 in model:

 def retimage():
 from random import randint
 i=randint(0,2)
 return URL('static','images/%d.jpg' %(i))

 in view:

 {{extend 'layout.html'}}
 
 window.setInterval(function(){
 {{getimage=retimage()}}
   document.body.style.background-image = url("{{=getimage}}");
 }, 500);
 


 I am confused on how to get a variable value though ajax calls. Please 
 help me on this.

 On Monday, June 13, 2016 at 8:46:28 PM UTC+5:30, Anthony wrote:
>
> You cannot call Python functions on the server from Javascript code 
> running in the browser. The following line:
>
> {{getimage=retimage()}}
>
> will be called exactly once on the server *before *the HTML page is 
> ever sent to the browser, and it will not result in anything being 
> written 
> into the Javascript code (if you look at the page source in the browser, 
> you will see nothing there).
>
> If you need to retrieve images from the server without reloading the 
> page, you must use Ajax.
>
> Anthony
>
>
> On Monday, June 13, 2016 at 5:30:47 AM UTC-4, Emmanuel Dsouza wrote:
>>
>> CONTROLLER:
>>
>> def retimage():
>> 
>> k=["URL('static','images/1.jpg')","URL('static','images/2.jpg')","URL('static','images/3.jpg')"]
>> from random import randint
>> i=randint(0,2)
>> return k[i]
>> def index():
>> return locals()
>>
>> VIEW:
>>
>> {{extend 'layout.html'}}
>> 
>> window.setInterval(function(){
>> {{getimage=retimage()}}
>>   document.body.background = url("{{=getimage}}");
>> }, 5000);
>> 
>>
>>
>>
>> How should I correct this?
>>
>

-- 
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: I am trying to change the background image every 5 seconds like this but this doesn't seem to work?

2016-06-14 Thread Anthony
No, you're still attempting to run Python code in Javascript. You must 
write actual Javascript code -- no Python. You should only be using Python 
to create the base URL -- for example:

var baseUrl = '{{=URL('static', 'images')}}';
[everything else is Javascript]

Anthony

On Tuesday, June 14, 2016 at 7:38:15 AM UTC-4, Emmanuel Dsouza wrote:
>
> Thank you Anthony but still it is not going through!
> Could you check why:
>
> {{extend 'layout.html'}}
> 
> window.setInterval(function(){
> {{i=URL('static','images/%d.jpg' %(randint(0,2)))}}
>   document.body.style.background = url("{{=i}}");
> }, 5000);
> 
>
>
> Even this one doesn't work:
>
> {{extend 'layout.html'}}
> 
> window.setInterval(function(){
> {{f=["lightblue","pink","green"]}}
> {{z=f[randint(0,2)]}}
> document.body.style.background = {{=z}};
> }, 5000);
> 
>
>
> On Tuesday, June 14, 2016 at 12:29:52 PM UTC+5:30, Anthony wrote:
>>
>> Actually, in this case, you don't really need to bother with Ajax. 
>> Instead, just implement the random integer generation in Javascript and use 
>> the random integer to generate the URL in Javascript.
>>
>> For future reference, though, the third argument to the ajax() function 
>> can be ":eval" (which tells it to evaluate the returned value as JS code) 
>> or a JS function (which will be passed the returned value). See the 
>> documentation.
>>
>> Anthony
>>
>> On Tuesday, June 14, 2016 at 1:58:32 AM UTC-4, Emmanuel Dsouza wrote:
>>>
>>> I was obviously waiting for your reply only.
>>> Ok Anthony I got what you said. But how do I get a variable through an 
>>> ajax call? Ajax only updates a tag id, right?
>>> How do I edit this to make it work?
>>>
>>> in controller:
>>>
>>> def index():
>>> return locals()
>>>
>>> in model:
>>>
>>> def retimage():
>>> from random import randint
>>> i=randint(0,2)
>>> return URL('static','images/%d.jpg' %(i))
>>>
>>> in view:
>>>
>>> {{extend 'layout.html'}}
>>> 
>>> window.setInterval(function(){
>>> {{getimage=retimage()}}
>>>   document.body.style.background-image = url("{{=getimage}}");
>>> }, 500);
>>> 
>>>
>>>
>>> I am confused on how to get a variable value though ajax calls. Please 
>>> help me on this.
>>>
>>> On Monday, June 13, 2016 at 8:46:28 PM UTC+5:30, Anthony wrote:

 You cannot call Python functions on the server from Javascript code 
 running in the browser. The following line:

 {{getimage=retimage()}}

 will be called exactly once on the server *before *the HTML page is 
 ever sent to the browser, and it will not result in anything being written 
 into the Javascript code (if you look at the page source in the browser, 
 you will see nothing there).

 If you need to retrieve images from the server without reloading the 
 page, you must use Ajax.

 Anthony


 On Monday, June 13, 2016 at 5:30:47 AM UTC-4, Emmanuel Dsouza wrote:
>
> CONTROLLER:
>
> def retimage():
> 
> k=["URL('static','images/1.jpg')","URL('static','images/2.jpg')","URL('static','images/3.jpg')"]
> from random import randint
> i=randint(0,2)
> return k[i]
> def index():
> return locals()
>
> VIEW:
>
> {{extend 'layout.html'}}
> 
> window.setInterval(function(){
> {{getimage=retimage()}}
>   document.body.background = url("{{=getimage}}");
> }, 5000);
> 
>
>
>
> How should I correct this?
>


-- 
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: I am trying to change the background image every 5 seconds like this but this doesn't seem to work?

2016-06-14 Thread Emmanuel Dsouza
Thank you Anthony but still it is not going through!
Could you check why:

{{extend 'layout.html'}}

window.setInterval(function(){
{{i=URL('static','images/%d.jpg' %(randint(0,2)))}}
  document.body.style.background = url("{{=i}}");
}, 5000);



Even this one doesn't work:

{{extend 'layout.html'}}

window.setInterval(function(){
{{f=["lightblue","pink","green"]}}
{{z=f[randint(0,2)]}}
document.body.style.background = {{=z}};
}, 5000);



On Tuesday, June 14, 2016 at 12:29:52 PM UTC+5:30, Anthony wrote:
>
> Actually, in this case, you don't really need to bother with Ajax. 
> Instead, just implement the random integer generation in Javascript and use 
> the random integer to generate the URL in Javascript.
>
> For future reference, though, the third argument to the ajax() function 
> can be ":eval" (which tells it to evaluate the returned value as JS code) 
> or a JS function (which will be passed the returned value). See the 
> documentation.
>
> Anthony
>
> On Tuesday, June 14, 2016 at 1:58:32 AM UTC-4, Emmanuel Dsouza wrote:
>>
>> I was obviously waiting for your reply only.
>> Ok Anthony I got what you said. But how do I get a variable through an 
>> ajax call? Ajax only updates a tag id, right?
>> How do I edit this to make it work?
>>
>> in controller:
>>
>> def index():
>> return locals()
>>
>> in model:
>>
>> def retimage():
>> from random import randint
>> i=randint(0,2)
>> return URL('static','images/%d.jpg' %(i))
>>
>> in view:
>>
>> {{extend 'layout.html'}}
>> 
>> window.setInterval(function(){
>> {{getimage=retimage()}}
>>   document.body.style.background-image = url("{{=getimage}}");
>> }, 500);
>> 
>>
>>
>> I am confused on how to get a variable value though ajax calls. Please 
>> help me on this.
>>
>> On Monday, June 13, 2016 at 8:46:28 PM UTC+5:30, Anthony wrote:
>>>
>>> You cannot call Python functions on the server from Javascript code 
>>> running in the browser. The following line:
>>>
>>> {{getimage=retimage()}}
>>>
>>> will be called exactly once on the server *before *the HTML page is 
>>> ever sent to the browser, and it will not result in anything being written 
>>> into the Javascript code (if you look at the page source in the browser, 
>>> you will see nothing there).
>>>
>>> If you need to retrieve images from the server without reloading the 
>>> page, you must use Ajax.
>>>
>>> Anthony
>>>
>>>
>>> On Monday, June 13, 2016 at 5:30:47 AM UTC-4, Emmanuel Dsouza wrote:

 CONTROLLER:

 def retimage():
 
 k=["URL('static','images/1.jpg')","URL('static','images/2.jpg')","URL('static','images/3.jpg')"]
 from random import randint
 i=randint(0,2)
 return k[i]
 def index():
 return locals()

 VIEW:

 {{extend 'layout.html'}}
 
 window.setInterval(function(){
 {{getimage=retimage()}}
   document.body.background = url("{{=getimage}}");
 }, 5000);
 



 How should I correct this?

>>>

-- 
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: Unable to run web2py_no_console.exe (v2.14.6)

2016-06-14 Thread Marlysson Silva
Try to download the source version of code, there are a file .py that it's 
possible executable from terminal without problems , and still can to see 
the code of framework , the windows version just have .exe and the code 
(framework) stay obfuscated.


Em segunda-feira, 13 de junho de 2016 17:23:19 UTC-3, Arglanir escreveu:
>
> Hello everyone,
> I just unpacked the last version into an empty folder. Then I try to 
> launch using a command line:
>
>-  web2py_no_console.exe
>-  web2py_no_console.exe -p 8003
>-  web2py_no_console.exe -p 8003 -i 0.0.0.0
>-  web2py_no_console.exe -p 8003 -i 0.0.0.0 -a  -l 
>web2py.log -d web2py.pid
>
> But everytime I see in the process manager that this program stops after 1 
> or 2 seconds.
> If I go to the URL where it's supposed to be accessible, there is no 
> response as is to be expected.
> The files web2py.log and web2py.pid are not produced.
>
> Web2py.exe by the way works totally as expected.
>
> What can I do in order to get more information on this problem?
>
> I use Windows 10 professional 64 bits.
>
> (Note that I have also no tested every release since the start of 
> web2py... the last time I tried it and it worked was with web2py version... 
> 2.2.1 (-: )
>

-- 
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: SELECT without duplicates for a specific field

2016-06-14 Thread Marlysson Silva
results = db(db.products).select(db.products.category, orderby=db.products.
category.title, groupby=db.products.category)

You probability forget the "s" at name of table "products" , I think it so.

Em segunda-feira, 13 de junho de 2016 12:31:33 UTC-3, Gael Princivalle 
escreveu:
>
> New model:
> db.define_table('categories):
> Field('title', type='string'))
> 
> db.define_table('products'):
> Field('code', type='string'),
> Field('category', reference 'categories'))
>
> With groupby I obtain a good result.
>
> results = db(db.products).select(db.products.category, groupby=db.products
> .category)
>
> But I need to order the results by the category title.
>
> If I do like that:
> results = db(db.products).select(db.products.category, orderby=db.product.
> category.title, groupby=db.products.category)
>
> Ticket is : 'Field' object has no attribute 'title'
>
> Is there a way to order these results, or make a query that selct only the 
> categories in db.categories that are in db.products ?
>
> Il giorno giovedì 9 giugno 2016 12:56:57 UTC+2, tim.n...@conted.ox.ac.uk 
> ha scritto:
>>
>> Looks like you want a subquery.  You'll need to decide which of the items 
>> to choose when you have a given category_code.
>> Say you want the first item with a given category code:
>>
>> sub_query = db()._select(db.products.id.min(), groupby=db.products.
>> category_code)
>> results = db(db.products.id.belongs(sub_query)).select()
>>
>>
>> On Wednesday, 8 June 2016 15:10:33 UTC+1, Gael Princivalle wrote:
>>
>>> Hello.
>>>
>>> Is there a way to select some rows without duplicates for a specific 
>>> field ?
>>>
>>> MODEL:
>>> db.define_table('products'):
>>> Field('code', type='string'),
>>> Field('category_code', type='integer'))
>>>
>>> ROWS:
>>> code / category_code
>>> A1125 / 3
>>> C2214 / 2
>>> D235 / 3
>>> Z886 / 1
>>>
>>> I would like to make a select that give this result:
>>> code / category_code
>>> A1125 / 3
>>> C2214 / 2
>>> Z886 / 1
>>>
>>> Someone have an idea ?
>>>
>>> Thanks.
>>>
>>>
>>>

-- 
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] ReferenceError: web2py is not defined

2016-06-14 Thread Manuele Pesenti
Hi!

I found some client side trouble using the validator IS_STRONG.

Using this validator for such a field of a table and then visiting the
admin and trying to add a new record the debugger console shows thi error:

ReferenceError: web2py is not defined1 web2py-bootstrap3.js:14:6

At this link you can find the page source I got:
http://paste.debian.net/739046/

Maybe it's a bug?

Thanks a lot
Cheers

Manuele

-- 
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: Size of SQLFORM.grid items

2016-06-14 Thread Jitun John
Thanks a lot Anthony. Works like Charm.

On Monday, June 13, 2016 at 8:42:16 PM UTC+5:30, Anthony wrote:
>
> As per the documentation:
>
>
>- maxtextlength sets the maximum length of text to be displayed for 
>each field value, in the grid view. This value can be overwritten for each 
>field using maxtextlengths, a dictionary of 
>'tablename.fieldname':length e.g. {'auth_user.email' : 50}
>
> Anthony
>
> On Monday, June 13, 2016 at 10:41:15 AM UTC-4, Jitun John wrote:
>>
>>
>> 
>>
>>
>> Above is a simple SQL.grid I have used.
>> I added "headers={'store_log_stats.cluster_name' : 
>> 'Cluster__Name'}," to make sure that the 
>> column had enough space.
>> But even with enough space, the data is concatenated.
>> Actual names are "Cluster-LH-P4530-13-14", "Cluster-LH-P4530-11-12"
>>
>> Just wondering how to make sure the Cluster name is displayed in full.
>>
>

-- 
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: SELECT without duplicates for a specific field

2016-06-14 Thread Tribo Eila
Try  INNER JOINS.

On Monday, June 13, 2016 at 6:31:33 PM UTC+3, Gael Princivalle wrote:
>
> New model:
> db.define_table('categories):
> Field('title', type='string'))
> 
> db.define_table('products'):
> Field('code', type='string'),
> Field('category', reference 'categories'))
>
> With groupby I obtain a good result.
>
> results = db(db.products).select(db.products.category, groupby=db.products
> .category)
>
> But I need to order the results by the category title.
>
> If I do like that:
> results = db(db.products).select(db.products.category, orderby=db.product.
> category.title, groupby=db.products.category)
>
> Ticket is : 'Field' object has no attribute 'title'
>
> Is there a way to order these results, or make a query that selct only the 
> categories in db.categories that are in db.products ?
>
> Il giorno giovedì 9 giugno 2016 12:56:57 UTC+2, tim.n...@conted.ox.ac.uk 
> ha scritto:
>>
>> Looks like you want a subquery.  You'll need to decide which of the items 
>> to choose when you have a given category_code.
>> Say you want the first item with a given category code:
>>
>> sub_query = db()._select(db.products.id.min(), groupby=db.products.
>> category_code)
>> results = db(db.products.id.belongs(sub_query)).select()
>>
>>
>> On Wednesday, 8 June 2016 15:10:33 UTC+1, Gael Princivalle wrote:
>>
>>> Hello.
>>>
>>> Is there a way to select some rows without duplicates for a specific 
>>> field ?
>>>
>>> MODEL:
>>> db.define_table('products'):
>>> Field('code', type='string'),
>>> Field('category_code', type='integer'))
>>>
>>> ROWS:
>>> code / category_code
>>> A1125 / 3
>>> C2214 / 2
>>> D235 / 3
>>> Z886 / 1
>>>
>>> I would like to make a select that give this result:
>>> code / category_code
>>> A1125 / 3
>>> C2214 / 2
>>> Z886 / 1
>>>
>>> Someone have an idea ?
>>>
>>> Thanks.
>>>
>>>
>>>

-- 
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: JANRAIN

2016-06-14 Thread Laurent Chambon
in fact i have installed  conf2py:
the model :

if settings.rpx_domain:
from gluon.contrib.login_methods.rpx_account import RPXAccount
auth.settings.actions_disabled=['register','change_password',
'request_reset_password']
auth.settings.login_form = RPXAccount(request
,
  api_key=settings.rpx_apikey,
  domain=settings.rpx_domain,
  url = settings.home_url+"/user/login")
if request 
.function=='user'
and request 
.args(0)=='register':
if not auth.user_id: redirect
(URL
('user',args='login'))
else: redirect
(URL
('user',args='profile'))
if auth.user and not auth.user.registered:
if not (request
.function=='user'
and request 
.args(0)=='profile'):
redirect
(URL
('user',args='profile'))



settings.rpx_apikey='mykey'
settings.rpx_domain='mydomain'


i have created an account janrain .
It works for facebook, yahoo and so on but not for google

Thank you again for yours help

2016-06-13 21:01 GMT+02:00 Anthony :

> It works for me, though I'm using an older version of web2py's Janrain
> adapter (not sure if that matters). How have you configured your app on
> Janrain?
>
> Anthony
>
>
> On Monday, June 13, 2016 at 12:14:57 PM UTC-4, LC LC wrote:
>>
>> Hi,
>> janrain works for different providers but il does not run for google+.
>> i ve created an id auth client
>> Could you explain me the different steps to run google authentification
>>
>> Thank you
>>
>> NB: in my model i have :
>>
>> auth.settings.login_form = RPXAccount(request 
>> ,
>>   api_key=settings.rpx_apikey,
>>   domain=settings.rpx_domain,
>>   url = 
>> settings.home_url+"/user/login")
>>
>>
>>
>> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/mkAgt-YC2-w/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 

*Laurent Chambon *
*47 rue Pougnet*
*33400 Talence*

*06 64 13 71 16  *

-- 
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: I am trying to change the background image every 5 seconds like this but this doesn't seem to work?

2016-06-14 Thread Anthony
Actually, in this case, you don't really need to bother with Ajax. Instead, 
just implement the random integer generation in Javascript and use the 
random integer to generate the URL in Javascript.

For future reference, though, the third argument to the ajax() function can 
be ":eval" (which tells it to evaluate the returned value as JS code) or a 
JS function (which will be passed the returned value). See the 
documentation.

Anthony

On Tuesday, June 14, 2016 at 1:58:32 AM UTC-4, Emmanuel Dsouza wrote:
>
> I was obviously waiting for your reply only.
> Ok Anthony I got what you said. But how do I get a variable through an 
> ajax call? Ajax only updates a tag id, right?
> How do I edit this to make it work?
>
> in controller:
>
> def index():
> return locals()
>
> in model:
>
> def retimage():
> from random import randint
> i=randint(0,2)
> return URL('static','images/%d.jpg' %(i))
>
> in view:
>
> {{extend 'layout.html'}}
> 
> window.setInterval(function(){
> {{getimage=retimage()}}
>   document.body.style.background-image = url("{{=getimage}}");
> }, 500);
> 
>
>
> I am confused on how to get a variable value though ajax calls. Please 
> help me on this.
>
> On Monday, June 13, 2016 at 8:46:28 PM UTC+5:30, Anthony wrote:
>>
>> You cannot call Python functions on the server from Javascript code 
>> running in the browser. The following line:
>>
>> {{getimage=retimage()}}
>>
>> will be called exactly once on the server *before *the HTML page is ever 
>> sent to the browser, and it will not result in anything being written into 
>> the Javascript code (if you look at the page source in the browser, you 
>> will see nothing there).
>>
>> If you need to retrieve images from the server without reloading the 
>> page, you must use Ajax.
>>
>> Anthony
>>
>>
>> On Monday, June 13, 2016 at 5:30:47 AM UTC-4, Emmanuel Dsouza wrote:
>>>
>>> CONTROLLER:
>>>
>>> def retimage():
>>> 
>>> k=["URL('static','images/1.jpg')","URL('static','images/2.jpg')","URL('static','images/3.jpg')"]
>>> from random import randint
>>> i=randint(0,2)
>>> return k[i]
>>> def index():
>>> return locals()
>>>
>>> VIEW:
>>>
>>> {{extend 'layout.html'}}
>>> 
>>> window.setInterval(function(){
>>> {{getimage=retimage()}}
>>>   document.body.background = url("{{=getimage}}");
>>> }, 5000);
>>> 
>>>
>>>
>>>
>>> How should I correct this?
>>>
>>

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