[web2py] Re: check boxes with is_in_set

2016-12-12 Thread Jim Russell
In your example, list_chart is not a list of strings, it is a list of 
tuples.

In my code, hostnames is just a list of hostnames.  e.g. 
('hostname1.example.com','hostname2.example.com')

I assume that you are trying to make the checkboxes default to true. For 
me, they defaulted to being checked.

On Monday, December 12, 2016 at 3:50:58 PM UTC-6, 黄祥 wrote:
>
> trying the tricks but got error when the checkbox is empty (1 or all 
> checkbox is empty, when all checkbox is on its work) :
> *e.g.*
> def test_form():
> redirect_url = 'test'
>
> list_chart = [(True, 'line'), 
>  (True, 'pie'), 
>  (True, 'bar') ]
>
> form = SQLFORM.factory(
> Field('chart', 'list:string', 
>  default = list_chart,
>  widget = SQLFORM.widgets.checkboxes.widget, 
>  requires = [IS_IN_SET(list_chart, multiple = True) ] ) )
> if form.process().accepted:
> chart = form.vars.chart
> line = form.vars.line[0]
> pie = form.vars.pie[1]
> bar = form.vars.bar[2]
>
> response.new_window = URL(redirect_url, args = [chart] )
> #response.new_window = URL(redirect_url, args = [line, pie, bar] )
> elif form.errors:
> response.flash = T('Form has errors')
> return dict(form = form)
>
> *Traceback error:*
> line = form.vars.chart[0]
> IndexError: list index out of range
>
> any idea how to face it using web2py way?
>
> thanks and best regards,
> stifan
>

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

2016-12-12 Thread Anthony
Run the following two queries using an external SQLite client (not web2py 
or the DAL):

SELECT  t_dog.id, t_dog.f_Dog_ID, t_dog.f_Name, t_dog.f_Breed, t_dog.
f_Verified, t_dog.f_Lookup, t_dog.f_User, t_dog.uuid FROM t_dog WHERE (t_dog
.id IN (1666,1667,1669,1671,1673,650,1675,652,1677,1678,1680,1688,1682,1411,
1684,661,662,664,1689,1690,667,1692,1694,1696,673,1698,1700,1706,683,685,691
,692,694,649,698,699,578,651,580,585,587,588,589,1686,1422,598,603,606,607,
610,613,615,618,659,634,635,638)) ORDER BY t_dog.f_Dog_ID LIMIT 20 OFFSET 0;

SELECT  t_dog.f_Name, t_dog.f_Breed, t_dog.f_Dog_ID, t_dog.id FROM t_dog 
WHERE (t_dog.id IN (1666,1667,1669,1671,1673,650,1675,652,1677,1678,1680,
1688,1682,1411,1684,661,662,664,1689,1690,667,1692,1694,1696,673,1698,1700,
1706,683,685,691,692,694,649,698,699,578,651,580,585,587,588,589,1686,1422,
598,603,606,607,610,613,615,618,659,634,635,638)) ORDER BY t_dog.f_Dog_ID, 
t_dog.id LIMIT 20 OFFSET 0;

Do you get exactly the same results in each case? If so, do you get a 
different top 20 results when you run:

SELECT  t_dog.id, t_dog.f_Dog_ID, t_dog.f_Name, t_dog.f_Breed, t_dog.
f_Verified, t_dog.f_Lookup, t_dog.f_User, t_dog.uuid FROM t_dog WHERE (t_dog
.id IN (1666,1667,1669,1671,1673,650,1675,652,1677,1678,1680,1688,1682,1411,
1684,661,662,664,1689,1690,667,1692,1694,1696,673,1698,1700,1706,683,685,691
,692,694,649,698,699,578,651,580,585,587,588,589,1686,1422,598,603,606,607,
610,613,615,618,659,634,635,638)) ORDER BY t_dog.f_Dog_ID;

Also, why do you have args=request.args in your call to the grid? The 
"args" argument is for args in the URL that you want the grid to preserve 
(i.e., args that are not related to the grid itself), but you don't appear 
to be using any request.args elsewhere in your code. In any case, even if 
you do have some args to preserve, you would not want to include all of 
request.args, because when a grid link is clicked, that will include the 
grid's args as well.

Anthony

On Monday, December 12, 2016 at 9:32:45 PM UTC-5, Scott Hunter wrote:
>
> This is the code for my grid:
>
> query = (db.t_classlevel.f_Trial==t.id)&(db.t_classlevel.id
> ==db.t_run.f_Class_Level)&(db.t_run.f_Dog==db.t_dog.id)
> fields = [db.t_dog.f_Name,db.t_dog.f_Breed,db.t_dog.f_Dog_ID]
> dog_ids = [x.id for x in db(query).select(db.t_dog.id
> ,distinct=True)]
> query = db.t_dog.id.belongs(dog_ids)
> # These two loops were added to demonstrate the problem
> for d in db(query).select(orderby=db.t_dog.f_Dog_ID):
> print d.f_Dog_ID, d.f_Name, d.f_Breed, d.f_User
> print"---"
> for d in 
> db(query).select(orderby=db.t_dog.f_Dog_ID,limitby=(0,20)):
> print d.f_Dog_ID, d.f_Name, d.f_Breed, d.f_User
> headers = 
> {'t_dog.f_Name':'Name','t_dog.f_Breed':'Breed','t_dog.f_Dog_ID':'UKI ID'}
> args = { 'maxtextlength':{'t_dog.f_Breed':30}, 
> 'orderby':db.t_dog.f_Name, 'editable':False, 'deletable':False}
> links = [{'header':'Manage Entry','body':lambda 
> r:A('Edit',_href=URL(f='entry_details',args=[t.f_UKI_ID,r.f_Dog_ID],user_signature=True))}]
> links.append( {'header':'Scribe Sheets',
> 'body': lambda r: SPAN( *[A(("" if i==0 else ", 
> ")+d.f_Date.strftime("%A"),
> 
> _href=URL(c='course',f='scribe_sheets',extension='pdf',vars={'set':'%d_%d_%d'%(t.f_UKI_ID,i,r.f_Dog_ID)},user_signature=True),
> _target="_blank") for i,d in 
> enumerate(tds)] ) } )
> form = SQLFORM.grid(query, csv=False, details=False, 
> fields=fields, headers=headers, searchable=False, create=False, 
> args=request.args,
> links = links, **args)
> return locals()
>
> This what gets printed:
>
> 99 Test Collie 2
>
> 1350 Tovah Border Collie 2
>
> 1582 Lexi Border Collie 2
>
> 1702 Bean Border Collie 2
>
> 1704 Ginger Border Collie 2
>
> 3865 Owen Border Collie 2
>
> 4099 Flirt Border Collie 2
>
> 5169 Super G Border Collie 2
>
> 5199 Emme Border Collie 2
>
> 5202 Beamer Border Collie 2
> ...
>
> ---
>
> 1702 Bean Border Collie 2
>
> 1704 Ginger Border Collie 2
>
> 3865 Owen Border Collie 2
>
> 4099 Flirt Border Collie 2
>
> 5169 Super G Border Collie 2
>
> 5203 Audie Border Collie 2
>
> The list that appears after the --- is EXACTLY what appears in the list 
> grid, once I have specified to sort on f_Dog_ID.
>
> These are the relevant SQL statements report via the response.toolabr:
>
> SELECT DISTINCT t_dog.id FROM t_dog, t_classlevel, t_run WHERE 
> (((t_classlevel.f_Trial = 196) AND (t_classlevel.id = t_run.f_Class_Level)) 
> AND (t_run.f_Dog = t_dog.id));
>
> 5.39ms
>
> SELECT  t_dog.id, t_dog.f_Dog_ID, t_dog.f_Name, t_dog.f_Breed, 
> t_dog.f_Verified, t_dog.f_Lookup, t_dog.f_User, t_dog.uuid FROM t_dog WHERE 
> (t_dog.id IN 
> (1666,1667,1669,1671,1673,650,1675,652,1677,1678,1680,1688,1682,1411,1684,661,662,664,1689,1690,667,1692,1694,1696,673,1698,1700,1706,683,685,691

[web2py] Re: Blog Template - Github

2016-12-12 Thread David
Sweet blog, Andrea! 

Simple and straight to the point. I made my blog just to beef up my resume and 
have something open sourced. My main project is jbtus.com a dating site. My 
blog is jbtus.com/blog

That template was for a client I had and I could definitely add those things in 
there for them. 


What are you working on now? 

-- 
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: Blog Template - Github

2016-12-12 Thread Andrea Engel

>
> Hi David,
>

I created a web2py blog as well a couple of month ago.
So If you need some inspiration, here is the link: meadowlark.de

I have to say, I don't maintain the blog on a regular basis as I just 
created it for myself to proof to myself I can do this.
However, I think a blog archive, maybe an "about me" section and maybe even 
a search bar for tags and keywords are helpful features for a blog.
As I said this is just inspiration for you. If you have any questions, feel 
free to contact me. 

I backup my work in Bitbucket, using SourceTree as my local repository. So 
If you need help with that, let me know.

-- 
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: Issues w/ Stripe?

2016-12-12 Thread Dave S


On Monday, December 12, 2016 at 6:04:24 PM UTC-8, Scott Hunter wrote:
>
> I have 2 appliances on a pythonanywhere web app, one a clone of the other, 
> both with a Stripe payment page.  One of them works, the other does not; 
> when the form gets submitted, the one that fails shows the following on the 
> browser console:
>
> [Error] Failed to load resource: the server responded with a status of 
> 401 (Unauthorized) (tokens, line 0)
>
> and shows the URL https://api.stripe.com/v1/tokens
>
> Stripe Support says I should "manually" use Stripe.js, but it looks like 
> gluon.contrib.stripe is already doing this.
>
> This has been working up until this past September (hasn't been tried 
> since then until today).
>
> Running web2py Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
>
> Any thoughts as to what might be the problem, or even better, how to fix 
> it?
>
>
Does each appliance need it's own Stripe identifier/token/mumblemumble ?

- Scott
>

/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: Problem with limitby?

2016-12-12 Thread Dave S


On Monday, December 12, 2016 at 3:55:27 PM UTC-8, Scott Hunter wrote:
>
> Web2py: version 2.14.6, on OSX (from source, python 2.7.x) and at 
> pythonanywhere (for the version that works properly).
>


Which DB engine are you using?

/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: Problem with limitby?

2016-12-12 Thread Scott Hunter
This is the code for my grid:

query = 
(db.t_classlevel.f_Trial==t.id)&(db.t_classlevel.id==db.t_run.f_Class_Level)&(db.t_run.f_Dog==db.t_dog.id)
fields = [db.t_dog.f_Name,db.t_dog.f_Breed,db.t_dog.f_Dog_ID]
dog_ids = [x.id for x in 
db(query).select(db.t_dog.id,distinct=True)]
query = db.t_dog.id.belongs(dog_ids)
# These two loops were added to demonstrate the problem
for d in db(query).select(orderby=db.t_dog.f_Dog_ID):
print d.f_Dog_ID, d.f_Name, d.f_Breed, d.f_User
print"---"
for d in db(query).select(orderby=db.t_dog.f_Dog_ID,limitby=(0,20)):
print d.f_Dog_ID, d.f_Name, d.f_Breed, d.f_User
headers = 
{'t_dog.f_Name':'Name','t_dog.f_Breed':'Breed','t_dog.f_Dog_ID':'UKI ID'}
args = { 'maxtextlength':{'t_dog.f_Breed':30}, 
'orderby':db.t_dog.f_Name, 'editable':False, 'deletable':False}
links = [{'header':'Manage Entry','body':lambda 
r:A('Edit',_href=URL(f='entry_details',args=[t.f_UKI_ID,r.f_Dog_ID],user_signature=True))}]
links.append( {'header':'Scribe Sheets',
'body': lambda r: SPAN( *[A(("" if i==0 else ", 
")+d.f_Date.strftime("%A"),

_href=URL(c='course',f='scribe_sheets',extension='pdf',vars={'set':'%d_%d_%d'%(t.f_UKI_ID,i,r.f_Dog_ID)},user_signature=True),
_target="_blank") for i,d in 
enumerate(tds)] ) } )
form = SQLFORM.grid(query, csv=False, details=False, fields=fields, 
headers=headers, searchable=False, create=False, args=request.args,
links = links, **args)
return locals()

This what gets printed:

99 Test Collie 2

1350 Tovah Border Collie 2

1582 Lexi Border Collie 2

1702 Bean Border Collie 2

1704 Ginger Border Collie 2

3865 Owen Border Collie 2

4099 Flirt Border Collie 2

5169 Super G Border Collie 2

5199 Emme Border Collie 2

5202 Beamer Border Collie 2
...

---

1702 Bean Border Collie 2

1704 Ginger Border Collie 2

3865 Owen Border Collie 2

4099 Flirt Border Collie 2

5169 Super G Border Collie 2

5203 Audie Border Collie 2

The list that appears after the --- is EXACTLY what appears in the list 
grid, once I have specified to sort on f_Dog_ID.

These are the relevant SQL statements report via the response.toolabr:

SELECT DISTINCT t_dog.id FROM t_dog, t_classlevel, t_run WHERE 
(((t_classlevel.f_Trial = 196) AND (t_classlevel.id = t_run.f_Class_Level)) AND 
(t_run.f_Dog = t_dog.id));

5.39ms

SELECT  t_dog.id, t_dog.f_Dog_ID, t_dog.f_Name, t_dog.f_Breed, 
t_dog.f_Verified, t_dog.f_Lookup, t_dog.f_User, t_dog.uuid FROM t_dog WHERE 
(t_dog.id IN 
(1666,1667,1669,1671,1673,650,1675,652,1677,1678,1680,1688,1682,1411,1684,661,662,664,1689,1690,667,1692,1694,1696,673,1698,1700,1706,683,685,691,692,694,649,698,699,578,651,580,585,587,588,589,1686,1422,598,603,606,607,610,613,615,618,659,634,635,638))
 ORDER BY t_dog.f_Dog_ID;

0.17ms

SELECT  t_dog.id, t_dog.f_Dog_ID, t_dog.f_Name, t_dog.f_Breed, 
t_dog.f_Verified, t_dog.f_Lookup, t_dog.f_User, t_dog.uuid FROM t_dog WHERE 
(t_dog.id IN 
(1666,1667,1669,1671,1673,650,1675,652,1677,1678,1680,1688,1682,1411,1684,661,662,664,1689,1690,667,1692,1694,1696,673,1698,1700,1706,683,685,691,692,694,649,698,699,578,651,580,585,587,588,589,1686,1422,598,603,606,607,610,613,615,618,659,634,635,638))
 ORDER BY t_dog.f_Dog_ID LIMIT 20 OFFSET 0;

0.14ms

SELECT count(*) FROM t_dog WHERE (t_dog.id IN 
(1666,1667,1669,1671,1673,650,1675,652,1677,1678,1680,1688,1682,1411,1684,661,662,664,1689,1690,667,1692,1694,1696,673,1698,1700,1706,683,685,691,692,694,649,698,699,578,651,580,585,587,588,589,1686,1422,598,603,606,607,610,613,615,618,659,634,635,638));

0.12ms

SELECT  t_dog.f_Name, t_dog.f_Breed, t_dog.f_Dog_ID, t_dog.id FROM t_dog WHERE 
(t_dog.id IN 
(1666,1667,1669,1671,1673,650,1675,652,1677,1678,1680,1688,1682,1411,1684,661,662,664,1689,1690,667,1692,1694,1696,673,1698,1700,1706,683,685,691,692,694,649,698,699,578,651,580,585,587,588,589,1686,1422,598,603,606,607,610,613,615,618,659,634,635,638))
 ORDER BY t_dog.f_Dog_ID, t_dog.id LIMIT 20 OFFSET 0;

On Monday, December 12, 2016 at 9:00:09 PM UTC-5, Anthony wrote:
>
> On Monday, December 12, 2016 at 6:55:27 PM UTC-5, Scott Hunter wrote:
>>
>> Web2py: version 2.14.6, on OSX (from source, python 2.7.x) and at 
>> pythonanywhere (for the version that works properly).
>>
>> I think this is the SQL you are asking for:
>>
>> PRAGMA foreign_keys=ON;
>>
>> 0.01ms
>>
>> SELECT  auth_group.id, auth_group.role, auth_group.description FROM 
>> auth_group WHERE (auth_group.role = 'admin');
>>
>> 0.40ms
>>
>> SELECT  auth_membership.id, auth_membership.user_id, 
>> auth_membership.group_id FROM auth_membership WHERE 
>> ((auth_membership.user_id = 1) AND (auth_membership.group_id = 1));
>>
>> 0.10ms
>>
>> SELECT  t_trial.id, t_trial.f_Name, t_trial.f_Club, t_trial.f_UKI_ID, 
>> t_trial.f_Date, t_trial.f_Days, t_trial.f_RunFee, t_trial.f_MSFee, 
>> t_trial.f_CourseOrder, t

[web2py] Issues w/ Stripe?

2016-12-12 Thread Scott Hunter
I have 2 appliances on a pythonanywhere web app, one a clone of the other, 
both with a Stripe payment page.  One of them works, the other does not; 
when the form gets submitted, the one that fails shows the following on the 
browser console:

[Error] Failed to load resource: the server responded with a status of 
401 (Unauthorized) (tokens, line 0)

and shows the URL https://api.stripe.com/v1/tokens

Stripe Support says I should "manually" use Stripe.js, but it looks like 
gluon.contrib.stripe is already doing this.

This has been working up until this past September (hasn't been tried since 
then until today).

Running web2py Version 2.14.6-stable+timestamp.2016.05.10.00.21.47

Any thoughts as to what might be the problem, or even better, how to fix it?

- 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: Problem with limitby?

2016-12-12 Thread Anthony
On Monday, December 12, 2016 at 6:55:27 PM UTC-5, Scott Hunter wrote:
>
> Web2py: version 2.14.6, on OSX (from source, python 2.7.x) and at 
> pythonanywhere (for the version that works properly).
>
> I think this is the SQL you are asking for:
>
> PRAGMA foreign_keys=ON;
>
> 0.01ms
>
> SELECT  auth_group.id, auth_group.role, auth_group.description FROM 
> auth_group WHERE (auth_group.role = 'admin');
>
> 0.40ms
>
> SELECT  auth_membership.id, auth_membership.user_id, auth_membership.group_id 
> FROM auth_membership WHERE ((auth_membership.user_id = 1) AND 
> (auth_membership.group_id = 1));
>
> 0.10ms
>
> SELECT  t_trial.id, t_trial.f_Name, t_trial.f_Club, t_trial.f_UKI_ID, 
> t_trial.f_Date, t_trial.f_Days, t_trial.f_RunFee, t_trial.f_MSFee, 
> t_trial.f_CourseOrder, t_trial.f_LocalKey, t_trial.f_LabelType, 
> t_trial.f_User, t_trial.f_PaperClasses, t_trial.uuid, t_trial.f_ReserveUser, 
> t_trial.f_Access, t_trial.f_xlsx, t_trial.f_Next_Contact, t_trial.f_Next_Raw, 
> t_trial.f_Next_Measurement, t_trial.f_Paid, t_trial.f_PaidWhen, 
> t_trial.f_PaidAmount, t_trial.f_PaymentID, t_trial.f_Status, 
> t_trial.f_Requested, t_trial.f_PaymentRecord FROM t_trial WHERE 
> (t_trial.f_UKI_ID = 1321);
>
> 0.17ms
>
> SELECT  auth_group.id, auth_group.role, auth_group.description FROM 
> auth_group WHERE (auth_group.role = 'admin');
>
> 0.04ms
>
> SELECT  auth_membership.id, auth_membership.user_id, auth_membership.group_id 
> FROM auth_membership WHERE ((auth_membership.user_id = 1) AND 
> (auth_membership.group_id = 1));
>
> 0.03ms
>
> SELECT  t_trialday.id, t_trialday.f_TrialDay, t_trialday.f_Date, 
> t_trialday.f_CourseNames, t_trialday.f_CLMap, t_trialday.f_SmallToTall, 
> t_trialday.f_Heights, t_trialday.f_Judge, t_trialday.f_ResultCounter, 
> t_trialday.f_LastResultCourse, t_trialday.f_LastResultClassCourse, 
> t_trialday.f_MCJFirst, t_trialday.uuid FROM t_trialday WHERE 
> (t_trialday.f_TrialDay LIKE '1321-%' ESCAPE '\') ORDER BY t_trialday.f_Date;
>
> 0.32ms
>
> SELECT DISTINCT t_dog.id FROM t_dog, t_classlevel, t_run WHERE 
> (((t_classlevel.f_Trial = 196) AND (t_classlevel.id = t_run.f_Class_Level)) 
> AND (t_run.f_Dog = t_dog.id));
>
> 5.50ms
>
> SELECT count(*) FROM t_dog WHERE (t_dog.id IN 
> (1666,1667,1669,1671,1673,650,1675,652,1677,1678,1680,1688,1682,1411,1684,661,662,664,1689,1690,667,1692,1694,1696,673,1698,1700,1706,683,685,691,692,694,649,698,699,578,651,580,585,587,588,589,1686,1422,598,603,606,607,610,613,615,618,659,634,635,638));
>
> 0.18ms
>
> SELECT  t_dog.f_Name, t_dog.f_Breed, t_dog.f_Dog_ID, t_dog.id FROM t_dog 
> WHERE (t_dog.id IN 
> (1666,1667,1669,1671,1673,650,1675,652,1677,1678,1680,1688,1682,1411,1684,661,662,664,1689,1690,667,1692,1694,1696,673,1698,1700,1706,683,685,691,692,694,649,698,699,578,651,580,585,587,588,589,1686,1422,598,603,606,607,610,613,615,618,659,634,635,638))
>  ORDER BY t_dog.f_Dog_ID, t_dog.id LIMIT 20 OFFSET 0;
>
> 0.15ms
>
> PRAGMA foreign_keys=ON;
>
>
> Now sure what you mean by "the SQL you are running"
>

You said, "If I do the query myself." What did you mean by that?

Are you sure you have the same dataset on your Mac? If you run the above 
SQL query (the last one) outside of web2py, do you get a different set of 
records from what you see in the grid?

Anthony 

>

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

2016-12-12 Thread Scott Hunter
Web2py: version 2.14.6, on OSX (from source, python 2.7.x) and at 
pythonanywhere (for the version that works properly).

I think this is the SQL you are asking for:

PRAGMA foreign_keys=ON;

0.01ms

SELECT  auth_group.id, auth_group.role, auth_group.description FROM auth_group 
WHERE (auth_group.role = 'admin');

0.40ms

SELECT  auth_membership.id, auth_membership.user_id, auth_membership.group_id 
FROM auth_membership WHERE ((auth_membership.user_id = 1) AND 
(auth_membership.group_id = 1));

0.10ms

SELECT  t_trial.id, t_trial.f_Name, t_trial.f_Club, t_trial.f_UKI_ID, 
t_trial.f_Date, t_trial.f_Days, t_trial.f_RunFee, t_trial.f_MSFee, 
t_trial.f_CourseOrder, t_trial.f_LocalKey, t_trial.f_LabelType, t_trial.f_User, 
t_trial.f_PaperClasses, t_trial.uuid, t_trial.f_ReserveUser, t_trial.f_Access, 
t_trial.f_xlsx, t_trial.f_Next_Contact, t_trial.f_Next_Raw, 
t_trial.f_Next_Measurement, t_trial.f_Paid, t_trial.f_PaidWhen, 
t_trial.f_PaidAmount, t_trial.f_PaymentID, t_trial.f_Status, 
t_trial.f_Requested, t_trial.f_PaymentRecord FROM t_trial WHERE 
(t_trial.f_UKI_ID = 1321);

0.17ms

SELECT  auth_group.id, auth_group.role, auth_group.description FROM auth_group 
WHERE (auth_group.role = 'admin');

0.04ms

SELECT  auth_membership.id, auth_membership.user_id, auth_membership.group_id 
FROM auth_membership WHERE ((auth_membership.user_id = 1) AND 
(auth_membership.group_id = 1));

0.03ms

SELECT  t_trialday.id, t_trialday.f_TrialDay, t_trialday.f_Date, 
t_trialday.f_CourseNames, t_trialday.f_CLMap, t_trialday.f_SmallToTall, 
t_trialday.f_Heights, t_trialday.f_Judge, t_trialday.f_ResultCounter, 
t_trialday.f_LastResultCourse, t_trialday.f_LastResultClassCourse, 
t_trialday.f_MCJFirst, t_trialday.uuid FROM t_trialday WHERE 
(t_trialday.f_TrialDay LIKE '1321-%' ESCAPE '\') ORDER BY t_trialday.f_Date;

0.32ms

SELECT DISTINCT t_dog.id FROM t_dog, t_classlevel, t_run WHERE 
(((t_classlevel.f_Trial = 196) AND (t_classlevel.id = t_run.f_Class_Level)) AND 
(t_run.f_Dog = t_dog.id));

5.50ms

SELECT count(*) FROM t_dog WHERE (t_dog.id IN 
(1666,1667,1669,1671,1673,650,1675,652,1677,1678,1680,1688,1682,1411,1684,661,662,664,1689,1690,667,1692,1694,1696,673,1698,1700,1706,683,685,691,692,694,649,698,699,578,651,580,585,587,588,589,1686,1422,598,603,606,607,610,613,615,618,659,634,635,638));

0.18ms

SELECT  t_dog.f_Name, t_dog.f_Breed, t_dog.f_Dog_ID, t_dog.id FROM t_dog WHERE 
(t_dog.id IN 
(1666,1667,1669,1671,1673,650,1675,652,1677,1678,1680,1688,1682,1411,1684,661,662,664,1689,1690,667,1692,1694,1696,673,1698,1700,1706,683,685,691,692,694,649,698,699,578,651,580,585,587,588,589,1686,1422,598,603,606,607,610,613,615,618,659,634,635,638))
 ORDER BY t_dog.f_Dog_ID, t_dog.id LIMIT 20 OFFSET 0;

0.15ms

PRAGMA foreign_keys=ON;


Now sure what you mean by "the SQL you are running"


On Monday, December 12, 2016 at 3:43:19 PM UTC-5, Anthony wrote:
>
> What version of web2py? Also, show us the SQL generated by web2py (check 
> db._timings, which you can view via response.toolbar()) as well as the SQL 
> you are running.
>
> Anthony
>
> On Sunday, December 11, 2016 at 11:49:53 PM UTC-5, Scott Hunter wrote:
>>
>> I'm using a SQLFORM.grid, using a query of the form:
>>
>> db.t_dog.id.belongs(dog_ids)
>>
>>
>>
>> But the listing is erratic; some records only appear when the list is 
>> sorted certain ways (except for the last page); entries on each page are in 
>> order, but entries between pages overlap.
>>
>> I thought the problem might be how grid uses limit by to get the records 
>> for a given pages, and sure enough, if I do the query myself, the query 
>> results match what appears on each page.
>>
>> For example, when sorting by code #, the start of the whole result looks 
>> like:
>>
>> 99 Test Collie 2
>>> 1350 Tovah Border Collie 2
>>> 1582 Lexi Border Collie 2
>>> 
>>> *1702 Bean Border Collie 2*
>>>
>>>
>>> *1704 Ginger Border Collie 23865 Owen Border Collie 24099 
>>> Flirt Border Collie 2**5169 Super G Border Collie 2*
>>> 5199 Emme Border Collie 2
>>> 5202 Beamer Border Collie 2
>>>* 5203 Audie Border Collie 2*
>>
>>
>> But using limitby(0,20), I get:
>>
>> 1702 Bean Border Collie 2
>>> 1704 Ginger Border Collie 2
>>> 3865 Owen Border Collie 2
>>> 4099 Flirt Border Collie 2
>>> 5169 Super G Border Collie 2
>>> 5203 Audie Border Collie 2
>>
>>
>> This is on OS X using sqlite; it seems to be fine using sqlite on Linux.
>>
>

-- 
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] Problem with limitby?

2016-12-12 Thread Scott Hunter
I am using the same orderby whether using limitby or not, as I stated. 
 Thus, using orderby alone, I should get the same first 20 records in the 
same order as I would get by using limitby(0,20); I am not (again, as 
shown)  In fact, I get the same sequence using limitby(0,20) as appears on 
the first page of the SQLFORM.grid when sorted on the appropriate column.

On Monday, December 12, 2016 at 1:42:57 PM UTC-5, Richard wrote:
>
> Hello Scott,
>
> I am not sure I understand the problem... But for sure limit by alone will 
> never return you the same set of results as you didn't specify the order in 
> which you want the result to be and the analyser just favor the faster 
> quering path... So don't expect limitby alone to return the same set of 
> data each time you query the database, if it happen to be the same set it 
> just matter of chance. By using orederby you should see your problem go 
> away except if you really had found an issue that would be implementation 
> specific as you seems to point us in that direction. You can orderby over 
> table id if you have not special requirement on that matter.
>
> Richard
>
> On Sun, Dec 11, 2016 at 11:49 PM, Scott Hunter  > wrote:
>
>> I'm using a SQLFORM.grid, using a query of the form:
>>
>> db.t_dog.id.belongs(dog_ids)
>>
>>
>>
>> But the listing is erratic; some records only appear when the list is 
>> sorted certain ways (except for the last page); entries on each page are in 
>> order, but entries between pages overlap.
>>
>> I thought the problem might be how grid uses limit by to get the records 
>> for a given pages, and sure enough, if I do the query myself, the query 
>> results match what appears on each page.
>>
>> For example, when sorting by code #, the start of the whole result looks 
>> like:
>>
>> 99 Test Collie 2
>>> 1350 Tovah Border Collie 2
>>> 1582 Lexi Border Collie 2
>>> 
>>> *1702 Bean Border Collie 2*
>>>
>>>
>>> *1704 Ginger Border Collie 23865 Owen Border Collie 24099 
>>> Flirt Border Collie 2**5169 Super G Border Collie 2*
>>> 5199 Emme Border Collie 2
>>> 5202 Beamer Border Collie 2
>>>* 5203 Audie Border Collie 2*
>>
>>
>> But using limitby(0,20), I get:
>>
>> 1702 Bean Border Collie 2
>>> 1704 Ginger Border Collie 2
>>> 3865 Owen Border Collie 2
>>> 4099 Flirt Border Collie 2
>>> 5169 Super G Border Collie 2
>>> 5203 Audie Border Collie 2
>>
>>
>> This is on OS X using sqlite; it seems to be fine using sqlite on Linux.
>>
>> -- 
>> 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+un...@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: check boxes with is_in_set

2016-12-12 Thread 黄祥
trying the tricks but got error when the checkbox is empty (1 or all 
checkbox is empty, when all checkbox is on its work) :
*e.g.*
def test_form():
redirect_url = 'test'

list_chart = [(True, 'line'), 
 (True, 'pie'), 
 (True, 'bar') ]

form = SQLFORM.factory(
Field('chart', 'list:string', 
 default = list_chart,
 widget = SQLFORM.widgets.checkboxes.widget, 
 requires = [IS_IN_SET(list_chart, multiple = True) ] ) )
if form.process().accepted:
chart = form.vars.chart
line = form.vars.line[0]
pie = form.vars.pie[1]
bar = form.vars.bar[2]

response.new_window = URL(redirect_url, args = [chart] )
#response.new_window = URL(redirect_url, args = [line, pie, bar] )
elif form.errors:
response.flash = T('Form has errors')
return dict(form = form)

*Traceback error:*
line = form.vars.chart[0]
IndexError: list index out of range

any idea how to face it using web2py way?

thanks and best regards,
stifan

-- 
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: form.process().accepted: question..

2016-12-12 Thread Anthony
You could instead use _readonly=True or put a copy in a hidden field with 
the same name. But keep in mind that you should still validate the data on 
the server. Alternatively, presumably you have access to the original value 
on the server from the database record, so why not just use that instead of 
pulling the value from the form submission?

Anthony

On Monday, December 12, 2016 at 11:36:04 AM UTC-5, Ramos wrote:
>
> i dont know how inside a form to block a field from users changing it.
> But I need the value of that field because its a computed field.
>
> If i do this 
> db.table.uuid.widget=lambda f, v: SQLFORM.widgets.string.widget(f, v, 
> _disabled=True)
>
> then in 
> if form.process().accepted:
> form.vars.uuid=None !!!
>
>
> Thank you
>
>
>

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

2016-12-12 Thread Anthony
What version of web2py? Also, show us the SQL generated by web2py (check 
db._timings, which you can view via response.toolbar()) as well as the SQL 
you are running.

Anthony

On Sunday, December 11, 2016 at 11:49:53 PM UTC-5, Scott Hunter wrote:
>
> I'm using a SQLFORM.grid, using a query of the form:
>
> db.t_dog.id.belongs(dog_ids)
>
>
>
> But the listing is erratic; some records only appear when the list is 
> sorted certain ways (except for the last page); entries on each page are in 
> order, but entries between pages overlap.
>
> I thought the problem might be how grid uses limit by to get the records 
> for a given pages, and sure enough, if I do the query myself, the query 
> results match what appears on each page.
>
> For example, when sorting by code #, the start of the whole result looks 
> like:
>
> 99 Test Collie 2
>> 1350 Tovah Border Collie 2
>> 1582 Lexi Border Collie 2
>> 
>> *1702 Bean Border Collie 2*
>>
>>
>> *1704 Ginger Border Collie 23865 Owen Border Collie 24099 
>> Flirt Border Collie 2**5169 Super G Border Collie 2*
>> 5199 Emme Border Collie 2
>> 5202 Beamer Border Collie 2
>>* 5203 Audie Border Collie 2*
>
>
> But using limitby(0,20), I get:
>
> 1702 Bean Border Collie 2
>> 1704 Ginger Border Collie 2
>> 3865 Owen Border Collie 2
>> 4099 Flirt Border Collie 2
>> 5169 Super G Border Collie 2
>> 5203 Audie Border Collie 2
>
>
> This is on OS X using sqlite; it seems to be fine using sqlite on Linux.
>

-- 
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: Subquery question

2016-12-12 Thread Gael Princivalle
I have to learn more about it. I've choose geometry as geography don't 
support st_within that'is the function that I need for testing in a point 
is inside a map area.

Il giorno lunedì 12 dicembre 2016 20:46:47 UTC+1, Pierre ha scritto:
>
>
> my guess is you are not "feeding" the geometry field with the correct data
> the "natural" container for raw (default) lat lon is a geography field : 
> *geography()*
> if instead you want to use a *geometry()*,  you need to transform the 
> original data from EPSG:4326 to another coordinates system
>
> I use such fields in my app:
>
> *Field('g','geometry('',2154,2)',required=True)*
>
> this one receives transformed lat, lon from EPSG:4326 to EPSG:2154
>
> you can easily manage your transforms with the python* pyproj* module
>

-- 
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: Subquery question

2016-12-12 Thread Pierre

my guess is you are not "feeding" the geometry field with the correct data
the "natural" container for raw (default) lat lon is a geography field : 
*geography()*
if instead you want to use a *geometry()*,  you need to transform the 
original data from EPSG:4326 to another coordinates system

I use such fields in my app:

*Field('g','geometry('',2154,2)',required=True)*

this one receives transformed lat, lon from EPSG:4326 to EPSG:2154

you can easily manage your transforms with the python* pyproj* module

-- 
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] Permission Denied

2016-12-12 Thread J Boggy
[Error 13] Permission denied: 
'root/myapp/applications/welcome/static/original/music.filename.8e.mp4
How should i granted

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

2016-12-12 Thread Jacinto Parga

Hi, 

I have recently made a security analisys in a web application deployed with 
web2py in Google App Engine. A jquery 1.12.2 vulnerability was the result:



-- 
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] Problem with limitby?

2016-12-12 Thread Richard Vézina
Hello Scott,

I am not sure I understand the problem... But for sure limit by alone will
never return you the same set of results as you didn't specify the order in
which you want the result to be and the analyser just favor the faster
quering path... So don't expect limitby alone to return the same set of
data each time you query the database, if it happen to be the same set it
just matter of chance. By using orederby you should see your problem go
away except if you really had found an issue that would be implementation
specific as you seems to point us in that direction. You can orderby over
table id if you have not special requirement on that matter.

Richard

On Sun, Dec 11, 2016 at 11:49 PM, Scott Hunter  wrote:

> I'm using a SQLFORM.grid, using a query of the form:
>
> db.t_dog.id.belongs(dog_ids)
>
>
>
> But the listing is erratic; some records only appear when the list is
> sorted certain ways (except for the last page); entries on each page are in
> order, but entries between pages overlap.
>
> I thought the problem might be how grid uses limit by to get the records
> for a given pages, and sure enough, if I do the query myself, the query
> results match what appears on each page.
>
> For example, when sorting by code #, the start of the whole result looks
> like:
>
> 99 Test Collie 2
>> 1350 Tovah Border Collie 2
>> 1582 Lexi Border Collie 2
>>
>> *1702 Bean Border Collie 2*
>>
>>
>> *1704 Ginger Border Collie 23865 Owen Border Collie 24099
>> Flirt Border Collie 2**5169 Super G Border Collie 2*
>> 5199 Emme Border Collie 2
>> 5202 Beamer Border Collie 2
>>* 5203 Audie Border Collie 2*
>
>
> But using limitby(0,20), I get:
>
> 1702 Bean Border Collie 2
>> 1704 Ginger Border Collie 2
>> 3865 Owen Border Collie 2
>> 4099 Flirt Border Collie 2
>> 5169 Super G Border Collie 2
>> 5203 Audie Border Collie 2
>
>
> This is on OS X using sqlite; it seems to be fine using sqlite on Linux.
>
> --
> 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: Blog Template - Github

2016-12-12 Thread Marlysson Silva
Awesome.. Great work..

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

2016-12-12 Thread Richard Vézina
Hello Boggy,

Are you installing web2py over your own server or or cloud service?

If it your own server can you details what you have done so far, are you
trying to install web2py by hand or you use one the scripts provided with
web2py?

Richard

On Sat, Dec 10, 2016 at 2:21 AM, J Boggy  wrote:

> thz i have been solved.
> Now other error is i cannot import some module althougn i have been
> installed and tested on python. But in web2py controller i can't import
> module
>
> --
> 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: Blog Template - Github

2016-12-12 Thread David
It's up there! Thanks for the help, man. I had to create a new github repo 
because it was throwing me errors but here's the link:

https://github.com/frontEndDevv/blog-template


On Wednesday, December 7, 2016 at 2:03:15 PM UTC-6, David wrote:
>
> Hello, 
>
>
> I made my personal website with web2py a month or two ago. I's a dating 
> website and I haven't encountered any problems, although I have not had the 
> need to scale or anything just yet. 
>
>
> I've made a blog template for a client and I want to share it with anyone 
> that may be interested so that they can worry about the content of their 
> website and not the inner workings. The blog is located at 
> *hypenews.pythonanywhere.com 
> *. You can create posts, edit 
> comments, and change your categories/slideshow image at 
> *hypenews.pythonanywhere.com/init/default/hypenewsthehypenewsqq123 
> *
>
> If anyone has any feedback or ideas that I could add into it then I'd 
> appreciate that. I'm actively maintaining it. 
>
> I intend for it to be open source on github, but I don't know how to push 
> an app to github. Can Someone give me the steps or point me to something 
> that I can read? 
>
>
> Please note that this app is hosted for free at the moment just so others 
> can see a finished product. it expires in 3 months. i'll continue to use it 
> in conjunction with my own website though. 
>
>
> Blog - *hypenews.pythonanywhere.com* 
> Create post- 
> *hypenews.pythonanywhere.com/init/default/hypenewsthehypenewsqq123* 
> 
>

-- 
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] form.process().accepted: question..

2016-12-12 Thread António Ramos
i dont know how inside a form to block a field from users changing it.
But I need the value of that field because its a computed field.

If i do this
db.table.uuid.widget=lambda f, v: SQLFORM.widgets.string.widget(f, v,
_disabled=True)

then in
if form.process().accepted:
form.vars.uuid=None !!!


Thank you

-- 
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: Non-Editable field in SQLFORM

2016-12-12 Thread Fabiano Almeida
db.table.field.writable = False -> don't write
db.table.field.readable = False  -> don't show (hide)

2016-12-12 14:17 GMT-02:00 lyn2py :

> It will always be allowed to take a value in insert, a value that you
> assign it to, for example, via "default", like so:
> db.table.field.default = some_value
>
> To make the field non-editable to the end user, use:
> db.table.field.editable = False
> ...
> form = SQLFORM(db.table)
>
> for the above examples, replace *table* with *your table name* and *field*
> with *your field name*.
>
> You can find out the details in Chapter in 06 The database abstraction
> layer
> 
>  and 07 Forms and validators
> 
>
>
> On Friday, December 9, 2016 at 11:38:55 PM UTC+8, Amit Kumar Modak wrote:
>>
>> Hello,
>>
>> How can I make a field non-editable in SQLFORM, while it should be
>> allowed to take a value in insert.
>>
>>
>> Regards,
>> Amit
>>
> --
> 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: Non-Editable field in SQLFORM

2016-12-12 Thread lyn2py
It will always be allowed to take a value in insert, a value that you 
assign it to, for example, via "default", like so:
db.table.field.default = some_value

To make the field non-editable to the end user, use:
db.table.field.editable = False
...
form = SQLFORM(db.table)

for the above examples, replace *table* with *your table name* and *field* 
with *your field name*.

You can find out the details in Chapter in 06 The database abstraction layer 

 and 07 Forms and validators 



On Friday, December 9, 2016 at 11:38:55 PM UTC+8, Amit Kumar Modak wrote:
>
> Hello,
>
> How can I make a field non-editable in SQLFORM, while it should be allowed 
> to take a value in insert.
>
>
> Regards,
> Amit
>

-- 
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: Forcing the translation of a text

2016-12-12 Thread Yoel Benitez Fonseca
It was my fault, all the time. I forgot that theres is some code in my
model with create the new record before the segment i have share in
this thread.

Sorry for the time.

2016-12-12 9:43 GMT-05:00 Yoel Benitez Fonseca :
> This not worked for me, the idea was to insert a folder record with
> the name in the user language, hence translating "My Dashboard" to
> anything if we got a translation string for that language.
>
> Apart from that part, all the texts are being  translated without any
> problem, u
>
>
>
> 2016-12-12 9:09 GMT-05:00 Yoel Benítez Fonseca :
>> On Sun, 11 Dec 2016 15:32:41 -0800 (PST)
>> Marlysson Silva  wrote:
>>
>>> You can overrride programatically the language getting accepted
>>> language header from client using :
>>>
>>> language = response.headers['Accept-Language'].lower()
>>>
>>> T.force(language)
>>
>> I think got what is wrong, the controller in particular with execute my
>> code was on a ajax request, i have tested on a normal request and it do
>> what is suppose to do.
>>
>> Thanks folks, i'll test setting is programatically.
>>
>>>
>>> Em sábado, 10 de dezembro de 2016 11:18:46 UTC-3, Yoel Benitez
>>> Fonseca escreveu:
>>> >
>>> > Hi, folks, this is in my controller:
>>> >
>>> >
>>> > if not dash_list:
>>> > # create a new dashboard
>>> > d_id = db.dashboard.insert(
>>> > name=T('My Dashboard', lazy=False), item_list=[])
>>> > query = (db.dashboard.id > 0)
>>> > query &= (db.dashboard.created_by == auth.user.id)
>>> > dash_list = db(query).select(db.dashboard.ALL)
>>> > auth.add_permission(0, 'owner', db.dashboard, d_id)
>>> >
>>> > The logic is simple, if there is not a dashboard create one called
>>> > "My dashboard". The problem comes from not English users, they get
>>> > the same name.
>>> >
>>> > I have verified the languages files, and the accepted language
>>> > header, all is fine, in the shell it work's correctly - prior
>>> > setting the language oc.
>>> >
>>> > Some idea ?
>>> >
>>>
>>
>
>
>
> --
> Yoel Benítez Fonseca
> http://redevil.cubava.cu/
> $ python -c "import this"



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Re: Forcing the translation of a text

2016-12-12 Thread Yoel Benitez Fonseca
This not worked for me, the idea was to insert a folder record with
the name in the user language, hence translating "My Dashboard" to
anything if we got a translation string for that language.

Apart from that part, all the texts are being  translated without any
problem, u



2016-12-12 9:09 GMT-05:00 Yoel Benítez Fonseca :
> On Sun, 11 Dec 2016 15:32:41 -0800 (PST)
> Marlysson Silva  wrote:
>
>> You can overrride programatically the language getting accepted
>> language header from client using :
>>
>> language = response.headers['Accept-Language'].lower()
>>
>> T.force(language)
>
> I think got what is wrong, the controller in particular with execute my
> code was on a ajax request, i have tested on a normal request and it do
> what is suppose to do.
>
> Thanks folks, i'll test setting is programatically.
>
>>
>> Em sábado, 10 de dezembro de 2016 11:18:46 UTC-3, Yoel Benitez
>> Fonseca escreveu:
>> >
>> > Hi, folks, this is in my controller:
>> >
>> >
>> > if not dash_list:
>> > # create a new dashboard
>> > d_id = db.dashboard.insert(
>> > name=T('My Dashboard', lazy=False), item_list=[])
>> > query = (db.dashboard.id > 0)
>> > query &= (db.dashboard.created_by == auth.user.id)
>> > dash_list = db(query).select(db.dashboard.ALL)
>> > auth.add_permission(0, 'owner', db.dashboard, d_id)
>> >
>> > The logic is simple, if there is not a dashboard create one called
>> > "My dashboard". The problem comes from not English users, they get
>> > the same name.
>> >
>> > I have verified the languages files, and the accepted language
>> > header, all is fine, in the shell it work's correctly - prior
>> > setting the language oc.
>> >
>> > Some idea ?
>> >
>>
>



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Re: Forcing the translation of a text

2016-12-12 Thread Yoel Benítez Fonseca
On Sun, 11 Dec 2016 15:32:41 -0800 (PST)
Marlysson Silva  wrote:

> You can overrride programatically the language getting accepted
> language header from client using :
> 
> language = response.headers['Accept-Language'].lower()
> 
> T.force(language)

I think got what is wrong, the controller in particular with execute my
code was on a ajax request, i have tested on a normal request and it do
what is suppose to do.

Thanks folks, i'll test setting is programatically.

> 
> Em sábado, 10 de dezembro de 2016 11:18:46 UTC-3, Yoel Benitez
> Fonseca escreveu:
> >
> > Hi, folks, this is in my controller: 
> >
> >
> > if not dash_list: 
> > # create a new dashboard 
> > d_id = db.dashboard.insert( 
> > name=T('My Dashboard', lazy=False), item_list=[]) 
> > query = (db.dashboard.id > 0) 
> > query &= (db.dashboard.created_by == auth.user.id) 
> > dash_list = db(query).select(db.dashboard.ALL) 
> > auth.add_permission(0, 'owner', db.dashboard, d_id) 
> >
> > The logic is simple, if there is not a dashboard create one called
> > "My dashboard". The problem comes from not English users, they get
> > the same name. 
> >
> > I have verified the languages files, and the accepted language 
> > header, all is fine, in the shell it work's correctly - prior
> > setting the language oc. 
> >
> > Some idea ? 
> >  
> 

-- 
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: Subquery question

2016-12-12 Thread Gael Princivalle
Thank you Pierre I've add this field to the db:
Field('geopoint', 'geometry()', compute=lambda r: 'POINT({0} {1})'.format(
float(r['longitude']),float(r['latitude']))),

and I've also substitute the geometry filed with this new geopoint filed in 
the query:
events_comments = db((db.events_comments.id > 0) & (db.
events_comments.commented_event.geopoint.st_within(geoPolygon((session.west, 
session.south), (session.east, session.south), (session.east, session.north
), (session.west, session.north), (session.west, session.south).select(
limitby=(0,3),
orderby=~db.events_comments.id
)

Ticket still the same:
'Field' object has no attribute 'geopoint'

Anyway I don't search anymore for a solution concerning this ticket, I'm 
not able by myself to resolve it and it seems that the web2py guys don't 
know why I have it.

I would like to turn around it making something that perhaps is called a 
subquery.
Here i get the events form the area:
events = db(db.events.geometry.st_within(geoPolygon((session.west, session.
south), (session.east, session.south), (session.east, session.north), (
session.west, session.north), (session.west, session.south.select()

And I would like to modify this query for having only the comments from the 
selected events, something like:
events_comments = db(db.events_comments. 
commented_event == 
events.id).select(
limitby=(0,3),
orderby=~db.events_comments.id
)

Il giorno lunedì 12 dicembre 2016 10:24:41 UTC+1, Pierre ha scritto:
>
> don't know if this relates to your problem
> but I have had issues with the *geoPoint* object in the past and as soon 
> as I removed it from my code everything worked fine.
>
> Try with :
>
> pt = 'POINT({0} {1})'.format(lon,lat)
>
> instead of a geoPoint
>

-- 
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] Scheduler in systemd environment (running very long tasks)

2016-12-12 Thread Zbigniew Pomianowski
First of all: I decided to use web2py for my purposes becase it is awesome 
;)
I believe it is not a web2py's bug or anything like related thing. It can 
be more OS and systemd related issue.

Let me explain what I do and what is the environment. I work in a lab where 
we try to automate many tests on physical devices (like STBs and phones).
I have a single source for master (ubuntu server) and slave servers (ubuntu 
server/desktop). Master is configured with uwsgi+nginx+mysql+web2py 
services. Then I do have slaves that use the same source, but can spawn 
tests within scheduler processes.

I need to connect many physical devices to the  slaves (climate chambers, 
arduino for IR control, v4l2 capture cards, ethernet controled power 
sources, power supply instruments, measurement instruments... bla bla bla).
I decided to make a GUI using qooxdoo where user can write a python code 
that allocates physical devices and run specific test scenarios to examine 
DUT (Device Under Test) condition.
These tests sometimes need to be run for tens of hours. So the workflow can 
be described as:

   - user writes a script
   - the test is enqueued as a task in db (JobGraph does a perfect work for 
   me because I need to control the execution sequence mainly because of the 
   existence of physical devices like climate chambers and etc; allocated lab 
   instrument cannot be used by two tests at the same time, jobgraph can yield 
   it) 
   - every slave has it's unique group-name
  - DUTs and lab instruments are bound to the specific slave - 
  scheduler group-name
   - slave executes the test scenario programmed by user
  - test is nothing more than overriden TestUnit
  - every LAB instrument has child process which logs parameters 
  (temperature, humidity, voltage bla bla bla)
  - for DUT is also created instance of a class that spawns child 
  processes (video freeze detection based on gstreamer, udp/tcp/telnet 
  interface to interract with STB)
  - in test scenario I have plenty of sleeps - test scenario demands 
  for example that STB stays in a cimate chamber for 20h in specific temp 
and 
  humidity
   
My systemd service file looks like this:
[Unit]
Description=ATMS workers
After=network-online.target
Wants=network-online.target

[Service]
User=
Restart=on-failure
RestartSec=120
Environment=DISPLAY=: # usually 0
Environment=XAUTHORITY=/home//.Xauthority
EnvironmentFile={{INSTALL}}/web2py_venv/web2py/applications/atms/private/
atms.env
ExecStartPre=/bin/sh -c "${WEB2PYPY} ${WEB2PY} -S atms -M -R 
${WEB2PYDIR}/applications/atms/systemd/on_start.py -P"
ExecStart=/bin/sh -c "${WEB2PYPY} ${WEB2PY} -K atms:%H,atms:%H"
ExecStop=/bin/sh -c "${WEB2PYPY} ${WEB2PY} -S atms -M -R 
${WEB2PYDIR}/applications/atms/systemd/on_stop.py -P"

[Install]
# graphical because i had to make some kind of preview with ximagesink for 
fast lookup if video is ok on STB
WantedBy=graphical.target
Alias=atms.service


I realised that for very long test (last one was planned to be longer than 
100h) i got  sth like this in logs:
gru 11 12:01:52 slaveX sh[2184]:   File 
"/atms/web2py_venv/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
1435, in
gru 11 12:01:52 slaveX sh[2184]: return str(long(obj))
gru 11 12:01:52 slaveX sh[2184]:   File 
"/atms/web2py_venv/web2py/gluon/packages/dal/pydal/objects.py", line 82, in 
, 'Traceback (most recent call last):\n  File 
"/tmp/taskId10672_caseId852_duts32/test_script.py", line 90, in 
test_example\nsleep(M10)\n  File 
"/atms/web2py_venv/web2py/gluon/scheduler.py", line 702, in \n   
 signal.signal(signal.SIGTERM, lambda signum, stack_frame: 
sys.exit(1))\nSystemExit: 1\n')]
gru 11 12:01:34 slaveX sh[2184]: DEBUG:web2py.app.atms:new task report: 
FAILED
gru 11 12:01:34 slaveX sh[2184]: DEBUG:web2py.app.atms:   traceback: 
Traceback (most recent call last):
.. and many many many tracebacks with errors after that

Line 702 in scheduler.py is:
signal.signal(signal.SIGTERM, lambda signum, stack_frame: sys.exit(1))
in scheduler's loop function. What does it mean? The process was 
stopped because kernel/systemd sth else decided to do so??
Long sleep calls can have sth in common?
Did anyone encountered similar problems? Do you have any idea how to 
prevent against such behavior?

Thank you in advance for any response :)

-- 
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: Forcing the translation of a text

2016-12-12 Thread 黄祥
yes, it worked, learned it from web2py admin app (on bottom center, it used 
drop down language for change the language)
just curious what is the difference with the header (accept-language)

best regards,
stifan

-- 
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] Cannot impor module from application

2016-12-12 Thread J Boggy
When i setup web2py nginx web2py 
It created web2py app at /home/www-data
But i don't permission to accept python installed library. how should i solve 
this to get permission.

-- 
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: Forcing the translation of a text

2016-12-12 Thread Marlysson Silva
I didn't knew about existence of the language key in cookies of response..

Great..One questions.. works?

Em segunda-feira, 12 de dezembro de 2016 01:56:29 UTC-3, 黄祥 escreveu:
>
> what is the difference between?
> T.force(request.cookies['language'].value) # learn from web2py admin app
> and
> T.force(response.headers['Accept-Language'].lower() )
>
> thanks and best regards,
> stifan
>

-- 
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: Blog Template - Github

2016-12-12 Thread Marlysson Silva
Great , I saw that you push your app in pack format..

You should push the application folder that includes 
controllers/models/views/ etc..

Give git init within application folder and do procedures above..

Em segunda-feira, 12 de dezembro de 2016 01:45:02 UTC-3, David escreveu:
>
> It worked perfectly, thanks!
>
> However, it won't let me open the web2py file. It just downloads it. Mind 
> checking it out?
>
> https://github.com/frontEndDevv/blog
>
>
>
> On Wednesday, December 7, 2016 at 2:03:15 PM UTC-6, David wrote:
>>
>> Hello, 
>>
>>
>> I made my personal website with web2py a month or two ago. I's a dating 
>> website and I haven't encountered any problems, although I have not had the 
>> need to scale or anything just yet. 
>>
>>
>> I've made a blog template for a client and I want to share it with anyone 
>> that may be interested so that they can worry about the content of their 
>> website and not the inner workings. The blog is located at 
>> *hypenews.pythonanywhere.com 
>> *. You can create posts, edit 
>> comments, and change your categories/slideshow image at 
>> *hypenews.pythonanywhere.com/init/default/hypenewsthehypenewsqq123 
>> *
>>
>> If anyone has any feedback or ideas that I could add into it then I'd 
>> appreciate that. I'm actively maintaining it. 
>>
>> I intend for it to be open source on github, but I don't know how to push 
>> an app to github. Can Someone give me the steps or point me to something 
>> that I can read? 
>>
>>
>> Please note that this app is hosted for free at the moment just so others 
>> can see a finished product. it expires in 3 months. i'll continue to use it 
>> in conjunction with my own website though. 
>>
>>
>> Blog - *hypenews.pythonanywhere.com* 
>> 
>> Create post- 
>> *hypenews.pythonanywhere.com/init/default/hypenewsthehypenewsqq123* 
>> 
>>
>

-- 
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: Subquery question

2016-12-12 Thread Pierre
don't know if this relates to your problem
but I have had issues with the *geoPoint* object in the past and as soon as 
I removed it from my code everything worked fine.

Try with :

pt = 'POINT({0} {1})'.format(lon,lat)

instead of a geoPoint

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