Re: [web2py] Re: nginx/uwsgi problem on Debian

2016-01-21 Thread Johann Spies
On 20 January 2016 at 16:35, Richard Vézina 
wrote:

>
> Which user is regular "web" user under debian, www-data?
>
>
Yes.

Thanks it is working now.

Regards
Johann

-- 
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] What does this error want to say? what's wrong here?

2016-01-21 Thread aston . ribat
model:
db.define_table('pst',
Field('writeup','text'), auth.signature)
controller:
def authsign():
form=SQLFORM(db.pst).process()
return locals()
view:
{{extend 'layout.html'}}
{{=form}}

-- 
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 does this error want to say? what's wrong here?

2016-01-21 Thread aston . ribat

 'Cannot resolve reference auth_user in pst 
definition'On Thursday, January 21, 2016 at 2:53:02 PM UTC+5:30, 
aston...@gmail.com wrote:
>
> model:
> db.define_table('pst',
> Field('writeup','text'), auth.signature)
> controller:
> def authsign():
> form=SQLFORM(db.pst).process()
> return locals()
> view:
> {{extend 'layout.html'}}
> {{=form}}
>

-- 
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 does this error want to say? what's wrong here?

2016-01-21 Thread aston . ribat
I found out that there was no auth_user in db administration. But why did 
it happen? It's new. And I erased no code
On Thursday, January 21, 2016 at 2:53:02 PM UTC+5:30, aston...@gmail.com 
wrote:
>
> model:
> db.define_table('pst',
> Field('writeup','text'), auth.signature)
> controller:
> def authsign():
> form=SQLFORM(db.pst).process()
> return locals()
> view:
> {{extend 'layout.html'}}
> {{=form}}
>

-- 
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 force uniqueness on list:reference or compute fields

2016-01-21 Thread Pierre

Hi all,


have tried different options to do so but all have failed:

list:reference + unique=Truefails
list:reference + IS_NOT_IN_DB()fails
compute field + unique=True   fails
compute field + IS_NOT_IN_DB()   fails


??

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

2016-01-21 Thread goome
Does view truncate datas ?
I have this in controller:
[...]
  form = legacy_db(query).select()
  return dict (form = form)

and the classic view:
{{ extend 'layout.html' }}
{{=form}}


executing the funcition from the shell, i see the data correct(i mean the 
hole data) for example
>>> form[0]['paid_at']
'2016-01-09 18:33:37 +0100'

but in the browseri can see only:
2016-01-09 18...

this is the first time i realized this behaviour.
Is this normal?
how can i get the whole data?

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: pygal and SQL.form

2016-01-21 Thread goome

tried with
return dict(form=form,chart=chart)
?

Il giorno mercoledì 20 gennaio 2016 14:47:16 UTC+1, kecajk...@gmail.com ha 
scritto:
>
> Hi Guys, 
>
> I try to use pygal to draw some charts and it works fine. I used example 
> from:
>
>
> http://www.web2pyslices.com/slice/show/1634/beauty-graphics-and-charts-with-pygal
>
> However i don't know how to display SQL.form and pygal chart in one view.
>
> My code 
>
>
> def form_and_chart():
>  chart = plot_pygal()
>  form = SQLFORM.factory( Field('time') )
>  return dict(form=form),chart
>
>
> def plot_pygal():
>  response.headers['Content-Type']='image/svg+xml'
>  bar_chart = pygal.Bar(style=CleanStyle) # Then create a bar graph object
>  bar_chart.add('Fibonacci', [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]) # Add 
> some values 
>  return bar_chart.render()
>
>
> view: form_and_chart.html
>
> {{extend 'layout.html'}}
> {{=form}}
> http://localhost/myapp/default/plot_pygal.svg"; type=
> "image/svg+xml" />
>
>
> When i do return(form=form), form is displayed correctly, when i do return 
> chart, chart is displayed correctly. How to combine those two to be 
> displayed on one page?
>
> 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: charts on web2py

2016-01-21 Thread Michele Comitini
If doing SVG client side covers your need then use raphael it is
really simple, you need only to manage some json:
http://raphaeljs.com/


Once you get the hang of SVG doing charts with SVG+ractive.js is also
an option if you need maximum flexibility and interactivity.



2016-01-21 2:06 GMT+01:00 Ariya Owam-aram :
> Try pygal.org very easy.
>
> เมื่อ วันพุธที่ 20 มกราคม ค.ศ. 2016 23 นาฬิกา 04 นาที 43 วินาที UTC+7, Diego
> Tostes เขียนว่า:
>>
>> Hi,
>>
>> anyone can indicate a good solution to create charts using web2py?
>>
>> rgds
>>
>> diego
>
> --
> 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: view

2016-01-21 Thread Anthony
When you display a Rows object in a view, it gets wrapped in SQLTABLE, 
which by default truncates values in each cell to 16 characters. To change 
that, you can call SQLTABLE explicitly:

{{=SQLTABLE(form, truncate=None)}}

Also, to make your code more clear, it might be better not to name a Rows 
object "form" (a typical generic variable name for a Rows object is simply 
"rows", or maybe the plural of the database table name).

Finally, it would also be helpful to make the titles of your Google Groups 
postings a little more explicit.

Anthony

On Thursday, January 21, 2016 at 5:48:34 AM UTC-5, goome wrote:
>
> Does view truncate datas ?
> I have this in controller:
> [...]
>   form = legacy_db(query).select()
>   return dict (form = form)
>
> and the classic view:
> {{ extend 'layout.html' }}
> {{=form}}
>
>
> executing the funcition from the shell, i see the data correct(i mean the 
> hole data) for example
> >>> form[0]['paid_at']
> '2016-01-09 18:33:37 +0100'
>
> but in the browseri can see only:
> 2016-01-09 18...
>
> this is the first time i realized this behaviour.
> Is this normal?
> how can i get the whole data?
>
> 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: Enabling Google Sign-In

2016-01-21 Thread dirman
hi 
am getting  global name 'Storage' is not 
defined
when using  Storage(json.load(f)['web'])



On Thursday, October 22, 2015 at 11:27:35 AM UTC, mcm wrote:
>
>
> http://web2py.com/books/default/chapter/29/09/access-control?search=oauth#Other-login-methods-and-login-forms
>
>
> Grab the file google_auth.json from the google developer console and put 
> in private dir of your app
>
> put  code similar to the one below in db.py:
>
>
> from gluon.contrib.login_methods.oauth20_account import OAuthAccount
>
> try:
> import json
> except ImportError:
> from gluon.contrib import simplejson as json
>
>
> class GoogleAccount(OAuthAccount):
> "OAuth 2.0 for Google"
>
> def __init__(self):
> with open(os.path.join(request.folder, 
> 'private/google_auth.json'), 'rb') as f:
> gai = Storage(json.load(f)['web'])
> 
> OAuthAccount.__init__(self, None, gai.client_id, gai.client_secret,
>   gai.auth_uri, gai.token_uri,
>   scope='
> https://www.googleapis.com/auth/userinfo.profile 
> https://www.googleapis.com/auth/userinfo.email',
>   approval_prompt='force', 
> state="auth_provider=google")
>
>
> def get_user(self):
>
> token = self.accessToken()
> if not token:
> return None
>
> uinfo_url = '
> https://www.googleapis.com/oauth2/v1/userinfo?access_token=%s' % 
> urllib2.quote(token, safe='')
>
> uinfo = None
>
> try:
> uinfo_stream = urllib2.urlopen(uinfo_url)
> except:
> session.token = None
> return
> data = uinfo_stream.read()
> uinfo = json.loads(data)
>
> username = uinfo['id']
> 
> return dict(first_name = uinfo['given_name'],
> last_name = uinfo['family_name'],
> username = username,
> email = uinfo['email'])
>
> auth.settings.login_form = GoogleAccount()
>
>
> 2015-10-22 11:02 GMT+02:00 Leonel Câmara  >:
>
>> I would try to use this:
>>
>> https://code.google.com/p/w2p-social-auth/
>>
>> -- 
>> 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.


Re: [web2py] Re: nginx/uwsgi problem on Debian

2016-01-21 Thread Richard Vézina
:)

Richard

On Thu, Jan 21, 2016 at 4:05 AM, Johann Spies 
wrote:

> On 20 January 2016 at 16:35, Richard Vézina 
> wrote:
>
>>
>> Which user is regular "web" user under debian, www-data?
>>
>>
> Yes.
>
> Thanks it is working now.
>
> Regards
> Johann
>
> --
> 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] oauth2 for google

2016-01-21 Thread dirman
I am getting

 global name 'Storage' is not defined

when using Storage(json.load(f)['web'])

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


Re: [web2py] oauth2 for google

2016-01-21 Thread Marin Pranjić
from gluon.storage import Storage

On Thu, Jan 21, 2016 at 3:51 PM, dirman  wrote:

> I am getting
>
>  global name 'Storage' is not defined
>
> when using Storage(json.load(f)['web'])
>
> I need 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.
>

-- 
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: charts on web2py

2016-01-21 Thread Junior Phanter
Online - google chats
http://google-developers.appspot.com/chart

Offline - highcharts
http://www.highcharts.com
Em 21/01/2016 09:34, "Michele Comitini" 
escreveu:

> If doing SVG client side covers your need then use raphael it is
> really simple, you need only to manage some json:
> http://raphaeljs.com/
>
>
> Once you get the hang of SVG doing charts with SVG+ractive.js is also
> an option if you need maximum flexibility and interactivity.
>
>
>
> 2016-01-21 2:06 GMT+01:00 Ariya Owam-aram :
> > Try pygal.org very easy.
> >
> > เมื่อ วันพุธที่ 20 มกราคม ค.ศ. 2016 23 นาฬิกา 04 นาที 43 วินาที UTC+7,
> Diego
> > Tostes เขียนว่า:
> >>
> >> Hi,
> >>
> >> anyone can indicate a good solution to create charts using web2py?
> >>
> >> rgds
> >>
> >> diego
> >
> > --
> > Resources:
> > - http://web2py.com
> > - http://web2py.com/book (Documentation)
> > - http://github.com/web2py/web2py (Source code)
> > - https://code.google.com/p/web2py/issues/list (Report Issues)
> > ---
> > You received this message because you are subscribed to the Google Groups
> > "web2py-users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to web2py+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: charts on web2py

2016-01-21 Thread Alex
my favorite chart library:
https://www.amcharts.com/
very beautiful, easy to use, good documentation and friendly license 
(allows usage of free version even for commercial websites).

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

2016-01-21 Thread Alex
exactly :)

maybe the point about auto imports brought up by Mirek is worth discussing. 
Personally I prefer the way it is and not having to write
import request
etc.
in every controller. On the other hand it is bad for IDE support because 
you have to write something ugly (unless your IDE has builtin web2py 
support) like:
if 0:
  import request
  ...

so regarding IDEs it would be better to have something standard compliant.

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.


Re: [web2py] Re: view

2016-01-21 Thread Marcello Console
Thank you a lot for all of your tips

2016-01-21 14:24 GMT+01:00, Anthony :
> When you display a Rows object in a view, it gets wrapped in SQLTABLE,
> which by default truncates values in each cell to 16 characters. To change
> that, you can call SQLTABLE explicitly:
>
> {{=SQLTABLE(form, truncate=None)}}
>
> Also, to make your code more clear, it might be better not to name a Rows
> object "form" (a typical generic variable name for a Rows object is simply
> "rows", or maybe the plural of the database table name).
>
> Finally, it would also be helpful to make the titles of your Google Groups
> postings a little more explicit.
>
> Anthony
>
> On Thursday, January 21, 2016 at 5:48:34 AM UTC-5, goome wrote:
>>
>> Does view truncate datas ?
>> I have this in controller:
>> [...]
>>   form = legacy_db(query).select()
>>   return dict (form = form)
>>
>> and the classic view:
>> {{ extend 'layout.html' }}
>> {{=form}}
>>
>>
>> executing the funcition from the shell, i see the data correct(i mean the
>>
>> hole data) for example
>> >>> form[0]['paid_at']
>> '2016-01-09 18:33:37 +0100'
>>
>> but in the browseri can see only:
>> 2016-01-09 18...
>>
>> this is the first time i realized this behaviour.
>> Is this normal?
>> how can i get the whole data?
>>
>> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/XZOqBp__oQM/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.
>

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

2016-01-21 Thread Carlos Cesar Caballero Díaz
The imports can make web2py fast, because then only will be loaded the 
required models in the request, that maybe can be an optional feature.


Another option could be caching the models in memory in production.

Regards.

El 21/01/16 a las 11:28, Alex escribió:

exactly :)

maybe the point about auto imports brought up by Mirek is worth 
discussing. Personally I prefer the way it is and not having to write

import request
etc.
in every controller. On the other hand it is bad for IDE support 
because you have to write something ugly (unless your IDE has builtin 
web2py support) like:

if 0:
  import request
  ...

so regarding IDEs it would be better to have something standard compliant.

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.




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


Re: [web2py] Re: charts on web2py

2016-01-21 Thread Diego Tostes
thanks for all!


2016-01-21 14:17 GMT-02:00 Alex :

> my favorite chart library:
> https://www.amcharts.com/
> very beautiful, easy to use, good documentation and friendly license
> (allows usage of free version even for commercial websites).
>
> 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.
>

-- 
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: Get return value from controller function via ajax

2016-01-21 Thread Ian W. Scott
Ah, thanks Anthony. I didn't realize that the third argument in the ajax()
function was that flexible. That helps.

Ian

On Wed, Jan 20, 2016 at 4:45 PM, Anthony  wrote:

> Additionally, if you still want to use the ajax() function, the third
> argument can be ":eval", in which case, you can return some Javascript code
> to be executed when the response is returned. Alternatively, the third
> argument can be an actual Javascript function, in which case, the returned
> value will be passed to that function.
>
> Anthony
>
>
> On Wednesday, January 20, 2016 at 4:20:22 PM UTC-5, Ian W. Scott wrote:
>>
>> Thanks. So to clarify, if I serialize the return value as json in the
>> controller, then I can use it in javascript. It looks like I still have to
>> parse the json on the javascript end (like $.parseJSON(mydata)) but it
>> works like a charm.
>>
>> Ian
>>
>> On Wednesday, January 20, 2016 at 2:50:35 PM UTC-5, Niphlod wrote:
>>>
>>> from gluon.serializers import json
>>>
>>> def uh():
>>> return json(blablabla)
>>>
>>> On Wednesday, January 20, 2016 at 8:45:55 PM UTC+1, Ian W. Scott wrote:

 I'm trying to use ajax calls to update the data for a chart
 dynamically. I don't want to make the chart a component that refreshes, I
 just want to get the controller return value back to the javascript in the
 view, so that I can update the chart via javascript. But web2py's ajax
 function seems to only (a) update a part of the page html, or (b) send page
 data to the controller for use in the back-end. There doesn't seem to be
 any way to get the controller's return value as a data object for the
 javascript to use.

 I've tried just using jquery's get() method like this:

 $.get(my_controller_url, function(data){
 console.log('got ajax data', data);
 });

 But if the controller's return value is a tuple there seems to be no
 data sent back, or at least I don't know how to access it from the 'data'
 variable in this example. If I make the controller a dictionary I get html
 back. But I don't want html. I just want the data.

 So how can I do 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/4gSYo-Th4vw/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.
>



-- 
Ian W. Scott, PhD (McMaster RS)
Associate Professor of New Testament
Tyndale Seminary
Toronto, Ontario, Canada
http://www.ian-w-scott.com

*Paul's Way of Knowing: Story, Experience and the Spirit* (WUNT II/205;
Tübingen: Mohr Siebeck, 2006/Grand Rapids: Baker Academic, 2008).

*The Online Critical Pseudepigrapha* (Atlanta: Society of Biblical
Literature, 2006-). Online: http://www.purl.org/net/ocp.

-- 
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] probem reference auth_user sqlite

2016-01-21 Thread Alessio Varalta
Hi I have a database in sqlite..today I try to add new table..very simple

  db.define_table('viewnews',
Field('user_id','reference 
auth_user',requires=IS_NOT_EMPTY()),
)

but when i insert a row a have this error 

 Traceback (most recent call last):
  File "/home/www-data/web2py/applications/coop/controllers/appadmin.py", line 
269, in select
*fields, limitby=(start, stop))
  File "/home/www-data/web2py/gluon/packages/dal/pydal/objects.py", line 2002, 
in select
return adapter.select(self.query,fields,attributes)
  File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/sqlite.py", 
line 122, in select
return super(SQLiteAdapter, self).select(query, fields, attributes)
  File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
1286, in select
return self._select_aux(sql,fields,attributes)
  File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
1243, in _select_aux
self.execute(sql)
  File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
1378, in execute
return self.log_execute(*a, **b)
  File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
1372, in log_execute
ret = self.cursor.execute(command, *a[1:], **b)
  File "/usr/lib/python2.7/sqlite3/dbapi2.py", line 65, in convert_date
return datetime.date(*map(int, val.split("-")))
TypeError: Required argument 'month' (pos 2) not found

I don't understand the reason..without this table all work perfec


-- 
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: probem reference auth_user sqlite

2016-01-21 Thread Niphlod
did you alter in any way the auth_user table ?

On Thursday, January 21, 2016 at 8:43:07 PM UTC+1, Alessio Varalta wrote:
>
> Hi I have a database in sqlite..today I try to add new table..very simple
>
>   db.define_table('viewnews',
> Field('user_id','reference 
> auth_user',requires=IS_NOT_EMPTY()),
> )
>
> but when i insert a row a have this error 
>
>  Traceback (most recent call last):
>   File "/home/www-data/web2py/applications/coop/controllers/appadmin.py", 
> line 269, in select
> *fields, limitby=(start, stop))
>   File "/home/www-data/web2py/gluon/packages/dal/pydal/objects.py", line 
> 2002, in select
> return adapter.select(self.query,fields,attributes)
>   File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/sqlite.py", 
> line 122, in select
> return super(SQLiteAdapter, self).select(query, fields, attributes)
>   File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", 
> line 1286, in select
> return self._select_aux(sql,fields,attributes)
>   File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", 
> line 1243, in _select_aux
> self.execute(sql)
>   File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", 
> line 1378, in execute
> return self.log_execute(*a, **b)
>   File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", 
> line 1372, in log_execute
> ret = self.cursor.execute(command, *a[1:], **b)
>   File "/usr/lib/python2.7/sqlite3/dbapi2.py", line 65, in convert_date
> return datetime.date(*map(int, val.split("-")))
> TypeError: Required argument 'month' (pos 2) not found
>
> I don't understand the reason..without this table all work perfec
>
>
>

-- 
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: probem reference auth_user sqlite

2016-01-21 Thread Alessio Varalta
Resolve I don't know why but i change the name of the table and now work :)

On Thursday, 21 January 2016 20:49:04 UTC+1, Niphlod wrote:
>
> did you alter in any way the auth_user table ?
>
> On Thursday, January 21, 2016 at 8:43:07 PM UTC+1, Alessio Varalta wrote:
>>
>> Hi I have a database in sqlite..today I try to add new table..very simple
>>
>>   db.define_table('viewnews',
>> Field('user_id','reference 
>> auth_user',requires=IS_NOT_EMPTY()),
>> )
>>
>> but when i insert a row a have this error 
>>
>>  Traceback (most recent call last):
>>   File "/home/www-data/web2py/applications/coop/controllers/appadmin.py", 
>> line 269, in select
>> *fields, limitby=(start, stop))
>>   File "/home/www-data/web2py/gluon/packages/dal/pydal/objects.py", line 
>> 2002, in select
>> return adapter.select(self.query,fields,attributes)
>>   File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/sqlite.py", 
>> line 122, in select
>> return super(SQLiteAdapter, self).select(query, fields, attributes)
>>   File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", 
>> line 1286, in select
>> return self._select_aux(sql,fields,attributes)
>>   File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", 
>> line 1243, in _select_aux
>> self.execute(sql)
>>   File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", 
>> line 1378, in execute
>> return self.log_execute(*a, **b)
>>   File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", 
>> line 1372, in log_execute
>> ret = self.cursor.execute(command, *a[1:], **b)
>>   File "/usr/lib/python2.7/sqlite3/dbapi2.py", line 65, in convert_date
>> return datetime.date(*map(int, val.split("-")))
>> TypeError: Required argument 'month' (pos 2) not found
>>
>> I don't understand the reason..without this table all work perfec
>>
>>
>>

-- 
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: Deploying in Windows server and SSL (no IIS)

2016-01-21 Thread José Eloy
SOLVED:

Niphlod:
I copied the web2py folder inside C:\inetpub\wwwroot

And then I created a new Web site, with main folder in 
C:\inetpub\wwwroot\web2py with https and port 443 and with a SSL 
certificate auto signed and vualá! my site is running.

Thanks for 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] Re: how to force uniqueness on list:reference or compute fields

2016-01-21 Thread Anthony
On Thursday, January 21, 2016 at 4:57:57 AM UTC-5, Pierre wrote:
>
>
> Hi all,
>
>
> have tried different options to do so but all have failed:
>
> list:reference + unique=Truefails
> list:reference + IS_NOT_IN_DB()fails
> compute field + unique=True   fails
> compute field + IS_NOT_IN_DB()   fails
>

Are you saying you want to ensure the particular list of references is 
unique per record? Also, what do you mean by "fails" -- causes an error, or 
fails to prevent duplicates?

Note, the "unique" attribute applies to the database, so the database will 
enforce that (throwing an exception if you attempt to insert a duplicate). 
However, the database will only interpret two lists as duplicates if their 
elements are in the same order (this is because list:reference fields are 
actually stored as delimited strings in the database). For example, [1,2,3] 
will not be considered a duplicate of [2,3,1] because the former will be 
stored as "|1|2|3|" and the latter as "|2|3|1|". However, if you attempt to 
insert [1,2,3] (in that exact order) twice, the database should prevent 
that if you have set unique=True.

If you want to handle this via a form validator, you will probably have to 
code a custom validator. Note, though, that it will get tricky if you want 
to consider two lists to be duplicates even if they are in different orders.

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.


Re: [web2py] Re: charts on web2py

2016-01-21 Thread Diego Tostes
i am trying to use google chart plugin, but the example at
http://www.web2pyslices.com/slice/show/1721/google-charts-plugin, it is not
so clear to me.

anybody can show me a example with a controller and a view?

i need a simple line chart.

rgds

diego

2016-01-21 17:36 GMT-02:00 Diego Tostes :

> thanks for all!
>
>
> 2016-01-21 14:17 GMT-02:00 Alex :
>
>> my favorite chart library:
>> https://www.amcharts.com/
>> very beautiful, easy to use, good documentation and friendly license
>> (allows usage of free version even for commercial websites).
>>
>> 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.
>>
>
>

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


[web2py] Web2py External Packages

2016-01-21 Thread Ionut Filea
Hello,

I have a folder which is controlling one of my LED Matrix devices through a 
.py file.
I would like to implement this folder into Web2py app browser and execute 
that .py file from web2py app.

Would be very nice if I can get some answers on how to do it.

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] Why does this Web2Py ajax call fail to return the value of a variable?

2016-01-21 Thread Ben Wolski


Here is the relevant snippet from my Web2Py view:


{{for candidate in rows:}}


{{=candidate.votes}}

{{=IMG(_src=URL('photos',candidate.path_to_photo), _alt="Photo of 
Candidate")}}
{{=candidate.name}}

   {{pass}}

And the relevant snippet from my Web2Py controller:

def arrow_button_callback():
response.flash = str(request.post_vars.name)
return request.post_vars.name

So why do I see the string "None" in my target div (and in my flash)?


Thank you for your help. I read chapter 11 of the Web2Py book and I'm still 
confused.


I really want to be able to pass candidate.id (depending on which row's 
button was pressed) and the button direction to controller variables. 
Please let me know if there's a better way to do this.


--Benjamin


stack overflow crosspost 


-- 
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 programatically create virtual fields in aliased table

2016-01-21 Thread Oliva Lemke
hi

i have table
db.define_table('items', Field('name'), Field('created_by'), 
Field('modified_by'))

fields `created_by` and `modified_by` has defined relation to 
db.auth_user.user_id (not auth_user.id)

how to programatically create virtual fields created_by.full_name and 
modified_by.full_name?


lefts = []
auth_user_fields = ('created_by', 'modified_by')
for field in auth_user_fields:
table = db.auth_user.with_alias(field)
table.full_name = self.db.Field.Virtual('full_name', lambda 
row, field=field: '%s %s' % (row[field].first_name, row[field].last_name))
lefts.append(table.on(table.user_id==self.model[field]))

rows = db(db.items).select(left=lefts)

but `rows` in last line contains only fields/columns from `db.items` , 
aliased `created_by` and `modified_by` `auth_user` table is missing

am i doing something wrong?

-- 
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: best advice on customer/client picklist popup.

2016-01-21 Thread mrsalice Kolonga
hi

-- 
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] I want to execute a .py from a specific folder with web2py

2016-01-21 Thread Ionut Filea
Hello,

I am new to this so take me easy.

First, I just got my Web2py web up and working.
What I would like to find out is where are my new Apps ('Test app', for 
this example) stored on my Raspberry Pi ?
And second question would be: I have a folder for a Led Matrix. It is 
working if I use the commands in terminal, but I want to implement a button 
where I can run my .py examples from Led Matrix folder. Can someone help me 
with some explanations, please?

Kind regards,
Ionut

-- 
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] Multiple instances of same class

2016-01-21 Thread killzane
I write a class in modules, and create instance in controller.
But whatever I create different variable, they point to same instance.
May I create new instance when page reload?

here is the class
# -*- coding: utf-8 -*-
from gluon import current

class Project:
__name = None

def __init__(self, id):
db = current.db
project = db(db.project.id == id).select().first()
self.__name = project.name
@classmethod
def setName(cls, name):
cls.__name = name
pass
@classmethod
def getName(cls):
return cls.__name
pass

and here is the controller
def classTest():
myObj = Project(5)
myObj2 = Project(4)
# myObj2.setName("abcxxx")
# myObj.setName("defxxx")
return myObj2.getName()

whatever I return myObj.name or myObj2.name the answer is "defxxx".
so how could I do for it?

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] Scheduler Tasks show TICKER: error assigningt task (0) and task never start

2016-01-21 Thread Marcelo Huerta
> everything works fine with latest stable + postgresql 9.4 + psycopg2
> on win7. I'd say the fault could be a faulty web2py installation or at the
> very least a driver issue (try to upgrade to the latest)

And that was exactly it. I upgraded to the latest psycopg2 and the error
stopped appearing.

Sorry for the noise and THANK YOU VERY MUCH for the kind help.

-- 
   o-=< Marcelo >=-o

-- 
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: Why does this Web2Py ajax call fail to return the value of a variable?

2016-01-21 Thread Anthony
Answered on SO: http://stackoverflow.com/a/34903626/440323

On Thursday, January 21, 2016 at 5:24:00 PM UTC-5, Ben Wolski wrote:
>
> Here is the relevant snippet from my Web2Py view:
>
>
> {{for candidate in rows:}}
> 
>  onclick="ajax('{{=URL('default', 'arrow_button_callback')}}', ['name'], 
> 'target')" class="fa fa-caret-up arrow-up fa-4x">
> {{=candidate.votes}}
>  onclick="ajax('{{=URL('default', 'arrow_button_callback')}}', ['name'], 
> 'target')" class="fa fa-caret-down arrow-down fa-4x">
> {{=IMG(_src=URL('photos',candidate.path_to_photo), _alt="Photo of 
> Candidate")}}
> {{=candidate.name}}
> 
>{{pass}}
>
> And the relevant snippet from my Web2Py controller:
>
> def arrow_button_callback():
> response.flash = str(request.post_vars.name)
> return request.post_vars.name
>
> So why do I see the string "None" in my target div (and in my flash)?
>
>
> Thank you for your help. I read chapter 11 of the Web2Py book and I'm 
> still confused.
>
>
> I really want to be able to pass candidate.id (depending on which row's 
> button was pressed) and the button direction to controller variables. 
> Please let me know if there's a better way to do this.
>
>
> --Benjamin
>
>
> stack overflow crosspost 
> 
>

-- 
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: Multiple instances of same class

2016-01-21 Thread Anthony
You have defined __name as a class attribute, so it belongs to the class, 
not to individual instances of it. Instead, just use self.__name if you 
want the name to be associated with a particular instance of the class.

Anthony

On Thursday, January 21, 2016 at 5:24:00 PM UTC-5, killzane wrote:
>
> I write a class in modules, and create instance in controller.
> But whatever I create different variable, they point to same instance.
> May I create new instance when page reload?
>
> here is the class
> # -*- coding: utf-8 -*-
> from gluon import current
>
> class Project:
> __name = None
>
> def __init__(self, id):
> db = current.db
> project = db(db.project.id == id).select().first()
> self.__name = project.name
> @classmethod
> def setName(cls, name):
> cls.__name = name
> pass
> @classmethod
> def getName(cls):
> return cls.__name
> pass
>
> and here is the controller
> def classTest():
> myObj = Project(5)
> myObj2 = Project(4)
> # myObj2.setName("abcxxx")
> # myObj.setName("defxxx")
> return myObj2.getName()
>
> whatever I return myObj.name or myObj2.name the answer is "defxxx".
> so how could I do for it?
>
> 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] Field does not belong to the table

2016-01-21 Thread Alex Glaros
What is causing this error?  The inserts with the form used to work in 
sqLite but now am getting this error using PostGres

form=SQLFORM.factory(db.SuperObject,db.Party,db.auth_user) ## 
,db.PartyAddressIntersection,db.Address) 
if form.process().accepted:
form.vars.displayName = form.vars.objectDisplayName = 
'%(first_name)s %(last_name)s' % form.vars
superObjectID = form.vars.superObjectID = 
db.SuperObject.insert(**db.SuperObject._filter_fields(form.vars)) 
response.flash='Thanks for filling the form' 
partyID = form.vars.partyID = 
db.Party.insert(**db.Party._filter_fields(form.vars))
user_id = 
db.auth_user.insert(**db.auth_user._filter_fields(form.vars)) 
form.vars.user_id = form.vars.personID = user_id # can't remember 
why this is here...
form.vars.addressID = 
db.Address.insert(**db.Address._filter_fields(form.vars))

db.PartyAddressIntersection.insert(**db.PartyAddressIntersection._filter_fields(form.vars))
 
 
db.Role.insert(roleOwner_user_id_FK = user_id, roleOwner_SuperObject_FK 
= superObjectID, roleName='Self', roleDescription='Self', 
roleOwner_party_FK=partyID, roleType_FK=specificRoleTypeID, 
object_superObject_FK=superObjectID)


 Field roleOwner_user_id_FK does not belong 
to the tableVersion
web2py™ Version 2.12.2-stable+timestamp.2015.08.09.14.29.44
Python Python 2.7.9: C:\alex\alt_web2py\web2py\web2py.exe (prefix: 
C:\Python27)Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.

Traceback (most recent call last):
  File "C:\alex\alt_web2py\web2py\gluon\restricted.py", line 227, in restricted
exec ccode in environment
  File "C:/alex/alt_web2py/web2py/applications/ES1/controllers/default.py" 
, line 
7715, in 
  File "C:\alex\alt_web2py\web2py\gluon\globals.py", line 412, in 
self._caller = lambda f: f()
  File "C:/alex/alt_web2py/web2py/applications/ES1/controllers/default.py" 
, line 
979, in add_new_person
db.Role.insert(roleOwner_user_id_FK = user_id, roleName='Self', 
roleDescription='Self', roleOwner_party_FK=partyID, 
roleType_FK=specificRoleTypeID, object_superObject_FK=superObjectID)
  File "C:\alex\alt_web2py\web2py\gluon\packages\dal\pydal\objects.py", line 
737, in insert
ret =  self._db._adapter.insert(self, self._listify(fields))
  File "C:\alex\alt_web2py\web2py\gluon\packages\dal\pydal\objects.py", line 
655, in _listify
'Field %s does not belong to the table' % name)
SyntaxError: Field roleOwner_user_id_FK does not belong to the table

Error snapshot [image: help] 


(Field roleOwner_user_id_FK does not belong 
to the table)

(self=,
 
fields={'object_superObject_FK': 11L, 'roleDescription': 'Self', 
'roleName': 'Self', 'roleOwner_party_FK': 10L, 'roleOwner_user_id_FK': 9L, 
'roleType_FK': 39L}, update=False)

   - Code listing
   
   650.
   651.
   652.
   653.
   654.
   655.
   
   656.
   657.
   658.
   659.
   
   # store all fields passed as input in new_fields
   for name in fields:
   if not name in self.fields:
   if name != 'id':
   raise SyntaxError(
   'Field %s does not belong to the table' % name)
   
   else:
   field = self[name]
   value = fields[name]
   if field.filter_in:
   
   Variables
   name 'roleOwner_user_id_FK'
   
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: Field does not belong to the table

2016-01-21 Thread Alex Glaros
correction, I switched back to sqLite and problem exists there too

-- 
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] Duplicate entries in Auth_user DB table upon sign in

2016-01-21 Thread Michael Messmer
When I use the following on SQLite 

   manage_groups= True,
   manage_user = True,

1 entry in would come into db.auth_user

When I transferred to Oracle 11g
a new user logs in and I get two entries.

42  Mi Me [mme...mme@...NoneNoneNoneNone   
 None
43  mmeNoneNonemmeNoneNoneNonemme

Log out and log in again. 
Then I get: 

43  Mi Me [mme...mme@...mmeNoneNoneNone 
   mme

So row 43 is now getting updated.

Any thoughts.  Again the the only thing that chaged was default SQLite to 
Oracle 11g  as the main DB


See Context below:
---

from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
auth = Auth(db)
crud, service, plugins = Crud(db), Service(), PluginManager()


## create all tables needed by auth if not custom tables
auth.define_tables(username=True, signature=False)

# all we need is login
auth.settings.actions_disabled=['register','change_password','request_reset_password','retrieve_username','profile']
#auth.settings.login_onvalidation = []
# you don't have to remember me
auth.settings.remember_me_form = False

#http://www.computerperformance.co.uk/Logon/LDAP_attributes_active_directory.htm
# ldap authentication and not save password on web2py
from gluon.contrib.login_methods.ldap_auth import ldap_auth
auth.settings.login_methods = [ldap_auth(mode='ad',
   manage_groups= True,
   db = db,
   manage_user = True,
   user_firstname_attrib = 'cn:1',
   user_lastname_attrib = 'sn',
   group_member_attrib = 'member',
   group_filterstr = 'objectClass=Group',
   server='somethign.com',
   base_dn='DC=corp,DC=something,DC=com')]



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


[web2py] Re: Web2py External Packages

2016-01-21 Thread Jim S
Web2py will look in the modules folder inside your application folder for 
modules to import.

I'd recommend at a minimum reading the Overview and Core chapters of the 
book before trying to write any code.

http://web2py.com/books/default/chapter/29/03/overview
http://web2py.com/books/default/chapter/29/04/the-core

Actually, I'd recommend reading through chapter 9 before starting any 
project.  It is a great source of information about web2py.

-Jim


On Thursday, January 21, 2016 at 4:24:00 PM UTC-6, Ionut Filea wrote:
>
> Hello,
>
> I have a folder which is controlling one of my LED Matrix devices through 
> a .py file.
> I would like to implement this folder into Web2py app browser and execute 
> that .py file from web2py app.
>
> Would be very nice if I can get some answers on how to do it.
>
> 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: I want to execute a .py from a specific folder with web2py

2016-01-21 Thread Jim S
Your applications should be installed in the applications folder under the 
web2py folder where you installed web2py.

If you put your .py examples in the web2py/applications/modules you'll them 
be able to import them into your controllers.

As I mentioned in the other question you posted, this information is all in 
the book.  It is a great resource!

I hope this helps, and Welcome to web2py!

-Jim



On Thursday, January 21, 2016 at 4:24:00 PM UTC-6, Ionut Filea wrote:
>
> Hello,
>
> I am new to this so take me easy.
>
> First, I just got my Web2py web up and working.
> What I would like to find out is where are my new Apps ('Test app', for 
> this example) stored on my Raspberry Pi ?
> And second question would be: I have a folder for a Led Matrix. It is 
> working if I use the commands in terminal, but I want to implement a button 
> where I can run my .py examples from Led Matrix folder. Can someone help me 
> with some explanations, please?
>
> Kind regards,
> Ionut
>

-- 
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: charts on web2py

2016-01-21 Thread Junior Phanter
Example using just google chart api, without google-charts-plug-in

on controller

def chart():
title="My Chart"
data=XML('[ ["item", "value"], ["apple", 1], ["potato", 1.5],
["watermelon", 0.5]]') #convert list in string and string in XML
return dict(title=title, data=data)

on view (chart.html)

{{extend 'layout.html'}}



https://www.gstatic.com/charts/loader.js
">


  google.charts.load('current', {'packages':['corechart']});
  google.charts.setOnLoadCallback(drawChart);
  function drawChart() {

var data = google.visualization.arrayToDataTable({{=data}});

var options = {
  title: '{{=title}}'
};

var chart = new
google.visualization.PieChart(document.getElementById('my_chart'));

chart.draw(data, options);
  }



2016-01-21 18:01 GMT-03:00 Diego Tostes :

> i am trying to use google chart plugin, but the example at
> http://www.web2pyslices.com/slice/show/1721/google-charts-plugin, it is
> not so clear to me.
>
> anybody can show me a example with a controller and a view?
>
> i need a simple line chart.
>
> rgds
>
> diego
>
> 2016-01-21 17:36 GMT-02:00 Diego Tostes :
>
>> thanks for all!
>>
>>
>> 2016-01-21 14:17 GMT-02:00 Alex :
>>
>>> my favorite chart library:
>>> https://www.amcharts.com/
>>> very beautiful, easy to use, good documentation and friendly license
>>> (allows usage of free version even for commercial websites).
>>>
>>> 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.
>>>
>>
>>
> --
> 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.