[web2py] Re: OAuth2.0 and Facebook (as from the book)

2013-10-28 Thread Christian Foster Howes
the problem is that facebook is not returning an email.

i know, i know, you told facebook that email is required and you can't 
reproduce such a state.  i'm 100% with you, but i see the exact same 
behavior with my users!  i suspect that these are actually returning users 
who granted email access when they first created an account, but then they 
changed their facebook permissions to remove email access and when they 
return to your site and login, facebook lets them (because they have 
before), but does not give you the email address.   i have not confirmed 
this theory, but it's my running theory.

other potential issue is the expiration of the facebook access token.  
those rules changed this spring and i'm not 100% up to date on the rules 
right now.

cfh

On Monday, October 28, 2013 10:57:06 AM UTC-7, Lisandro wrote:
>
> I'm having a similar problem with KeyError: 'email'.
>
> I have a site in production that uses oauth2 and offers the possibility of 
> register/login using personal facebook account. 
> I created a Facebook app and set permissions to get user's email (so I can 
> create the account on my site). Everything works perfect, lots of users 
> have registered in my site using their Facebook accounts. Even myself.
>
> However, there are some error tickets created with this error of 
> "KeyError:email". First I thought that some users didn't let the 
> application get their emails, but that's not possible. When you try to log 
> in my site using Facebook, facebook tells you that te application will get 
> your email, and you only can accept or decline. If you decline, you're not 
> registered. And if you accept, my site gets your email and creates the 
> account.
>
> So, I don't know which could be the problem. This is the traceback of the 
> error:
>
> Traceback (most recent call last):
>   File "/var/www/vendosimple/gluon/restricted.py", line 212, in restricted
> exec ccode in environment
>   File "/var/www/vendosimple/applications/init/controllers/default.py", line 
> 645, in 
>   File "/var/www/vendosimple/gluon/globals.py", line 194, in 
> self._caller = lambda f: f()
>   File "/var/www/vendosimple/applications/init/controllers/default.py", line 
> 380, in user
> form = auth()
>   File "/var/www/vendosimple/gluon/tools.py", line 1250, in __call__
> return getattr(self, args[0])()
>   File "/var/www/vendosimple/gluon/tools.py", line 2128, in login
> cas_user = cas.get_user()
>   File "applications/init/modules/globales.py", line 41, in get_user
> username=user['id'], registration_id=user['id'], email=user['email'])
> KeyError: 'email'
>
>
> Any ideas? 
>
>
> El martes, 7 de junio de 2011 01:00:33 UTC-3, Massimo Di Pierro escribió:
>>
>> I am not familiar with facebook email. 
>>
>> If this (username + @facebook) is avlid email, perhaps web should set 
>> that even if username=True 
>>
>> On Jun 6, 7:15 pm, "Sebastian E. Ovide"  
>> wrote: 
>> > I do not see major pros and cons... it is a matter of precerences... 
>> > 
>> > 1) setting username=True in auth.define_tables(), define_tables will 
>> add a 
>> > field on the table (username) and if that field is present, 
>> authentication 
>> > will be done using username. Personally I prefer to use emails rather 
>> than 
>> > usernames, and as I am using BOTH web2py auth and facebook at the same 
>>  time 
>> > for authentication (two different links for different logins), I didn't 
>> want 
>> > to force my application to use usernames so I've used the second 
>> option 
>> > 
>> > 2) in this case I'm adding an email created by the facebook username + 
>> > @facebook and therefore auth will keep using email for 
>> authentication... 
>> > 
>> > no web2py code has been touched, although I'm extending Auth and 
>> > overriding navbar to display a second login link (facebook) and hide 
>> > change_password when it is logged in via facebook. 
>> > 
>> > if session.login_method_used is None: 
>> > if not 'change_password' in 
>> self.settings.actions_disabled: 
>> > bar.insert(-1, ' | ') 
>> > bar.insert(-1, password) 
>> > 
>> > and in my controller: 
>> > 
>> > def user(): 
>> > if auth.user_id: 
>> > if request.args[0] == 'logout': 
>> > session.login_method_used=None 
>> > else: 
>> > if request.args[0] == 'login': 
>> > session.login_method_used=None 
>> > elif request.args[0] == 'login_fb': 
>> > session.login_method_used="facebook" 
>> > request.args[0]='login' 
>> > 
>> > if session.login_method_used=="facebook": 
>> > auth.settings.login_form=FaceBookAccount(globals()) 
>> > 
>> > return dict(form=auth()) 
>> > 
>> > On Mon, Jun 6, 2011 at 11:16 PM, Massimo Di Pierro < 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > massimo.dipie...@gmail.com> wrote: 
>> > > if there is agreement on one, please send me a patch. 
>> > 
>> > > On Jun 6,

[web2py] web2py markmin function does not render plus ( + ) charcter

2013-10-28 Thread 98ujko9
I am afraid that expression $$ x + y $$ will render as "xy" rather than 
"x+y". I tried escaping the "plus" character but without any luck. I was 
wondering if somebody else encountered such an issue.
Any help will be much appreciated. 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/groups/opt_out.


[web2py] Re: Getting the current record in a custom widget

2013-10-28 Thread mr.freeze
I am trying to break up a large form into steps that have complex 
interdependent values for a benefit application.  I can achieve everything 
with controller/client side logic but I was hoping to do it at the widget 
level so that the form is portable (i.e. works in appadmin too).  It would 
be a breaking change so I'll drop the issue.  Thanks for the feedback 
though.

On Monday, October 28, 2013 6:46:51 AM UTC-5, Anthony wrote:
>
> On Sunday, October 27, 2013 8:40:18 PM UTC-4, mr.freeze wrote:
>
>> I wouldn't say the use case is odd but it's definitely complex.  Then 
>> again, without a context for custom widgets to operate in (i.e. no 
>> knowledge of the record or form that they are bound to) only simple use 
>> cases are possible.  Represent and widget are output/input analogs but for 
>> some reason represent has access to the whole row whereas widget only gets 
>> the field value.  I will propose a patch if it can be done unobtrusively 
>> and without coupling Field to SQLFORM any further.
>>
>
> If a field requires special formatting depending on the values of other 
> fields in the form, presumably that special formatting should apply in 
> create forms as well as in edit forms when the values of the other fields 
> are changed. Those cases require client-side logic. So, perhaps the 
> rationale for not passing the record to the widget is that having the 
> widget attempt to handle inter-field formatting dependencies would be 
> inadequate and should therefore be handled entirely via JS (rather than 
> having server-side logic handle the initial loading of edit records, with 
> redundant JS logic to handle create forms and dynamic changes in edit 
> forms).
>
> Out of curiosity, what is your use case?
>
> 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/groups/opt_out.


[web2py] browser won't go to http://127.0.0.1:8000/admin/default/ ... whatever ...

2013-10-28 Thread weheh
I'm using PostgreSQL and debugging in Eclipse, although I also see this 
issue when not using the Eclipse IDE bugger. The issue is that when I try 
to go to look at a ticket or the db contents via the web2py admin 
interface, the interface won't come up. In other words, I can click on a 
ticket and then wait and wait for the web2py admin to start and show the 
error. Sometimes, the browser never displays the page. Other times, it 
displays after a very long wait -- most likely triggered by a timeout. I 
suspect that somehow, the postgres db is getting locked. Anybody know how 
to deal with this issue?

-- 
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/groups/opt_out.


[web2py] Re: gae boilerplate vs web2py

2013-10-28 Thread Saisha D
Thanks for the responses everyone.
I've tried the welcome app n read through the docs, things were a breeze to 
set up.

I'm now at the data modeling stage for my app.
I'm quite familiar with bigtable, and most probably going to deploy my 
startup live on app-engine for the initial launch.

Now my question:
the data model I would design if backend were mySQL, would be quite 
different from if it's bigtable.
and I see the DAL layer tries to abstract away this logic providing a 
sql-like interface so that backends can be switched.
What are best practices if we were to go the app-engine route?
Does using web2py make things slower? I know NDB support is in the works...
https://groups.google.com/forum/#!msg/web2py/Tek9hreXC3U/a5Wo210ekF0J
but would that let me take advantage of powerful features of NDB?
Do ppl using app-engine with web2py use DAL?
Can we directly talk to app-engine from web2py?



On Tuesday, October 15, 2013 11:02:11 PM UTC-7, Saisha D wrote:
>
> Hi All, 
>  Apologies if this is a repost, my last post did not go through for many 
> hours, posting again.
>
> I'm a newbie to web development, but quite familiar with python (use it at 
> work), I'm trying to quickly prototype some ideas for a startup website.
> My goal is to deploy it initially with app engine, I also heard that 
> twitter bootstrap is very helpful for UI.
>
> I found https://github.com/coto/gae-boilerplate after googling, and 
> almost settled on it since it had
> gae ndb support, webapp2, federated login, twitter bootstrap and all this 
> hooked together.
>
> but my friend pointed to me that web2py is a better option and it's much 
> better supported (as I can see from this user group).
>
> My question for you folks:
> Am I making the right decision to go towards web2py?
> Is twitter bootstrap built into web2py or some form of it, or can it be 
> hooked into it, 
> Can I use NDB for google app engine(free account)?
>
> Please point me to any prior posts/articles on this topic if all this has 
> been answered 
>
> Thanks in advance
> Saisha
>

-- 
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/groups/opt_out.


Re: [web2py] Re: Join might work? Table limits?

2013-10-28 Thread Diogo Munaro
Here is the sql generated:

SELECT  groups.name, city.name, auth_user.email, name1.id,
name1.is_active, name1.created_on, name1.created_by, name1.modified_on,
name1.modified_by, name1.user_id, name1.image, name1.image_file,
name1.lattes, name2.id, name2.is_active, name2.created_on,
name2.created_by, name2.modified_on, name2.modified_by, name2.site,
name2.url, name2.cnpj, name2.type_id, name2.group_id, name2.privacity FROM
researcher_lab_permission, researcher, lab JOIN groups ON ((groups.id =
lab.group_id) AND (groups.is_active = 'T')) JOIN city ON (city.id =
groups.city_id) JOIN auth_user ON ((researcher.user_id = auth_user.id) AND
(auth_user.is_active = 'T')) JOIN `researcher` AS name1 ON (researcher.id =
researcher_lab_permission.researcher_id) JOIN `lab` AS name2 ON ((lab.id =
researcher_lab_permission.lab_id) AND (lab.is_active = 'T'))

Some JOINS are wrong


2013/10/29 Diogo Munaro 

> I need these joins because I need filter some tables without selecting all
> the tables and filtering with where. Anyway, I tried:
>
> rows = (db.groups.id == db.lab.group_id)(db.lab.id ==
> db.researcher_lab_permission.lab_id)(db.researcher.id ==
> db.researcher_lab_permission.researcher_id)(db.researcher.user_id ==
> db.auth_user.id).select(db.groups.name,db.city.name,db.auth_user.ALL)
>
> And it returns:
>  'Query' object is not callable
> I'm using db.executesql and it's working:
>
> db.executesql('''SELECT l.id,g.name,c.name FROM researcher_lab_permission
> as rl JOIN lab as l
> JOIN researcher as r JOIN auth_user as a JOIN groups as g
> JOIN city as c
> ON rl.researcher_id = r.id AND rl.lab_id = l.id AND a.id= 
> r.user_id AND l.group_id =
> g.id
> AND c.id = g.city_id WHERE a.id = %s''' %(auth.user_id))
>
> Something strange with DAL...
>
> 2013/10/28 Massimo Di Pierro 
>
>> (db.groups.**id  == db.lab.group_id)(db.lab.id ==
>> db.researcher_lab_permission.**lab_id)(db.**researcher.id
>>  == db.researcher_lab_permission.**researcher_id)(db.researcher.**user_id
>> == 
>> db.auth_user.id).select(db.groups.name,db.**city.name
>> ,db.auth_user.ALL)
>
>
>
>

-- 
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/groups/opt_out.


Re: [web2py] Re: Join might work? Table limits?

2013-10-28 Thread Diogo Munaro
I need these joins because I need filter some tables without selecting all
the tables and filtering with where. Anyway, I tried:

rows = (db.groups.id == db.lab.group_id)(db.lab.id ==
db.researcher_lab_permission.lab_id)(db.researcher.id ==
db.researcher_lab_permission.researcher_id)(db.researcher.user_id ==
db.auth_user.id).select(db.groups.name,db.city.name,db.auth_user.ALL)

And it returns:
 'Query' object is not callable
I'm using db.executesql and it's working:

db.executesql('''SELECT l.id,g.name,c.name FROM researcher_lab_permission
as rl JOIN lab as l
JOIN researcher as r JOIN auth_user as a JOIN groups as g
JOIN city as c
ON rl.researcher_id = r.id AND rl.lab_id = l.id AND a.id =
r.user_id AND l.group_id = g.id
AND c.id = g.city_id WHERE a.id = %s''' %(auth.user_id))

Something strange with DAL...

2013/10/28 Massimo Di Pierro 

> (db.groups.**id  == db.lab.group_id)(db.lab.id ==
> db.researcher_lab_permission.**lab_id)(db.**researcher.id
>  == db.researcher_lab_permission.**researcher_id)(db.researcher.**user_id
> == db.auth_user.id).select(db.groups.name,db.**city.name
> ,db.auth_user.ALL)

-- 
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/groups/opt_out.


Re: [web2py] Re: Join might work? Table limits?

2013-10-28 Thread Massimo Di Pierro
I am reading this again. I misunderstood the model. This is not an outer 
join. This is an inner join. There is no conflict.

Yet I do not understand. You only select db.groups.name and db.city.name. 
So what you so seem equivalent to this.

groups = db(db.city.id == db.groups.city_id).select(db.groups.name,
db.city.name)

Why join all the other tables? Anyway, try this:

rows = (db.groups.id == db.lab.group_id)(db.lab.id == 
db.researcher_lab_permission.lab_id)(db.researcher.id == 
db.researcher_lab_permission.researcher_id)(db.researcher.user_id == 
db.auth_user.id).select(db.groups.name,db.city.name,db.auth_user.ALL)


On Monday, 28 October 2013 18:45:28 UTC-5, Diogo Munaro wrote:
>
> Yes, thanks Massimo! The first error pass, but now:
>
>  (1054, u"Unknown column 
> 'researcher.user_id' in 'on clause'") 
>
> How could I generate sql to debug it?
>
>
> 2013/10/28 Massimo Di Pierro >
>
>>
>> groups = db().select(db.groups.name,db.**city.name 
>> ,db.auth_user.email,db.researcher.with_alias('name1').ALL, db.lab.
>> with_alias('name2').ALL,
>>
>>  
>> join=[db.groups.on(db.groups.**id == 
>> db.lab.group_id),
>>db.city.on(db.city.id == 
>> db.groups.city_id),
>>db.auth_user.on(db.researcher.**user_id 
>> == db.auth_user.id),
>>db.researcher.with_alias('name1').on(db.**
>> researcher.id  == db.researcher_lab_permission.
>> **researcher_id),
>>db.lab.with_alias('name2').on(db.lab.id == 
>> db.researcher_lab_permission.**lab_id)
>>  ])
>>
>
>
>

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


Re: [web2py] Conexao POSTGRESQL vs PYTHON/WEB2PY - problemas

2013-10-28 Thread Ovidio Marinho
faça um w2p e me envie para eu poder ver o erro.




 Ovidio Marinho Falcao Neto
  ITJP.NET.BR
 ovidio...@gmail.com
 Brasil



Em 28 de outubro de 2013 19:56, Carlynhos77 escreveu:

> sera que nao tem algo haver com minha versao do postgresql? identicar alem
> do banco, qual o esquema ta as tabelas? to usando a versao 8.4 do
> postgresql, as tabelas ta no esquema 1 - saude... ja criei novos arquivos
> para conexao, tirando referencias do gluon mas nao da certo...
>
>
> Em segunda-feira, 28 de outubro de 2013 08h44min52s UTC-2, Ovidio Marinho
> escreveu:
>
>> Porque voce nao usa a ORM do web2py, e esta tentando criar o que existe
>> em models, nao mexa na configuração do gluon
>>
>> no seu db.py use no local do sqlite:
>>
>> import psycopg2
>>
>> db = DAL('postgres://usuario:senha@**localhost:5432/meubanco')
>>
>> OBS.: Usuario do Postgresql e senha do postgres.
>>
>>
>>
>>
>>
>>
>>  Ovidio Marinho Falcao Neto
>>   ITJP.NET.BR
>>  ovid...@gmail.com
>>  Brasil
>>
>>
>>
>> Em 27 de outubro de 2013 11:06, Jose Carlos Vicente Pereira <
>> carly...@gmail.com> escreveu:
>>
>>> Ola, bom dia... estou tentando conectar meu banco postgresql ao meu
>>> projeto, so q nao consigo.. veja meu codigo detalhado abaixo...
>>>
>>> --**--**
>>> --**--**
>>> 
>>> *no MODELS  - "appsettings.py"   ta assim*
>>>
>>> from gluon.storage import Storage
>>>  config = Storage(
>>> db=Storage(),
>>> mail=Storage(),
>>> auth=Storage()
>>> )
>>>
>>> import psycopg2
>>> #conn = psycopg2.connect(host='**localho**st', user='postgres',
>>> password='123',dbname='saude')
>>> conn = psycopg2.connect("dbname=saude user=postgres")
>>> db = conn.cursor()
>>>
>>> config.mail.sender = "alu...@blouweb.com"
>>> config.mail.server = "smtp.gmail.com:587" # "smtp.:25"
>>> config.mail.login = "alu...@blouweb.com:"
>>>
>>> response.title = "INFO-SAÚDE"
>>> response.description = "SAÚDE"
>>>
>>> # glob
>>> response.generic_patterns = ['*']
>>>
>>> *no MODELS   "database.py"   tem isso, no sqllite isso era usado, acho
>>> q pro postgresql nao sera usado*
>>>
>>> #coding: utf-8
>>>
>>> # conectar ao banco de dados
>>> # setar opcoes da DAL
>>>
>>> db = DAL(**config.db)
>>>
>>>
>>> *no MODELS   "datamodel_objects.py"   isso foi usado para criar as
>>> tabelas no sqllite, no postgresql ja criei as tabelas*
>>>
>>> db.define_table("cadcidade",
>>> Field("nome", "text", length=128, notnull=True, unique=True),
>>> Field("uf", "text", length=2, notnull=True),
>>> Field("cep", "text", length=8, notnull=True),
>>> Field("cod_ibge", "integer", length=7),
>>> auth.signature,
>>> format="%(nome)s"
>>> )
>>>
>>>
>>> *no CONTROLLERS  "bases.py"   tem esse codigo pra gerar a grid*
>>> *
>>> *
>>> def list_cidade():
>>> query = db.cadcidade.id > 0
>>> headers = {'cadcidade.nome':   'NOME',
>>> 'cadcidade.uf': 'UF',
>>> 'cadcidade.cep': 'CEP',
>>> 'cadcidade.cod_ibge': 'IBGE' }
>>>
>>> grid = SQLFORM.grid(query=query,
>>>  user_signature=False,
>>> paginate=20,
>>> searchable=False,
>>> csv=False,
>>> fields=[db.cadcidade.nome, db.cadcidade.uf, db.cadcidade.cep,
>>> db.cadcidade.cod_ibge],
>>> orderby=db.cadcidade.nome,
>>> headers=headers
>>> )
>>> return dict(grid=grid)
>>>
>>>
>>> dai esse *CONTROLLER* é exibido numa *VIEWS - BASES* -
>>> "list_cidade.html" o codigo ta assim...
>>>
>>> {{extend 'layout.html'}}
>>>
>>> {{block main}}
>>>
>>> 
>>>  CIDADES 
>>> 
>>>
>>> 
>>> {{=grid}}
>>> 
>>>
>>> {{end}}
>>>
>>>
>>> esse é o caminho q usei, a view ta sendo carregado sem erro, so q ta
>>> ligada no banco DUMMY.DB, acho q se nao tem conexao d banco o aplicativo
>>> gera esse banco automatico...
>>>
>>> o postgresql ta instalado correto, pois abro ele pelo PgAdmin e mexo nas
>>> tabelas sem problemas
>>>
>>> lembrando q usando a conexao do sqllite o projeto funciona sem
>>> problemas...
>>> --**--**
>>> --**--**
>>> --**-
>>>
>>> alguem pode me ajudar?
>>>
>>>
>>>  --
>>> 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.
>

Re: [web2py] how to use startswith in query

2013-10-28 Thread Mark
Niphlod,

Thank you very much for your detail answers. It seems that your new data 
model is better, and is the way to go.

My old model may be fine for my small database using the "OR". I may try 
both and compare.

Thanks!

On Monday, October 28, 2013 6:20:31 PM UTC-4, Niphlod wrote:
>
> ok. there's clearly a mismatch between what you expect from what you're 
> writing.
>
> db.table.field == 'something'
> db.table.field > something
> db.table.field.startswith('something')
> db.table.field.contains('something')
>
> are what in DAL are called Queries. 
> They turn out to be the "WHERE" part in T-SQL.
> DAL (with an exception on the belongs() method) expects the 'something' to 
> be fixed.
>
> Now, you want your relationship defined out of a relation that in T-SQL 
> isn't really performant ( startswith turns into a LIKE statement that 
> basically needs to scan the entire table).
> I'd advise you to simply add to the equipment table a reference to the 
> models... queries are much faster that way (both writing them and execution 
> times on the backend).
>
> "my data model"
> db.define_table("models", Field("name"), Field("expected_life", "integer"
> ))
> db.define_table("equipment", Field("model_id", "reference models"), Field(
> "name"))
> #fetch all equipments with 10 years of expected life
> db(db.models.expected_life == 10)(db.equipment.model_id == db.models.id).
> select(db.equipment.ALL)
>
> Assuming you want to pursue your model, and assuming that is roughly
>
> db.define_table("models", Field("name"), Field("expected_life", "integer"
> ))
> db.define_table("equipment", Field("name"))
>
>
> what you need instead is to basically fetch all models and do something 
> like name.startswith(first_result) OR name.startswith(second_result) OR 
>
> #fetch all models with 10 years of expected life
> models_10 = db(db.models.expected_life == 10).select() ##holds SVP7 and 
> such
> queries = [db.equipment.name.startswith(row.name) for row in models_10]
> #now, let's put them in a OR ... OR fashion
> query = reduce(lambda a,b: (a|b), queries)
> #finally, fetch the equipments
> equipments_10 = db(query).select()
>
>
>
>

-- 
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/groups/opt_out.


[web2py] Re: One of the best things that happened to web2py

2013-10-28 Thread b00m_chef
I use PA, and am supper happy. I have thought about doing a VPS or Shared 
Hosting at other places, however, PA is just so well integrated with web2py 
(or vice-versa?), that it just makes sense to just go with them.

Well done Giles!!

Currently using the free account, but thanks to the great pricing (recently 
updated), and the great setup, I will be converting to a paid account 
shortly.



On Monday, 28 October 2013 09:41:35 UTC-7, Massimo Di Pierro wrote:
>
> I am happy to announce a great new opportunity for web2py users:
>
>  https://www.pythonanywhere.com/try-web2py
>
> Basically they give you the opportunity to create a web2py instance 
> directly from the browser without sign-up. The instance only lives for 24 
> hrs unless you sign-up. In that case it will persist.
> The basic plan is also free.
>
> This is a great new way to show web2py to your friends and convince them 
> to try it without commitment. It also works great for teaching web2py. 
>
> I encourage you to try it. 
>
> web2py.com is hosted on PythonAnywhere and we are very happy with it.
>
> Massimo
>

-- 
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/groups/opt_out.


Re: [web2py] Best way to learn web2py

2013-10-28 Thread Dave S
On Friday, October 25, 2013 9:40:10 PM UTC-7, Massimo Di Pierro wrote:
>
> It would help to know exactly what we can do better. Where do you need we 
> need more explanations?
>
>
You'll have to wait for a specific example; they've all drained out of my 
head for the moment.  Probably in the area of services and auth, because I 
haven't started working with json yet.

Sometimes, for readers like me, the extra explanation needed is just the 
same stuff in different words.  Which this group has been great at 
providing.

Sometimes, what's needed is a different example, so that a slightly 
different approach can show the tools [in Web2Py] from another angle.

That's where having a wider list of resources (such as other web sites that 
provide basic training for Web2Py.

And doesn't it sound better to be telling curious visitors, "There's a 
whole raft of material on how to use Web2Py!", compared to "Well, there's 2 
books by the core team.  Good stuff, but just 2 books.  Oh, and a support 
group."

I'm looking forward to spending more time with the Web2PySlices examples, 
especially since some new ones have been added in response to questions 
that have appeared here.  I have an idea for contributing one of my own. 
 But impressing the visitors with how much there is to support their choice 
of Web2Py isn't a bad thing, either.

/dps

 

>
> On Friday, 25 October 2013 16:19:56 UTC-5, Dave S wrote:
>>
>> On Friday, October 25, 2013 2:16:24 PM UTC-7, Dave S wrote:
>>>
>>>
>>> On Friday, October 25, 2013 1:51:09 PM UTC-7, Derek wrote:

 I don't think anything is "missing". People just want to get their toes 
 wet when creating websites, and prefer instant gratification to reading 
 the 
 documentation. Nothing wrong with that, and adding more documentation 
 really isn't going to solve the problem. My advice to anyone who wants to 
 learn web2py is to read the official documentation cover to cover. That's 
 it. It's not a difficult read, and it's not very long. 


>>> As someone who recently started with Web2Py, but with some background in 
>>> Python, websites (html and php), and simple use of DBs, I disagree.  I read 
>>> the online book.  I worked through the examples in the overview.  And I 
>>> still have questions.  The book is excellent.  It is not enough by itself.
>>>
>>>
>> And reading 2 months of back issues of this group, and following along 
>> for 2 more months is not exactly pursuing instant gratification.
>>
>> /dps
>>
>>  
>>
>>> On Thursday, October 24, 2013 12:32:05 PM UTC-7, Dave S wrote:
>
>
>
> On Thursday, October 24, 2013 10:53:54 AM UTC-7, Derek wrote:
>>
>> Well, I don't particularly like that website. It's cluttered, 
>> disjointed. 
>>
>> I think pointing people to the Web2Py Book (aka Documentation) is the 
>> way to go.
>>
>>
> Well, it helps that the Web2Py book is quite thorough and well 
> written.  Other products should be jealous.  But this group wouldn't be 
> very busy if nothing else was needed.
> The Totally Official Web2Py website has the Documentation and 
> Resources page
> 
>
> which has a Learning and Demos section, which I should check out more.
>
> Another resource would be the Web2PySlices site, which is also listed 
> on the above page; I've skimmed through some of the examples there and on 
> the utils and plug-ins links.
>
> Finally, several of the key contributores have their own book:
> <
> http://www.packtpub.com/web2py-application-development-recipes-to-master-python-web-framework-cookbook/book?utm_source=web2py.com&utm_medium=link&utm_content=pod&utm_campaign=mdb_009617#sample
> >
>
> I haven't had a chance to check that one out, but it looks itneresting 
> and the authors have made plenty of good contributions to the user group 
> here.
>
> So (other than the distracting background image), what's missing from 
> Massimo's page compared to the "Learning Ruby" page the OP cites would be 
> a 
> short summary or review of each of the resources.
>
> /dps
>
>  
>
>> To quote PEP20:
>> "There should be one and preferably only one obvious way to do it."
>>
>> The simple fact is that if you learn Web2Py some other way, and come 
>> here to ask questions on how to do something, most answers you'll get 
>> will 
>> refer to the official documentation. Might as well read it. It's simple 
>> short and to the point. 
>>
>  
>>
>

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

Re: [web2py] Re: Join might work? Table limits?

2013-10-28 Thread Diogo Munaro
Yes, thanks Massimo! The first error pass, but now:

 (1054, u"Unknown column
'researcher.user_id' in 'on clause'")

How could I generate sql to debug it?


2013/10/28 Massimo Di Pierro 

>
> groups = db().select(db.groups.name,db.**city.name 
> ,db.auth_user.email,db.researcher.with_alias('name1').ALL, db.lab.
> with_alias('name2').ALL,
>
>  
> join=[db.groups.on(db.groups.**id ==
> db.lab.group_id),
>db.city.on(db.city.id ==
> db.groups.city_id),
>db.auth_user.on(db.researcher.**user_id ==
> db.auth_user.id),
>db.researcher.with_alias('name1').on(db.**
> researcher.id  == db.researcher_lab_permission.*
> *researcher_id),
>db.lab.with_alias('name2').on(db.lab.id ==
> db.researcher_lab_permission.**lab_id)
>  ])
>

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


Re: [web2py] Re: how to add a style to form tags

2013-10-28 Thread Anthony
How are you creating the form? Is it the auth.login() form, or your own 
form? Do you need to use form.custom.begin to get the layout you need?

On Monday, October 28, 2013 6:48:26 PM UTC-4, arche...@gmail.com wrote:
>
> Part of what I wanted to do was manipulate the inline style dynamically 
> inline in the tag. It seems that it is being stated that a workaround is 
> needed for this... but thank you for all your help!
>
> On Monday, October 28, 2013 6:42:13 PM UTC-4, Ramos wrote:
>>
>> @css
>>
>> form.myform {
>> ...
>> }
>>
>> only afects myform class, not all forms
>>
>>
>> 2013/10/28 
>>
>>> {{login_form['_style']="display:inline"}} does not work
>>>
>>> @Ramos, in this specific case, I would like the style to be inline with 
>>> the form tag rather than anywhere else, since anywhere else would affect 
>>> forms globally.
>>>
>>>
>>> On Monday, October 28, 2013 6:12:28 PM UTC-4, Paolo Caruccio wrote:

 Perhaps this still works

 https://groups.google.com/d/**msg/web2py/DyspJUl_IMM/**njKjq9mEb_0J

 Replace 

 form['_class'] = "form-horizontal"

 with

 form['_style'] = "display:inline;"



 Il giorno lunedì 28 ottobre 2013 22:00:20 UTC+1, arche...@gmail.com ha 
 scritto:
>
>  
> I was wondering how to put a style on a form tag.
> {{login_form.custom.begin['_**style']="display:inline"}} fails with 
> error ('XML' object does not support item 
> assignment)
>
> Thank you in advance!
>  
>  -- 
>>> 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/groups/opt_out.
>>>
>>
>>

-- 
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/groups/opt_out.


[web2py] Testing redirection with py.test

2013-10-28 Thread Vinicius Assef
I created this gist to help people testing controllers that makes redirection:
https://gist.github.com/viniciusban/7206413

Hope it helps someone.

-- 
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/groups/opt_out.


Re: [web2py] Re: how to add a style to form tags

2013-10-28 Thread archeaneon
Part of what I wanted to do was manipulate the inline style dynamically 
inline in the tag. It seems that it is being stated that a workaround is 
needed for this... but thank you for all your help!

On Monday, October 28, 2013 6:42:13 PM UTC-4, Ramos wrote:
>
> @css
>
> form.myform {
> ...
> }
>
> only afects myform class, not all forms
>
>
> 2013/10/28 >
>
>> {{login_form['_style']="display:inline"}} does not work
>>
>> @Ramos, in this specific case, I would like the style to be inline with 
>> the form tag rather than anywhere else, since anywhere else would affect 
>> forms globally.
>>
>>
>> On Monday, October 28, 2013 6:12:28 PM UTC-4, Paolo Caruccio wrote:
>>>
>>> Perhaps this still works
>>>
>>> https://groups.google.com/d/**msg/web2py/DyspJUl_IMM/**njKjq9mEb_0J
>>>
>>> Replace 
>>>
>>> form['_class'] = "form-horizontal"
>>>
>>> with
>>>
>>> form['_style'] = "display:inline;"
>>>
>>>
>>>
>>> Il giorno lunedì 28 ottobre 2013 22:00:20 UTC+1, arche...@gmail.com ha 
>>> scritto:

  
 I was wondering how to put a style on a form tag.
 {{login_form.custom.begin['_**style']="display:inline"}} fails with 
 error ('XML' object does not support item 
 assignment)

 Thank you in advance!
  
  -- 
>> 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/groups/opt_out.
>>
>
>

-- 
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/groups/opt_out.


Re: [web2py] Re: how to add a style to form tags

2013-10-28 Thread António Ramos
@css

form.myform {
...
}

only afects myform class, not all forms


2013/10/28 

> {{login_form['_style']="display:inline"}} does not work
>
> @Ramos, in this specific case, I would like the style to be inline with
> the form tag rather than anywhere else, since anywhere else would affect
> forms globally.
>
>
> On Monday, October 28, 2013 6:12:28 PM UTC-4, Paolo Caruccio wrote:
>>
>> Perhaps this still works
>>
>> https://groups.google.com/d/**msg/web2py/DyspJUl_IMM/**njKjq9mEb_0J
>>
>> Replace
>>
>> form['_class'] = "form-horizontal"
>>
>> with
>>
>> form['_style'] = "display:inline;"
>>
>>
>>
>> Il giorno lunedì 28 ottobre 2013 22:00:20 UTC+1, arche...@gmail.com ha
>> scritto:
>>>
>>>
>>> I was wondering how to put a style on a form tag.
>>> {{login_form.custom.begin['_**style']="display:inline"}} fails with
>>> error ('XML' object does not support item
>>> assignment)
>>>
>>> Thank you in advance!
>>>
>>>  --
> 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/groups/opt_out.
>

-- 
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/groups/opt_out.


[web2py] postgres.app

2013-10-28 Thread Jonathan Lundell
More slightly OT tips for Mac users: Postgres support for OS X in the form of 
an app.

http://postgresapp.com

This ought to be a really easy way to run Postgres locally on OS X, perhaps for 
development and testing when sqlite isn't enough. If you develop on the Mac/iOS 
side, you'll recognize  Mattt Thompson as an indication that it's done right.

-- 
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/groups/opt_out.


[web2py] Re: Join might work? Table limits?

2013-10-28 Thread Massimo Di Pierro
No but if you join the same table multiple times 
(db.researcher_lab_permission) you have to do so using an alias. This 
should work.

groups = db().select(db.groups.name,db.city.name
,db.auth_user.email,db.researcher.with_alias('name1').ALL, db.lab.
with_alias('name2').ALL,
 join=[db.groups.on(db.groups.id == 
db.lab.group_id),
   db.city.on(db.city.id == db.groups.city_id),
   db.auth_user.on(db.researcher.user_id == 
db.auth_user.id),
   db.researcher.with_alias('name1').on(
db.researcher.id == db.researcher_lab_permission.researcher_id),
   db.lab.with_alias('name2').on(db.lab.id == 
db.researcher_lab_permission.lab_id)
 ])


You would have the same issue with raw SQL.

On Monday, 28 October 2013 15:29:02 UTC-5, Diogo Munaro wrote:
>
> Hey guys, I'm using web2py with mysql and I can't do a Inner Join
>
> When I try:
>
> groups = db().select(db.groups.name,db.city.name,
>  join=[db.groups.on(db.groups.id == 
> db.lab.group_id),
>db.city.on(db.city.id == 
> db.groups.city_id),
>db.auth_user.on(db.researcher.user_id == 
> db.auth_user.id),
>db.researcher.on(db.researcher.id == 
> db.researcher_lab_permission.researcher_id),
>db.lab.on(db.lab.id == 
> db.researcher_lab_permission.lab_id)
>  ])
>
>
> Raise this error:
>
>  (1054, u"Unknown column 
> 'lab.group_id' in 'on clause'") 
>
>
> But when I try only:
>
> groups = db().select(db.groups.name,db.city.name,
>  join=[db.groups.on(db.groups.id == 
> db.lab.group_id),
>db.city.on(db.city.id == db.groups.city_id)
>  ])
>
>
> It's works. There are some limit for tables join?
>

-- 
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/groups/opt_out.


Re: [web2py] how to use startswith in query

2013-10-28 Thread Niphlod
ok. there's clearly a mismatch between what you expect from what you're 
writing.

db.table.field == 'something'
db.table.field > something
db.table.field.startswith('something')
db.table.field.contains('something')

are what in DAL are called Queries. 
They turn out to be the "WHERE" part in T-SQL.
DAL (with an exception on the belongs() method) expects the 'something' to 
be fixed.

Now, you want your relationship defined out of a relation that in T-SQL 
isn't really performant ( startswith turns into a LIKE statement that 
basically needs to scan the entire table).
I'd advise you to simply add to the equipment table a reference to the 
models... queries are much faster that way (both writing them and execution 
times on the backend).

"my data model"
db.define_table("models", Field("name"), Field("expected_life", "integer"))
db.define_table("equipment", Field("model_id", "reference models"), Field(
"name"))
#fetch all equipments with 10 years of expected life
db(db.models.expected_life == 10)(db.equipment.model_id == db.models.id).
select(db.equipment.ALL)

Assuming you want to pursue your model, and assuming that is roughly

db.define_table("models", Field("name"), Field("expected_life", "integer"))
db.define_table("equipment", Field("name"))


what you need instead is to basically fetch all models and do something 
like name.startswith(first_result) OR name.startswith(second_result) OR 

#fetch all models with 10 years of expected life
models_10 = db(db.models.expected_life == 10).select() ##holds SVP7 and such
queries = [db.equipment.name.startswith(row.name) for row in models_10]
#now, let's put them in a OR ... OR fashion
query = reduce(lambda a,b: (a|b), queries)
#finally, fetch the equipments
equipments_10 = db(query).select()



-- 
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/groups/opt_out.


[web2py] Re: how to add a style to form tags

2013-10-28 Thread archeaneon
{{login_form['_style']="display:inline"}} does not work

@Ramos, in this specific case, I would like the style to be inline with the 
form tag rather than anywhere else, since anywhere else would affect forms 
globally.

On Monday, October 28, 2013 6:12:28 PM UTC-4, Paolo Caruccio wrote:
>
> Perhaps this still works
>
> https://groups.google.com/d/msg/web2py/DyspJUl_IMM/njKjq9mEb_0J
>
> Replace 
>
> form['_class'] = "form-horizontal"
>
> with
>
> form['_style'] = "display:inline;"
>
>
>
> Il giorno lunedì 28 ottobre 2013 22:00:20 UTC+1, arche...@gmail.com ha 
> scritto:
>>
>>
>> I was wondering how to put a style on a form tag.
>> {{login_form.custom.begin['_style']="display:inline"}} fails with 
>> error ('XML' object does not support item 
>> assignment)
>>
>> Thank you in advance!
>>
>>

-- 
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/groups/opt_out.


[web2py] Re: One of the best things that happened to web2py

2013-10-28 Thread Anthony
I think the admin demo is still useful. Creating an installation at 
pythonanywhere and going to the admin app is still an extra barrier that 
some won't bother to jump.

On Monday, October 28, 2013 3:05:03 PM UTC-4, Massimo Di Pierro wrote:
>
> Yes. I think we should remove the demo_admin with this. No reason to have 
> them both.
>
> On Monday, 28 October 2013 13:22:32 UTC-5, Anthony wrote:
>>
>> +1
>>
>> Maybe add a link to this from the web2py.com home page (could add a 
>> button to the group of red buttons on the right).
>>
>> On Monday, October 28, 2013 12:41:35 PM UTC-4, Massimo Di Pierro wrote:
>>>
>>> I am happy to announce a great new opportunity for web2py users:
>>>
>>>  https://www.pythonanywhere.com/try-web2py
>>>
>>> Basically they give you the opportunity to create a web2py instance 
>>> directly from the browser without sign-up. The instance only lives for 24 
>>> hrs unless you sign-up. In that case it will persist.
>>> The basic plan is also free.
>>>
>>> This is a great new way to show web2py to your friends and convince them 
>>> to try it without commitment. It also works great for teaching web2py. 
>>>
>>> I encourage you to try it. 
>>>
>>> web2py.com is hosted on PythonAnywhere and we are very happy with it.
>>>
>>> Massimo
>>>
>>

-- 
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/groups/opt_out.


Re: [web2py] how to add a style to form tags

2013-10-28 Thread Mark Finkelstein
For a specific case, I'd rather have the css be inline, meaning in the tag 
as  rather than in a css file or anywhere else 
on the page

On Monday, October 28, 2013 6:05:36 PM UTC-4, Ramos wrote:
>
> if i understand you , use css in your view to acomplish that
>
> form {
> ...
> }
>
>
> 2013/10/28 >
>
>> I actually wanted to append the style to the form tag itself, not its 
>> elements. So like 
>> What I am getting is that this isn't possible?
>>
>>
>> On Monday, October 28, 2013 5:56:45 PM UTC-4, Ramos wrote:
>>
>>> maybe in your controller...
>>>
>>>  form.element(_name='email')['_**class'] = "campo_email"
>>> form.element(_name='first_**name')['_class'] = "campo_nome"
>>> form.element(_name='last_name'**)['_class'] = "campo_sobrenome"
>>> form.element(_name='password')**['_class'] = "campo_senha"
>>> form.element(_name='password_**two')['_class'] = "campo_confirmacao"
>>>
>>>
>>>
>>> 2013/10/28 
>>>
   
 I was wondering how to put a style on a form tag.
 {{login_form.custom.begin['_**st**yle']="display:inline"}} fails with 
 error ('XML' object does not support item 
 assignment)

 Thank you in advance!
  
  -- 
 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/**groups/opt_out
 .

>>>
>>>  -- 
>> 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/groups/opt_out.
>>
>
>

-- 
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/groups/opt_out.


[web2py] Re: having trouble with data-xxx when they are not a simple option

2013-10-28 Thread Anthony


> CALBOX(_name='tsdate', _id='tsdate')
>

Where exactly does the above line go? When I try you exact code, I do not 
get any escaping of the quotes (checked the source returned to the browser 
and even tried using gluon.tools.fetch from the shell).

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/groups/opt_out.


[web2py] Re: how to add a style to form tags

2013-10-28 Thread Paolo Caruccio
Perhaps this still works

https://groups.google.com/d/msg/web2py/DyspJUl_IMM/njKjq9mEb_0J

Replace 

form['_class'] = "form-horizontal"

with

form['_style'] = "display:inline;"



Il giorno lunedì 28 ottobre 2013 22:00:20 UTC+1, arche...@gmail.com ha 
scritto:
>
>
> I was wondering how to put a style on a form tag.
> {{login_form.custom.begin['_style']="display:inline"}} fails with 
> error ('XML' object does not support item 
> assignment)
>
> Thank you in advance!
>
>

-- 
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/groups/opt_out.


Re: [web2py] how to add a style to form tags

2013-10-28 Thread António Ramos
if i understand you , use css in your view to acomplish that

form {
...
}


2013/10/28 

> I actually wanted to append the style to the form tag itself, not its
> elements. So like 
> What I am getting is that this isn't possible?
>
>
> On Monday, October 28, 2013 5:56:45 PM UTC-4, Ramos wrote:
>
>> maybe in your controller...
>>
>>
>>  form.element(_name='email')['_**class'] = "campo_email"
>> form.element(_name='first_**name')['_class'] = "campo_nome"
>> form.element(_name='last_name'**)['_class'] = "campo_sobrenome"
>> form.element(_name='password')**['_class'] = "campo_senha"
>> form.element(_name='password_**two')['_class'] = "campo_confirmacao"
>>
>>
>>
>> 2013/10/28 
>>
>>>
>>> I was wondering how to put a style on a form tag.
>>> {{login_form.custom.begin['_**st**yle']="display:inline"}} fails with
>>> error ('XML' object does not support item
>>> assignment)
>>>
>>> Thank you in advance!
>>>
>>>  --
>>> 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/**groups/opt_out
>>> .
>>>
>>
>>  --
> 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/groups/opt_out.
>

-- 
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/groups/opt_out.


Re: [web2py] how to add a style to form tags

2013-10-28 Thread archeaneon
I actually wanted to append the style to the form tag itself, not its 
elements. So like 
What I am getting is that this isn't possible?

On Monday, October 28, 2013 5:56:45 PM UTC-4, Ramos wrote:
>
> maybe in your controller...
>
>  form.element(_name='email')['_class'] = "campo_email"
> form.element(_name='first_name')['_class'] = "campo_nome"
> form.element(_name='last_name')['_class'] = "campo_sobrenome"
> form.element(_name='password')['_class'] = "campo_senha"
> form.element(_name='password_two')['_class'] = "campo_confirmacao"
>
>
>
> 2013/10/28 >
>
>>  
>> I was wondering how to put a style on a form tag.
>> {{login_form.custom.begin['_**style']="display:inline"}} fails with 
>> error ('XML' object does not support item 
>> assignment)
>>
>> Thank you in advance!
>>  
>>  -- 
>> 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/groups/opt_out.
>>
>
>

-- 
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/groups/opt_out.


[web2py] Re: how to add a style to form tags

2013-10-28 Thread Niphlod
form.custom.begin is not an helper like A, LI, FORM, etc... so you can't 
use usual _attributes for it.

form.custom.begin just carries  ... that's because you're 
supposed to fill in between all your form widgets and then close it with 
form.custom.end, that in turn just carries the ending  piece. 

On Monday, October 28, 2013 10:00:20 PM UTC+1, arche...@gmail.com wrote:
>
>
> I was wondering how to put a style on a form tag.
> {{login_form.custom.begin['_style']="display:inline"}} fails with 
> error ('XML' object does not support item 
> assignment)
>
> Thank you in advance!
>
>

-- 
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/groups/opt_out.


Re: [web2py] how to add a style to form tags

2013-10-28 Thread António Ramos
maybe in your controller...


 form.element(_name='email')['_class'] = "campo_email"
form.element(_name='first_name')['_class'] = "campo_nome"
form.element(_name='last_name')['_class'] = "campo_sobrenome"
form.element(_name='password')['_class'] = "campo_senha"
form.element(_name='password_two')['_class'] = "campo_confirmacao"



2013/10/28 

>
> I was wondering how to put a style on a form tag.
> {{login_form.custom.begin['_**style']="display:inline"}} fails with
> error ('XML' object does not support item
> assignment)
>
> Thank you in advance!
>
>  --
> 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/groups/opt_out.
>

-- 
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/groups/opt_out.


Re: [web2py] Conexao POSTGRESQL vs PYTHON/WEB2PY - problemas

2013-10-28 Thread Carlynhos77
sera que nao tem algo haver com minha versao do postgresql? identicar alem 
do banco, qual o esquema ta as tabelas? to usando a versao 8.4 do 
postgresql, as tabelas ta no esquema 1 - saude... ja criei novos arquivos 
para conexao, tirando referencias do gluon mas nao da certo...


Em segunda-feira, 28 de outubro de 2013 08h44min52s UTC-2, Ovidio Marinho 
escreveu:
>
> Porque voce nao usa a ORM do web2py, e esta tentando criar o que existe em 
> models, nao mexa na configuração do gluon
>
> no seu db.py use no local do sqlite:
>
> import psycopg2
>
> db = DAL('postgres://usuario:senha@localhost:5432/meubanco')
>
> OBS.: Usuario do Postgresql e senha do postgres.
>
>
>
>   
>
>
>  Ovidio Marinho Falcao Neto
>   ITJP.NET.BR
>  ovid...@gmail.com  
>  Brasil
>   
>
>
> Em 27 de outubro de 2013 11:06, Jose Carlos Vicente Pereira <
> carly...@gmail.com > escreveu:
>
>> Ola, bom dia... estou tentando conectar meu banco postgresql ao meu 
>> projeto, so q nao consigo.. veja meu codigo detalhado abaixo...
>>
>>
>> 
>> *no MODELS  - "appsettings.py"   ta assim* 
>>
>> from gluon.storage import Storage
>>  config = Storage(
>> db=Storage(),
>> mail=Storage(),
>> auth=Storage()
>> )
>>
>> import psycopg2
>> #conn = psycopg2.connect(host='**localhost', user='postgres', 
>> password='123',dbname='saude')
>> conn = psycopg2.connect("dbname=saude user=postgres")
>> db = conn.cursor()
>>
>> config.mail.sender = "alu...@blouweb.com "
>> config.mail.server = "smtp.gmail.com:587" # "smtp.:25"
>> config.mail.login = "alu...@blouweb.com :"
>>
>> response.title = "INFO-SAÚDE"
>> response.description = "SAÚDE"
>>
>> # glob
>> response.generic_patterns = ['*']
>>
>> *no MODELS   "database.py"   tem isso, no sqllite isso era usado, acho q 
>> pro postgresql nao sera usado*
>>
>> #coding: utf-8
>>
>> # conectar ao banco de dados
>> # setar opcoes da DAL
>>
>> db = DAL(**config.db)
>>
>>
>> *no MODELS   "datamodel_objects.py"   isso foi usado para criar as 
>> tabelas no sqllite, no postgresql ja criei as tabelas*
>>
>> db.define_table("cadcidade",
>> Field("nome", "text", length=128, notnull=True, unique=True),
>> Field("uf", "text", length=2, notnull=True),
>> Field("cep", "text", length=8, notnull=True),
>> Field("cod_ibge", "integer", length=7),
>> auth.signature,
>> format="%(nome)s"
>> )
>>
>>
>> *no CONTROLLERS  "bases.py"   tem esse codigo pra gerar a grid*
>> *
>> *
>> def list_cidade():
>> query = db.cadcidade.id > 0
>> headers = {'cadcidade.nome':   'NOME',
>> 'cadcidade.uf': 'UF',
>> 'cadcidade.cep': 'CEP',
>> 'cadcidade.cod_ibge': 'IBGE' }
>>
>> grid = SQLFORM.grid(query=query, 
>>  user_signature=False,
>> paginate=20,
>> searchable=False,
>> csv=False,
>> fields=[db.cadcidade.nome, db.cadcidade.uf, db.cadcidade.cep, 
>> db.cadcidade.cod_ibge],
>> orderby=db.cadcidade.nome,
>> headers=headers
>> )
>> return dict(grid=grid)
>>
>>
>> dai esse *CONTROLLER* é exibido numa *VIEWS - BASES* - 
>> "list_cidade.html" o codigo ta assim...
>>
>> {{extend 'layout.html'}}
>>
>> {{block main}}
>>
>> 
>>  CIDADES 
>> 
>> 
>> 
>> {{=grid}}
>> 
>>
>> {{end}}
>>
>>
>> esse é o caminho q usei, a view ta sendo carregado sem erro, so q ta 
>> ligada no banco DUMMY.DB, acho q se nao tem conexao d banco o aplicativo 
>> gera esse banco automatico...
>>
>> o postgresql ta instalado correto, pois abro ele pelo PgAdmin e mexo nas 
>> tabelas sem problemas
>>
>> lembrando q usando a conexao do sqllite o projeto funciona sem 
>> problemas...
>>
>> ---
>>
>> alguem pode me ajudar?
>>
>>
>>  -- 
>> 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/groups/opt_out.
>>
>
>

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

[web2py] Re: having trouble with data-xxx when they are not a simple option

2013-10-28 Thread Niphlod
@DenesL...uhm...what I was saying is that a plugin **should** expect 
anything in a data-* to be escaped. This means that from a plugin 
standpoint, 



should be treated exactly as 



As a matter of fact, jQuery treats them equally.
Both this calls
$('#test1').data('options')
$('#test2').data('options')
return the same exact object.

So no need for that workaround Anthony said.



-- 
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/groups/opt_out.


[web2py] Re: having trouble with data-xxx when they are not a simple option

2013-10-28 Thread DenesL

Thanks Niphlod, that is true.

The problem was in one of the js files from dev.jtsage.com (or with the one 
I had downloaded).
It works fine with the latest from their cdn 
http://dev.jtsage.com/cdn/datebox/latest/ 


*Still, having to add Anthony's trick seems very un-web2py-ish*
XML(input.xml().replace('"{', "'{").replace('}"', "}'"))



On Monday, October 28, 2013 12:47:34 PM UTC-4, Niphlod wrote:
>
> BTW, the quoted representation **should** be valid nonetheless.
>
> What plugins do is extracting whatever is in the data and evaluating to a 
> js object, so it shouldn't really matter beween
>
> data-something='{a: b}'
> and 
> data-something="thequotedrepr_of_{a:b}"
>
> unless the plugin is so strict (and insecure) to not do the 
> reverted-escaping.
>
>

-- 
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/groups/opt_out.


[web2py] Re: Best way to learn web2py

2013-10-28 Thread Andreas Wienes
I published http://learn-web2py.com a few minutes ago. It's far away from 
being perfect, but it's an first attempt. I'm neither an expert in web2py 
nor a native speaker. All of your feedback is welcome!

- Andreas

-- 
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/groups/opt_out.


[web2py] how to add a style to form tags

2013-10-28 Thread archeaneon

I was wondering how to put a style on a form tag.
{{login_form.custom.begin['_style']="display:inline"}} fails with 
error ('XML' object does not support item 
assignment)

Thank you in advance!

-- 
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/groups/opt_out.


Re: [web2py] how to use startswith in query

2013-10-28 Thread Mark
I have a equipment table contains different equipments with model numbers 
such as "SVP701", "SVP710", "SVP755". Another lookup table contains their 
expected life time for model numbers such as "SVP7" for 10 years, "TPU3" 
for 20 years. I want the wildcard "SVP7" match all "SVP701", "SVP710", 
"SVP755", so that the lookup table is simple and short.

I think the query is like:

query = db.equipment.model.startswith(db.life_time.model)

Then, I want to put the query in the SQLFORM.grid to display results. Thanks


On Monday, October 28, 2013 4:07:56 PM UTC-4, viniciusban wrote:
>
> Could you supply an example of what you intend to achieve, preferably a 
> query? 
>
> On Mon, Oct 28, 2013 at 5:17 PM, Mark > 
> wrote: 
> > Viniciusban, 
> > 
> > Thank you for the help. But I don't know if the name is "John" or 
> whatever. 
> > I hope the name such as "John" can be fetched dynamically from another 
> table 
> > (e.g. db.student). Now, I think maybe it is not possible. 
> > 
> > 
> > On Monday, October 28, 2013 3:04:29 PM UTC-4, viniciusban wrote: 
> >> 
> >> rows = db(db.person.name.startswith("John")).select() 
> >> 
> >> On Mon, Oct 28, 2013 at 1:50 PM, Mark  wrote: 
> >> > Hello, 
> >> > 
> >> > I want to use startswith in a query like following, but it didn't 
> work: 
> >> > 
> >> > db.person.name.startswith(db.student.name) 
> >> > 
> >> > What is wrong in this query? Is there a better way for it or  a work 
> >> > around? 
> >> > Any help would be greatly appreciated. 
> >> > 
> >> > 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+un...@googlegroups.com. 
> >> > For more options, visit https://groups.google.com/groups/opt_out. 
> > 
> > -- 
> > 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/groups/opt_out. 
>

-- 
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/groups/opt_out.


[web2py] How to put a style on a form tag

2013-10-28 Thread Mark Finkelstein
I was wondering how to put a style on a form tag.
{{login_form.custom.begin['_style']="display:inline"}} fails with 
error ('XML' object does not support item 
assignment)

Thank you in advance!

-- 
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/groups/opt_out.


Re: [web2py] Re: One of the best things that happened to web2py

2013-10-28 Thread Richard Vézina
This is pretty nice, but since I heard about it the first time, I thought
"what a greate ressources for fishing attack for malicious geek"

:)

Richard


On Mon, Oct 28, 2013 at 3:52 PM, Giles Thomas wrote:

> On Monday, October 28, 2013 7:24:39 PM UTC, stefaan wrote:
>
>> I tried creating something last week as I saw it announced on the dev
>> mailing list, and despite not signing up, I now see it still appears to
>> be alive. Is this expected?
>
>
> (PythonAnywhere guy here.)
>
> It's more the case that we don't promise that the site will stay up after
> 24 hours have expired than that we guarantee that it *will* disappear after
> 24 hours.  It's a manual process to clear down sites from people that
> decide not to sign up.  Hope that makes sense!
>
>
> Giles
>
> --
> 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/groups/opt_out.
>

-- 
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/groups/opt_out.


Re: [web2py] FPDF issue

2013-10-28 Thread Richard Vézina
did you user your_string.decode('utf8') before passing to FPDF??

I think you have mistake in your code, you should provide example code in
you issue report!!

Richard


On Mon, Oct 28, 2013 at 2:40 PM, step  wrote:

> I discovered and reported in
> http://code.google.com/p/pyfpdf/issues/detail?id=66 an issue with
> gluon/contrib/FPFD. Basically, rendering HTML  tags as PDF may trigger
> a utf8 codec error because fpdf/html.py sets the bullet character as
> '\x95'. As a work-around I have replaced '\x95' with '*'.
>
> --
> 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/groups/opt_out.
>

-- 
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/groups/opt_out.


[web2py] Join might work? Table limits?

2013-10-28 Thread Diogo Munaro
Hey guys, I'm using web2py with mysql and I can't do a Inner Join

When I try:

groups = db().select(db.groups.name,db.city.name,
 join=[db.groups.on(db.groups.id == 
db.lab.group_id),
   db.city.on(db.city.id == db.groups.city_id),
   db.auth_user.on(db.researcher.user_id == 
db.auth_user.id),
   db.researcher.on(db.researcher.id == 
db.researcher_lab_permission.researcher_id),
   db.lab.on(db.lab.id == 
db.researcher_lab_permission.lab_id)
 ])


Raise this error:

 (1054, u"Unknown column 
'lab.group_id' in 'on clause'") 


But when I try only:

groups = db().select(db.groups.name,db.city.name,
 join=[db.groups.on(db.groups.id == 
db.lab.group_id),
   db.city.on(db.city.id == db.groups.city_id)
 ])


It's works. There are some limit for tables join?

-- 
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/groups/opt_out.


[web2py] Re: Setting up CGI calls

2013-10-28 Thread Derek
click the 'update settings' button after changing the settings, and you 
should see the url change (it uses a GET request).

On Sunday, October 27, 2013 1:37:08 PM UTC-7, melmg wrote:
>
> Hello, 
> I am trying to understand how to set up communication between a 
> microcontroller (Stellaris LM3S8962 Evaluation board) and a Web2py 
> application hosted in Google App Engine. The Stellaris can host a web 
> server and I have a webserver demo that uses CGI on the Stellaris. The demo 
> allows you to change the LED state (on/off) on the board and also to 
> display text via a form on the Stellaris web browser. What I am trying to 
> do is to be able to do the same but from the web2py application. From what 
> I've gathered, I'd have to send the request via an http header (right?) 
> I'm just unsure as to how to write the code in web2py to do that. Also, I 
> have the board directly connected to my laptop and it defaults to a 
> specific IP address. Can someone help me? Every little bit helps, I'm 
> really confused.
>
> This is the Stellaris file with the form for further clarification. It is 
> called *io_cgi.ssi*
>
> 
> 
> 
>  >I/O Control Demo 2
>
>
> 
> 
> 
> 
> body
> {
> font-family: Arial;
> background-color: white;
> margin: 10px;
> padding: 0px
> }
> h1
> {
> color: #7C7369;
> font-family: Arial;
> font-size: 24pt;
> font-style: italic;
> }
> h2
> {
> color: #00;
> font-family: Arial;
> font-size: 18pt;
> font-style: bold;
> }
> h3
> {
> color: #7C7369;
> font-family: Arial;
> font-size: 12pt;
> font-style: bold;
> }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Stellaris® LM3S8962 Evaluation Kit
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  About TI
> 
> 
> 
>  About the Stellaris Family
> 
> 
> 
>  Block Diagram
> 
> 
> 
>  I/O Control Demo 1
> (HTTP Requests)
> 
> 
> 
> I/O Control Demo 2
> (SSI/CGI)
> 
> 
> 
> 
> 
> 
> I/O Control Demo 2
> 
> 
> 
> 
> This demonstration shows another method of performing control
> and status reporting. This time, we use Server Side Include tags to
> replace text in the page as it is being server from the Stellaris board
> and standard HTML forms to send data to a CGI handler running on the
> board.  This example does cause the page to be reloaded
> whenever
> form data is submitted but it  involves less complex HTML to
> perform the task.
> 
> 
> 
> 
> 
> 
>  "100%">
> 
> 
> Control
> Current
> New
> 
> 
> LED
> State
> 
>  "checkbox">
> 
> 
> PWM
> State
> 
>  "checkbox">
> 
> 
> PWM
> Frequency (Hz)
> 
>  "PWMFrequency" value="">
> 
> 
> PWM
> Duty Cycle (%)
> 
>  "PWMDutyCycle" value="">
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  "80%">
> 
> 
> 
> 
> 
> 
> 
> Display this
> text on the screen:
>   value="Send Text" type="submit">
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Copyright © 2009-2013 Texas Instruments Incorporated.  All 
> rights reserved.
> 
> 
> 
> 
> 
>
>

-- 
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/groups/opt_out.


Re: [web2py] how to use startswith in query

2013-10-28 Thread Vinicius Assef
Could you supply an example of what you intend to achieve, preferably a query?

On Mon, Oct 28, 2013 at 5:17 PM, Mark  wrote:
> Viniciusban,
>
> Thank you for the help. But I don't know if the name is "John" or whatever.
> I hope the name such as "John" can be fetched dynamically from another table
> (e.g. db.student). Now, I think maybe it is not possible.
>
>
> On Monday, October 28, 2013 3:04:29 PM UTC-4, viniciusban wrote:
>>
>> rows = db(db.person.name.startswith("John")).select()
>>
>> On Mon, Oct 28, 2013 at 1:50 PM, Mark  wrote:
>> > Hello,
>> >
>> > I want to use startswith in a query like following, but it didn't work:
>> >
>> > db.person.name.startswith(db.student.name)
>> >
>> > What is wrong in this query? Is there a better way for it or  a work
>> > around?
>> > Any help would be greatly appreciated.
>> >
>> > 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+un...@googlegroups.com.
>> > For more options, visit https://groups.google.com/groups/opt_out.
>
> --
> 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/groups/opt_out.

-- 
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/groups/opt_out.


[web2py] Re: One of the best things that happened to web2py

2013-10-28 Thread Giles Thomas
On Monday, October 28, 2013 7:24:39 PM UTC, stefaan wrote:

> I tried creating something last week as I saw it announced on the dev 
> mailing list, and despite not signing up, I now see it still appears to 
> be alive. Is this expected? 


(PythonAnywhere guy here.)

It's more the case that we don't promise that the site will stay up after 
24 hours have expired than that we guarantee that it *will* disappear after 
24 hours.  It's a manual process to clear down sites from people that 
decide not to sign up.  Hope that makes sense!


Giles

-- 
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/groups/opt_out.


[web2py] Re: One of the best things that happened to web2py

2013-10-28 Thread Stefaan Himpe

> The instance only lives for

24 hrs unless you sign-up. In that case it will persist.


Hi,

I tried creating something last week as I saw it announced on the dev 
mailing list, and despite not signing up, I now see it still appears to 
be alive. Is this expected?


Best regards,
Stefaan.

--
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/groups/opt_out.


Re: [web2py] how to use startswith in query

2013-10-28 Thread Mark
Viniciusban,

Thank you for the help. But I don't know if the name is "John" or whatever. 
I hope the name such as "John" can be fetched dynamically from another 
table (e.g. db.student). Now, I think maybe it is not possible. 


On Monday, October 28, 2013 3:04:29 PM UTC-4, viniciusban wrote:
>
> rows = db(db.person.name.startswith("John")).select() 
>
> On Mon, Oct 28, 2013 at 1:50 PM, Mark > 
> wrote: 
> > Hello, 
> > 
> > I want to use startswith in a query like following, but it didn't work: 
> > 
> > db.person.name.startswith(db.student.name) 
> > 
> > What is wrong in this query? Is there a better way for it or  a work 
> around? 
> > Any help would be greatly appreciated. 
> > 
> > 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+un...@googlegroups.com . 
> > For more options, visit https://groups.google.com/groups/opt_out. 
>

-- 
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/groups/opt_out.


[web2py] Re: One of the best things that happened to web2py

2013-10-28 Thread Massimo Di Pierro
Yes. I think we should remove the demo_admin with this. No reason to have 
them both.

On Monday, 28 October 2013 13:22:32 UTC-5, Anthony wrote:
>
> +1
>
> Maybe add a link to this from the web2py.com home page (could add a 
> button to the group of red buttons on the right).
>
> On Monday, October 28, 2013 12:41:35 PM UTC-4, Massimo Di Pierro wrote:
>>
>> I am happy to announce a great new opportunity for web2py users:
>>
>>  https://www.pythonanywhere.com/try-web2py
>>
>> Basically they give you the opportunity to create a web2py instance 
>> directly from the browser without sign-up. The instance only lives for 24 
>> hrs unless you sign-up. In that case it will persist.
>> The basic plan is also free.
>>
>> This is a great new way to show web2py to your friends and convince them 
>> to try it without commitment. It also works great for teaching web2py. 
>>
>> I encourage you to try it. 
>>
>> web2py.com is hosted on PythonAnywhere and we are very happy with it.
>>
>> Massimo
>>
>

-- 
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/groups/opt_out.


Re: [web2py] how to use startswith in query

2013-10-28 Thread Vinicius Assef
rows = db(db.person.name.startswith("John")).select()

On Mon, Oct 28, 2013 at 1:50 PM, Mark  wrote:
> Hello,
>
> I want to use startswith in a query like following, but it didn't work:
>
> db.person.name.startswith(db.student.name)
>
> What is wrong in this query? Is there a better way for it or  a work around?
> Any help would be greatly appreciated.
>
> 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/groups/opt_out.

-- 
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/groups/opt_out.


[web2py] FPDF issue

2013-10-28 Thread step
I discovered and reported in 
http://code.google.com/p/pyfpdf/issues/detail?id=66 an issue with 
gluon/contrib/FPFD. Basically, rendering HTML  tags as PDF may trigger 
a utf8 codec error because fpdf/html.py sets the bullet character as 
'\x95'. As a work-around I have replaced '\x95' with '*'.

-- 
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/groups/opt_out.


Re: [web2py] Newbie authentication question

2013-10-28 Thread raferbop
Thanks Richard,

I am having a look right now.

On Monday, October 28, 2013 12:34:34 PM UTC-5, Richard wrote:
>
> https://groups.google.com/d/msg/web2py/xeSxEu4xfA0/qDN6V4_BqK0J
>
>
> http://rochacbruno.com.br/web2py-manage-users-and-membership-in-the-same-form/
>
>
>
> Little research...
>
>
>
> On Mon, Oct 28, 2013 at 1:25 PM, Richard Vézina 
> 
> > wrote:
>
>> https://github.com/elcio/badmin
>>
>>
>>
>>
>> On Mon, Oct 28, 2013 at 1:23 PM, Richard Vézina 
>> 
>> > wrote:
>>
>>> I am not sure exactly what you want.
>>>
>>> You can create group by the appadmin, and you only need to do it once 
>>> for each group. For the assignation of user to a given group, with the 
>>> appadmin you have to do it many time (one for each group member, one at a 
>>> time), if you have to review/add new group member frequently you can create 
>>> a controller function for this...
>>>
>>> The access to this function should be restrict as above.
>>>
>>> You will need a custom widget I guess to make the user membre picking 
>>> easier (not having to populate the membership table one at a time), maybe 
>>> SQLFORM.factory() is a better choice then SQLFORM() in this case to 
>>> construct custom field for the user member picking... Sorry, I don't have 
>>> any pseudo or code that come to mind rapidly, but for sure you can find and 
>>> reuse code available here on the list... Also, there is a better appadmin 
>>> admi interface call badmin or badadmin, you could maybe find code for this, 
>>> or see how it is programmed. There is also web2pyslice where it may be 
>>> possible to find code snippet for this.
>>>
>>> Hopes it helps
>>>
>>> Richard
>>>
>>>
>>> On Mon, Oct 28, 2013 at 12:13 PM, raferbop 
>>> > wrote:
>>>
 Richard, I was about to post a similar question, but let me just ask 
 you. I am also new to web2py, and I am not able to find any good resources 
 in relation to creating multiple groups or assigning roles to users. For 
 example, lets say I have a group of users that I want to categorize as 
 company, drivers, and passengers. Can you shed some light of how I can 
 take 
 the built-in auth_user function and create these various groups.

 Rafer


 On Monday, October 28, 2013 9:21:58 AM UTC-5, Richard wrote:

> If you are sure that the user that will be manage by other user is 1 
> to many (many users that can declared which user is their manager), you 
> can 
> do that (self-reference). But this is only one part of the problem, I 
> think 
> you need to create a group of admin_user that are allow to manage other 
> users, the one that reference them, so you can get the list of users that 
> are mananagable by a given admin user like so : db(db.auth_user.id == 
> auth.user_id).select(db.auth_**user.id ) in 
> this case the auth.user_id is the admin user that is authenticated.
>
> You better have a group of admin and user web2py RBAC to make sure you 
> have a better controller over the users allowed to manage other users. 
> That 
> way, you can user the web2py tool to make sure only the users that have 
> right can access you manage_user function, something like that :
>
> @auth.requires_login()
> @auth.requires(lambda: auth.has_membership('admin'))
> def manage_user():
> rows = db(db.auth_user.id == auth.user_id).select(db.auth_**
> user.id )
> id_of_users_to_be_managed = [row.id for row in rows]
> if request.vars.user_id in id_of_users_to_be_managed:
> form = SQLFORM(db.auth_user, user_id)
>  ...
> else:
>  form = 'You can't manage this user'
> return dict(form=form)
>
>
> :)
>
> Richard
>
>
>
>
>
>
> On Sun, Oct 27, 2013 at 7:05 PM, Mikael Cederberg 
> wrote:
>
>> Hi there and thanks for a stellar project - really cool.  I am trying 
>> to solve an issue that arose and was hoping for a pointer so I can solve 
>> it.
>>
>> I am wanting to use the authentication mechanism of web2py pretty 
>> much as is, but I need to be able to have one registered user, in some 
>> cases, be given the ability to administrate and act as other registered 
>> users.
>> My thoughts were along the lines of adding a column parent_of to 
>> auth_user and if an id is specified here pointing towards another user, 
>> the 
>> specified id can administrate as that user. Would this be a proper way 
>> to 
>> go about it, and how could this be implemented?
>>
>> Any thoughts or ideas would be welcome.
>>
>> Tnx, Mikael
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/**web2py 
>> (Source code)
>> - 
>> https://code.google.co

[web2py] Re: One of the best things that happened to web2py

2013-10-28 Thread Anthony
+1

Maybe add a link to this from the web2py.com home page (could add a button 
to the group of red buttons on the right).

On Monday, October 28, 2013 12:41:35 PM UTC-4, Massimo Di Pierro wrote:
>
> I am happy to announce a great new opportunity for web2py users:
>
>  https://www.pythonanywhere.com/try-web2py
>
> Basically they give you the opportunity to create a web2py instance 
> directly from the browser without sign-up. The instance only lives for 24 
> hrs unless you sign-up. In that case it will persist.
> The basic plan is also free.
>
> This is a great new way to show web2py to your friends and convince them 
> to try it without commitment. It also works great for teaching web2py. 
>
> I encourage you to try it. 
>
> web2py.com is hosted on PythonAnywhere and we are very happy with it.
>
> Massimo
>

-- 
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/groups/opt_out.


[web2py] Re: Problems with Scheduler/ComfortScheduler Monitor setup on a different server than website

2013-10-28 Thread DeanK
That works well too.  It looks a little better so I'm using it.  Thanks!

On Monday, October 21, 2013 11:24:29 AM UTC-4, Niphlod wrote:
>
> uhm. what if you do
>
> {{=PRE(r_.run_output)}}
>
> Without an example it's hard to guess what should be the correct "style".
>
> On Monday, October 21, 2013 4:26:54 PM UTC+2, DeanK wrote:
>>
>> Awesome thanks.  Everything is working now.
>>
>> I've used the scheduler monitor a decent amount and it has worked pretty 
>> well for me. This is the first bug I've noticed but if I find more I'll be 
>> sure to let you know.  The only tweak I've made is the output from my tasks 
>> contains lots of debug information when things go wrong and it was hard to 
>> interpret since newline characters were not being displayed in the table. 
>>  I simply edited line 29 in run_details.html:
>>
>> {{=XML(r_.run_output.replace('\n', ''))}}
>>
>> It's not the prettiest thing in the world. If there are lots of newline 
>> characters it makes the output look almost doubled spaced, but it is useful 
>> and does the trick.
>>
>>
>> Thanks!
>>
>> On Saturday, October 19, 2013 8:57:14 AM UTC-4, Niphlod wrote:
>>>
>>> BTW, found the issue with comfort scheduler. Will update as soon as 
>>> github comes back.
>>>
>>> [edit] Done
>>>
>>

-- 
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/groups/opt_out.


[web2py] Re: OAuth2.0 and Facebook (as from the book)

2013-10-28 Thread Lisandro
I'm having a similar problem with KeyError: 'email'.

I have a site in production that uses oauth2 and offers the possibility of 
register/login using personal facebook account. 
I created a Facebook app and set permissions to get user's email (so I can 
create the account on my site). Everything works perfect, lots of users 
have registered in my site using their Facebook accounts. Even myself.

However, there are some error tickets created with this error of 
"KeyError:email". First I thought that some users didn't let the 
application get their emails, but that's not possible. When you try to log 
in my site using Facebook, facebook tells you that te application will get 
your email, and you only can accept or decline. If you decline, you're not 
registered. And if you accept, my site gets your email and creates the 
account.

So, I don't know which could be the problem. This is the traceback of the 
error:

Traceback (most recent call last):
  File "/var/www/vendosimple/gluon/restricted.py", line 212, in restricted
exec ccode in environment
  File "/var/www/vendosimple/applications/init/controllers/default.py", line 
645, in 
  File "/var/www/vendosimple/gluon/globals.py", line 194, in 
self._caller = lambda f: f()
  File "/var/www/vendosimple/applications/init/controllers/default.py", line 
380, in user
form = auth()
  File "/var/www/vendosimple/gluon/tools.py", line 1250, in __call__
return getattr(self, args[0])()
  File "/var/www/vendosimple/gluon/tools.py", line 2128, in login
cas_user = cas.get_user()
  File "applications/init/modules/globales.py", line 41, in get_user
username=user['id'], registration_id=user['id'], email=user['email'])
KeyError: 'email'


Any ideas? 


El martes, 7 de junio de 2011 01:00:33 UTC-3, Massimo Di Pierro escribió:
>
> I am not familiar with facebook email. 
>
> If this (username + @facebook) is avlid email, perhaps web should set 
> that even if username=True 
>
> On Jun 6, 7:15 pm, "Sebastian E. Ovide"  
> wrote: 
> > I do not see major pros and cons... it is a matter of precerences... 
> > 
> > 1) setting username=True in auth.define_tables(), define_tables will add 
> a 
> > field on the table (username) and if that field is present, 
> authentication 
> > will be done using username. Personally I prefer to use emails rather 
> than 
> > usernames, and as I am using BOTH web2py auth and facebook at the same 
>  time 
> > for authentication (two different links for different logins), I didn't 
> want 
> > to force my application to use usernames so I've used the second 
> option 
> > 
> > 2) in this case I'm adding an email created by the facebook username + 
> > @facebook and therefore auth will keep using email for authentication... 
> > 
> > no web2py code has been touched, although I'm extending Auth and 
> > overriding navbar to display a second login link (facebook) and hide 
> > change_password when it is logged in via facebook. 
> > 
> > if session.login_method_used is None: 
> > if not 'change_password' in 
> self.settings.actions_disabled: 
> > bar.insert(-1, ' | ') 
> > bar.insert(-1, password) 
> > 
> > and in my controller: 
> > 
> > def user(): 
> > if auth.user_id: 
> > if request.args[0] == 'logout': 
> > session.login_method_used=None 
> > else: 
> > if request.args[0] == 'login': 
> > session.login_method_used=None 
> > elif request.args[0] == 'login_fb': 
> > session.login_method_used="facebook" 
> > request.args[0]='login' 
> > 
> > if session.login_method_used=="facebook": 
> > auth.settings.login_form=FaceBookAccount(globals()) 
> > 
> > return dict(form=auth()) 
> > 
> > On Mon, Jun 6, 2011 at 11:16 PM, Massimo Di Pierro < 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > massimo.dipie...@gmail.com> wrote: 
> > > if there is agreement on one, please send me a patch. 
> > 
> > > On Jun 6, 4:31 pm, "Sebastian E. Ovide"  
> > > wrote: 
> > > > Hi Mic, 
> > 
> > > > thanks for that. 
> > 
> > > > actually I've debugged web2py and figure it out for myself. There 
> are two 
> > > > easy ways to fix it (I've tried to add them to the book, but my 
> account 
> > > > doesn't allow me to edit it) 
> > 
> > > > 1) set username=False in auth.define_tables() 
> > > > 2) add  email = user['username']+"@facebook.com" in the return of 
> def 
> > > > get_user 
> > 
> > > > On Mon, Jun 6, 2011 at 10:02 PM, Michele Comitini < 
> > 
> > > > michele.comit...@gmail.com> wrote: 
> > > > > Hi Sebastian, 
> > 
> > > > > copy from this example: 
> > 
> > > > >
> http://code.google.com/r/michelecomitini-facebookaccess/source/browse. 
> > > .. 
> > 
> > > > > < 
> > >http://code.google.com/r/michelecomitini-facebookaccess/source/browse.. 
>
> > > .>and 
> > > > > let me know 
> > 
> > > > > mic 
> > 
> > > > > 2011/6/6 Sebastian E. Ovide  
> > 
> > > > > Hi All, 
> > 
> > > > >> 

[web2py] Re: Best way to learn web2py

2013-10-28 Thread Derek
>Most of you know Railscast and stuff like Rails for zombies. 

No, I don't care for Ruby, so I never paid it any attention. I have no clue 
where someone would go to learn it. Web2Py is good, I heard Django is good 
also, but I'm not a sheep that's just going to follow the herd to where 
it's going, hoping to find something wonderful. If you want to make it more 
popular, make a webcast or tutorials or something with Web2Py and spread it 
around. The issue I think is that Web2Py does not work with Python 3.x, 
whereas Django does. Perhaps we should look into 
http://pythonhosted.org/six/ six instead of rewriting the whole Web2Py.

On Saturday, October 26, 2013 8:16:56 AM UTC-7, Andreas Wienes wrote:
>
> Thanks for all of your feedback. I've also started using web2py about two 
> months ago and felt in love with it. It's so clear, simple to use, very 
> well documented and the community is just awesome. I'm grateful for the 
> development and the quick and friendly support. But although all of this 
> exists, there is still something missing in the web2py-universe. From my 
> point of view, it's still too unpopular and doesn't seem so cool and 
> "fancy"as it should. As a result of this, web2py isn't well known and there 
> are still to less job offers for web2py developers. Most offers are for 
> Rails or Django people. I'm living in Germany and this is just my point of 
> view. Hopefully the job market and spreading of web2py is better in your 
> country.
>
> I think, if we wanna try to become web2py more popular and to increase the 
> job opportunities, we need to make it more attractive. 
> http://killer-web-development.com/ is a good approach doing this. The 
> rails-world is full of pages like this. Most of you know Railscast and 
> stuff like Rails for zombies. I tried Rails, because it's popularity and 
> shiny community. But at the end I was frustrated about all the magic, 
> different ways of solving problems and hidden complexity. Exploring web2py 
> gave me new hope and web development was funny again. Let's add some shine 
> and coolness to it and it could be nearly perfect.  
>
> A page like "the best way to learn web2py" could help to reach more people 
> and let our community grow. 
>
> I collected some material and made a first draft using Evernote. 
> https://www.evernote.com/shard/s137/sh/9248dc08-d669-4b03-beb5-e3dcddc7e66b/f65523796758735f6d58dd8c31246ad5
> My next steps would be to collect something more, write some short 
> descriptions and start a simple wordpress based website. Every kind of help 
> and productive criticism is welcome.
>
> - Andreas
>

-- 
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/groups/opt_out.


Re: [web2py] Newbie authentication question

2013-10-28 Thread Richard Vézina
https://groups.google.com/d/msg/web2py/xeSxEu4xfA0/qDN6V4_BqK0J

http://rochacbruno.com.br/web2py-manage-users-and-membership-in-the-same-form/



Little research...



On Mon, Oct 28, 2013 at 1:25 PM, Richard Vézina  wrote:

> https://github.com/elcio/badmin
>
>
>
>
> On Mon, Oct 28, 2013 at 1:23 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> I am not sure exactly what you want.
>>
>> You can create group by the appadmin, and you only need to do it once for
>> each group. For the assignation of user to a given group, with the appadmin
>> you have to do it many time (one for each group member, one at a time), if
>> you have to review/add new group member frequently you can create a
>> controller function for this...
>>
>> The access to this function should be restrict as above.
>>
>> You will need a custom widget I guess to make the user membre picking
>> easier (not having to populate the membership table one at a time), maybe
>> SQLFORM.factory() is a better choice then SQLFORM() in this case to
>> construct custom field for the user member picking... Sorry, I don't have
>> any pseudo or code that come to mind rapidly, but for sure you can find and
>> reuse code available here on the list... Also, there is a better appadmin
>> admi interface call badmin or badadmin, you could maybe find code for this,
>> or see how it is programmed. There is also web2pyslice where it may be
>> possible to find code snippet for this.
>>
>> Hopes it helps
>>
>> Richard
>>
>>
>> On Mon, Oct 28, 2013 at 12:13 PM, raferbop  wrote:
>>
>>> Richard, I was about to post a similar question, but let me just ask
>>> you. I am also new to web2py, and I am not able to find any good resources
>>> in relation to creating multiple groups or assigning roles to users. For
>>> example, lets say I have a group of users that I want to categorize as
>>> company, drivers, and passengers. Can you shed some light of how I can take
>>> the built-in auth_user function and create these various groups.
>>>
>>> Rafer
>>>
>>>
>>> On Monday, October 28, 2013 9:21:58 AM UTC-5, Richard wrote:
>>>
 If you are sure that the user that will be manage by other user is 1 to
 many (many users that can declared which user is their manager), you can do
 that (self-reference). But this is only one part of the problem, I think
 you need to create a group of admin_user that are allow to manage other
 users, the one that reference them, so you can get the list of users that
 are mananagable by a given admin user like so : db(db.auth_user.id ==
 auth.user_id).select(db.auth_**user.id ) in
 this case the auth.user_id is the admin user that is authenticated.

 You better have a group of admin and user web2py RBAC to make sure you
 have a better controller over the users allowed to manage other users. That
 way, you can user the web2py tool to make sure only the users that have
 right can access you manage_user function, something like that :

 @auth.requires_login()
 @auth.requires(lambda: auth.has_membership('admin'))
 def manage_user():
 rows = db(db.auth_user.id == 
 auth.user_id).select(db.auth_**user.id
 )
 id_of_users_to_be_managed = [row.id for row in rows]
 if request.vars.user_id in id_of_users_to_be_managed:
 form = SQLFORM(db.auth_user, user_id)
  ...
 else:
  form = 'You can't manage this user'
 return dict(form=form)


 :)

 Richard






 On Sun, Oct 27, 2013 at 7:05 PM, Mikael Cederberg 
 wrote:

> Hi there and thanks for a stellar project - really cool.  I am trying
> to solve an issue that arose and was hoping for a pointer so I can solve 
> it.
>
> I am wanting to use the authentication mechanism of web2py pretty much
> as is, but I need to be able to have one registered user, in some cases, 
> be
> given the ability to administrate and act as other registered users.
> My thoughts were along the lines of adding a column parent_of to
> auth_user and if an id is specified here pointing towards another user, 
> the
> specified id can administrate as that user. Would this be a proper way to
> go about it, and how could this be implemented?
>
> Any thoughts or ideas would be welcome.
>
> Tnx, Mikael
>
> --
> 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

[web2py] Re: how to use startswith in query

2013-10-28 Thread Mark
Hi Derek,

Thank you very much for your answer. I get the idea.

On Monday, October 28, 2013 12:06:54 PM UTC-4, Derek wrote:
>
> You're going to need a value for db.student.name... so you'll need a join 
> or something.
>
> On Monday, October 28, 2013 8:50:29 AM UTC-7, Mark wrote:
>>
>> Hello,
>>
>> I want to use startswith in a query like following, but it didn't work:
>>
>> db.person.name.startswith(db.student.name)
>>
>> What is wrong in this query? Is there a better way for it or  a work 
>> around? Any help would be greatly appreciated.
>>
>> 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/groups/opt_out.


Re: [web2py] Newbie authentication question

2013-10-28 Thread Richard Vézina
https://github.com/elcio/badmin




On Mon, Oct 28, 2013 at 1:23 PM, Richard Vézina  wrote:

> I am not sure exactly what you want.
>
> You can create group by the appadmin, and you only need to do it once for
> each group. For the assignation of user to a given group, with the appadmin
> you have to do it many time (one for each group member, one at a time), if
> you have to review/add new group member frequently you can create a
> controller function for this...
>
> The access to this function should be restrict as above.
>
> You will need a custom widget I guess to make the user membre picking
> easier (not having to populate the membership table one at a time), maybe
> SQLFORM.factory() is a better choice then SQLFORM() in this case to
> construct custom field for the user member picking... Sorry, I don't have
> any pseudo or code that come to mind rapidly, but for sure you can find and
> reuse code available here on the list... Also, there is a better appadmin
> admi interface call badmin or badadmin, you could maybe find code for this,
> or see how it is programmed. There is also web2pyslice where it may be
> possible to find code snippet for this.
>
> Hopes it helps
>
> Richard
>
>
> On Mon, Oct 28, 2013 at 12:13 PM, raferbop  wrote:
>
>> Richard, I was about to post a similar question, but let me just ask you.
>> I am also new to web2py, and I am not able to find any good resources in
>> relation to creating multiple groups or assigning roles to users. For
>> example, lets say I have a group of users that I want to categorize as
>> company, drivers, and passengers. Can you shed some light of how I can take
>> the built-in auth_user function and create these various groups.
>>
>> Rafer
>>
>>
>> On Monday, October 28, 2013 9:21:58 AM UTC-5, Richard wrote:
>>
>>> If you are sure that the user that will be manage by other user is 1 to
>>> many (many users that can declared which user is their manager), you can do
>>> that (self-reference). But this is only one part of the problem, I think
>>> you need to create a group of admin_user that are allow to manage other
>>> users, the one that reference them, so you can get the list of users that
>>> are mananagable by a given admin user like so : db(db.auth_user.id ==
>>> auth.user_id).select(db.auth_**user.id ) in
>>> this case the auth.user_id is the admin user that is authenticated.
>>>
>>> You better have a group of admin and user web2py RBAC to make sure you
>>> have a better controller over the users allowed to manage other users. That
>>> way, you can user the web2py tool to make sure only the users that have
>>> right can access you manage_user function, something like that :
>>>
>>> @auth.requires_login()
>>> @auth.requires(lambda: auth.has_membership('admin'))
>>> def manage_user():
>>> rows = db(db.auth_user.id == 
>>> auth.user_id).select(db.auth_**user.id
>>> )
>>> id_of_users_to_be_managed = [row.id for row in rows]
>>> if request.vars.user_id in id_of_users_to_be_managed:
>>> form = SQLFORM(db.auth_user, user_id)
>>>  ...
>>> else:
>>>  form = 'You can't manage this user'
>>> return dict(form=form)
>>>
>>>
>>> :)
>>>
>>> Richard
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Sun, Oct 27, 2013 at 7:05 PM, Mikael Cederberg wrote:
>>>
 Hi there and thanks for a stellar project - really cool.  I am trying
 to solve an issue that arose and was hoping for a pointer so I can solve 
 it.

 I am wanting to use the authentication mechanism of web2py pretty much
 as is, but I need to be able to have one registered user, in some cases, be
 given the ability to administrate and act as other registered users.
 My thoughts were along the lines of adding a column parent_of to
 auth_user and if an id is specified here pointing towards another user, the
 specified id can administrate as that user. Would this be a proper way to
 go about it, and how could this be implemented?

 Any thoughts or ideas would be welcome.

 Tnx, Mikael

 --
 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/**groups/opt_out
 .

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

Re: [web2py] Newbie authentication question

2013-10-28 Thread Richard Vézina
I am not sure exactly what you want.

You can create group by the appadmin, and you only need to do it once for
each group. For the assignation of user to a given group, with the appadmin
you have to do it many time (one for each group member, one at a time), if
you have to review/add new group member frequently you can create a
controller function for this...

The access to this function should be restrict as above.

You will need a custom widget I guess to make the user membre picking
easier (not having to populate the membership table one at a time), maybe
SQLFORM.factory() is a better choice then SQLFORM() in this case to
construct custom field for the user member picking... Sorry, I don't have
any pseudo or code that come to mind rapidly, but for sure you can find and
reuse code available here on the list... Also, there is a better appadmin
admi interface call badmin or badadmin, you could maybe find code for this,
or see how it is programmed. There is also web2pyslice where it may be
possible to find code snippet for this.

Hopes it helps

Richard


On Mon, Oct 28, 2013 at 12:13 PM, raferbop  wrote:

> Richard, I was about to post a similar question, but let me just ask you.
> I am also new to web2py, and I am not able to find any good resources in
> relation to creating multiple groups or assigning roles to users. For
> example, lets say I have a group of users that I want to categorize as
> company, drivers, and passengers. Can you shed some light of how I can take
> the built-in auth_user function and create these various groups.
>
> Rafer
>
>
> On Monday, October 28, 2013 9:21:58 AM UTC-5, Richard wrote:
>
>> If you are sure that the user that will be manage by other user is 1 to
>> many (many users that can declared which user is their manager), you can do
>> that (self-reference). But this is only one part of the problem, I think
>> you need to create a group of admin_user that are allow to manage other
>> users, the one that reference them, so you can get the list of users that
>> are mananagable by a given admin user like so : db(db.auth_user.id ==
>> auth.user_id).select(db.auth_**user.id ) in this
>> case the auth.user_id is the admin user that is authenticated.
>>
>> You better have a group of admin and user web2py RBAC to make sure you
>> have a better controller over the users allowed to manage other users. That
>> way, you can user the web2py tool to make sure only the users that have
>> right can access you manage_user function, something like that :
>>
>> @auth.requires_login()
>> @auth.requires(lambda: auth.has_membership('admin'))
>> def manage_user():
>> rows = db(db.auth_user.id == 
>> auth.user_id).select(db.auth_**user.id
>> )
>> id_of_users_to_be_managed = [row.id for row in rows]
>> if request.vars.user_id in id_of_users_to_be_managed:
>> form = SQLFORM(db.auth_user, user_id)
>> ...
>> else:
>>  form = 'You can't manage this user'
>> return dict(form=form)
>>
>>
>> :)
>>
>> Richard
>>
>>
>>
>>
>>
>>
>> On Sun, Oct 27, 2013 at 7:05 PM, Mikael Cederberg wrote:
>>
>>> Hi there and thanks for a stellar project - really cool.  I am trying to
>>> solve an issue that arose and was hoping for a pointer so I can solve it.
>>>
>>> I am wanting to use the authentication mechanism of web2py pretty much
>>> as is, but I need to be able to have one registered user, in some cases, be
>>> given the ability to administrate and act as other registered users.
>>> My thoughts were along the lines of adding a column parent_of to
>>> auth_user and if an id is specified here pointing towards another user, the
>>> specified id can administrate as that user. Would this be a proper way to
>>> go about it, and how could this be implemented?
>>>
>>> Any thoughts or ideas would be welcome.
>>>
>>> Tnx, Mikael
>>>
>>> --
>>> 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/**groups/opt_out
>>> .
>>>
>>
>>  --
> 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 opti

[web2py] Re: Access the server data in javascript

2013-10-28 Thread Derek
If you are just using the column value itself, you probably need to convert 
it to a string before putting it in the json.

Example:

>>> c = long(10)
>>> c
10L
>>> str(c)
'10'


On Saturday, October 26, 2013 8:09:25 AM UTC-7, Ramesh Kumar wrote:
>
> Thanks Derek, but I am facing one more problem. An 'L' gets appended to 
> integer data. When I try to get the dict into a json, I am facing "Uncaught 
> SyntaxError: Unexpected token ILLEGAL " error. Any help on 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/groups/opt_out.


[web2py] Re: tooltip button in SQLFORM.grid

2013-10-28 Thread Niphlod
what button ?
any A element should display a tooltip pretty well if you just use the 
_title attribute

Il giorno domenica 27 ottobre 2013 23:41:32 UTC+1, libe...@gmail.com ha 
scritto:
>
> I am trying to figure out a way customize a button in a SQLFORM.grid so 
> that a tooltip text is shown.
> Is there a simple way to do that in web2py?
>
> 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/groups/opt_out.


[web2py] Re: Ticket ID No module named modules

2013-10-28 Thread Niphlod
nope, shouldn't work either

if your module is inside the modules folder, either you need to do

import appname.modules.utils 

or

import utils



Il giorno lunedì 28 ottobre 2013 05:24:15 UTC+1, Massimo Di Pierro ha 
scritto:
>
> Can you please try the nightly build?
> http://www.web2py.com/examples/static/nightly/web2py_win.zip
>
>

-- 
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/groups/opt_out.


Re: [web2py] One of the best things that happened to web2py

2013-10-28 Thread Martin Weissenboeck
I have tried it - works fine!
Martin


2013/10/28 Massimo Di Pierro 

> I am happy to announce a great new opportunity for web2py users:
>
>  https://www.pythonanywhere.com/try-web2py
>
> Basically they give you the opportunity to create a web2py instance
> directly from the browser without sign-up. The instance only lives for 24
> hrs unless you sign-up. In that case it will persist.
> The basic plan is also free.
>
> This is a great new way to show web2py to your friends and convince them
> to try it without commitment. It also works great for teaching web2py.
>
> I encourage you to try it.
>
> web2py.com is hosted on PythonAnywhere and we are very happy with it.
>
> Massimo
>
> --
> 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/groups/opt_out.
>

-- 
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/groups/opt_out.


[web2py] Re: having trouble with data-xxx when they are not a simple option

2013-10-28 Thread Niphlod
BTW, the quoted representation **should** be valid nonetheless.

What plugins do is extracting whatever is in the data and evaluating to a 
js object, so it shouldn't really matter beween

data-something='{a: b}'
and 
data-something="thequotedrepr_of_{a:b}"

unless the plugin is so strict (and insecure) to not do the 
reverted-escaping.

-- 
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/groups/opt_out.


[web2py] One of the best things that happened to web2py

2013-10-28 Thread Massimo Di Pierro
I am happy to announce a great new opportunity for web2py users:

 https://www.pythonanywhere.com/try-web2py

Basically they give you the opportunity to create a web2py instance 
directly from the browser without sign-up. The instance only lives for 24 
hrs unless you sign-up. In that case it will persist.
The basic plan is also free.

This is a great new way to show web2py to your friends and convince them to 
try it without commitment. It also works great for teaching web2py. 

I encourage you to try it. 

web2py.com is hosted on PythonAnywhere and we are very happy with it.

Massimo

-- 
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/groups/opt_out.


[web2py] Re: having trouble with data-xxx when they are not a simple option

2013-10-28 Thread DenesL

Check the source of the returned page, is it still good?.

The code is:

def CALBOX(*args, **vars):
  vars['_type']='text'
  vars['_data-role']='datebox'
  vars['data']={'options':XML('{"mode":"calbox", "useNewStyle":true}')}
  x = INPUT(*args, **vars)
  return XML(x.xml().replace('"{', "'{").replace('}"', "}'"))

CALBOX(_name='tsdate', _id='tsdate')

which should give (and it looks like that if you inspect the element):



but the source says:




which obviously does not work.
Grrr.




On Monday, October 28, 2013 11:36:33 AM UTC-4, Anthony wrote:
>
>
>
> On Monday, October 28, 2013 10:46:30 AM UTC-4, DenesL wrote:
>>
>> Thanks Anthony, it sounds like a good idea but the browser ends up 
>> receiving:
>>
>> data-options="{"mode":"calbox", 
>> "useNewStyle":true}"
>>
>>
> When I try it, web2py returns the following to the browser:
>
> 
>
> Can you show your exact code?
>
> 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/groups/opt_out.


Re: [web2py] Newbie authentication question

2013-10-28 Thread raferbop
Richard, I was about to post a similar question, but let me just ask you. I 
am also new to web2py, and I am not able to find any good resources in 
relation to creating multiple groups or assigning roles to users. For 
example, lets say I have a group of users that I want to categorize as 
company, drivers, and passengers. Can you shed some light of how I can take 
the built-in auth_user function and create these various groups.

Rafer

On Monday, October 28, 2013 9:21:58 AM UTC-5, Richard wrote:
>
> If you are sure that the user that will be manage by other user is 1 to 
> many (many users that can declared which user is their manager), you can do 
> that (self-reference). But this is only one part of the problem, I think 
> you need to create a group of admin_user that are allow to manage other 
> users, the one that reference them, so you can get the list of users that 
> are mananagable by a given admin user like so : db(db.auth_user.id == 
> auth.user_id).select(db.auth_user.id) in this case the auth.user_id is 
> the admin user that is authenticated.
>
> You better have a group of admin and user web2py RBAC to make sure you 
> have a better controller over the users allowed to manage other users. That 
> way, you can user the web2py tool to make sure only the users that have 
> right can access you manage_user function, something like that :
>
> @auth.requires_login()
> @auth.requires(lambda: auth.has_membership('admin'))
> def manage_user():
> rows = db(db.auth_user.id == auth.user_id).select(db.auth_user.id)
> id_of_users_to_be_managed = [row.id for row in rows]
> if request.vars.user_id in id_of_users_to_be_managed:
> form = SQLFORM(db.auth_user, user_id)
> ...
> else:
>  form = 'You can't manage this user'
> return dict(form=form)
>
>
> :)
>
> Richard
>
>
>
>
>
>
> On Sun, Oct 27, 2013 at 7:05 PM, Mikael Cederberg 
> 
> > wrote:
>
>> Hi there and thanks for a stellar project - really cool.  I am trying to 
>> solve an issue that arose and was hoping for a pointer so I can solve it.
>>
>> I am wanting to use the authentication mechanism of web2py pretty much as 
>> is, but I need to be able to have one registered user, in some cases, be 
>> given the ability to administrate and act as other registered users.
>> My thoughts were along the lines of adding a column parent_of to 
>> auth_user and if an id is specified here pointing towards another user, the 
>> specified id can administrate as that user. Would this be a proper way to 
>> go about it, and how could this be implemented?
>>
>> Any thoughts or ideas would be welcome.
>>
>> Tnx, Mikael
>>
>> -- 
>> 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/groups/opt_out.
>>
>
>

-- 
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/groups/opt_out.


[web2py] Re: how to use startswith in query

2013-10-28 Thread Derek
You're going to need a value for db.student.name... so you'll need a join 
or something.

On Monday, October 28, 2013 8:50:29 AM UTC-7, Mark wrote:
>
> Hello,
>
> I want to use startswith in a query like following, but it didn't work:
>
> db.person.name.startswith(db.student.name)
>
> What is wrong in this query? Is there a better way for it or  a work 
> around? Any help would be greatly appreciated.
>
> 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/groups/opt_out.


[web2py] how to use startswith in query

2013-10-28 Thread Mark
Hello,

I want to use startswith in a query like following, but it didn't work:

db.person.name.startswith(db.student.name)

What is wrong in this query? Is there a better way for it or  a work 
around? Any help would be greatly appreciated.

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/groups/opt_out.


[web2py] Re: having trouble with data-xxx when they are not a simple option

2013-10-28 Thread Anthony


On Monday, October 28, 2013 10:46:30 AM UTC-4, DenesL wrote:
>
> Thanks Anthony, it sounds like a good idea but the browser ends up 
> receiving:
>
> data-options="{"mode":"calbox", 
> "useNewStyle":true}"
>
>
When I try it, web2py returns the following to the browser:



Can you show your exact code?

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/groups/opt_out.


[web2py] Re: having trouble with data-xxx when they are not a simple option

2013-10-28 Thread DenesL
Thanks Anthony, it sounds like a good idea but the browser ends up 
receiving:

data-options="{"mode":"calbox", 
"useNewStyle":true}"

We need to make this easier (let alone work), the newer mobile add-ons/plug-ins 
are using the data attributes a lot.


If anyone else wants to play with this I am trying to use jQueryMobile 
DateBox:
http://dev.jtsage.com/jQM-DateBox2/demos/mode/calbox.html

the basic example requires to build an input field as follows:



Regards,
Denes




On Saturday, October 26, 2013 9:46:48 AM UTC-4, Anthony wrote:
>
> Attributes are always put in double quotes: 
> https://github.com/web2py/web2py/blob/master/gluon/html.py#L907. I 
> suppose you could manually replace the double quotes after serializing:
>
> input = INPUT(..., data={'options': XML('{"mode":"calbox"}')})
> XML(input.xml().replace('"{', "'{").replace('}"', "}'"))
>
> Anthony
>
> On Friday, October 25, 2013 5:57:48 PM UTC-4, DenesL wrote:
>>
>>
>> using web2py 2.5.1 source on windows
>>
>> Having trouble creating an INPUT with a "non-trivial" data attribute.
>> Did try the following:
>>
>> INPUT(...,**{'_data-options':XML('{"mode":"calbox"}')} )
>>
>> INPUT(..., data={'options':XML('{"mode":"calbox"}')} )
>>
>> and several combinations with raw strings but it always outputs:
>>
>>which breaks on "{"
>>
>> Single quoted string works fine 
>> data-options="{'mode':'calbox'}"
>> but the code requires double quoted strings. 
>>
>> Bug, or is there a way I am not seeing?.
>>
>> Thanks,
>> Denes
>>
>> P.S. printing what goes on in DIV._xml() produces a lot of output for the 
>> same attributes, inner component redundancy?. 
>>
>

-- 
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/groups/opt_out.


Re: [web2py] Conexao POSTGRESQL vs PYTHON/WEB2PY - problemas

2013-10-28 Thread Robert O'Connor
Posting in english may be a better ideaj

--rob
Sent from my cell...excuse typos
On Oct 28, 2013 10:35 AM, "Carlynhos77"  wrote:

> ola, realmente esse trem nao vai... criei o arquivo db.py, joguei o codigo
> nele, tirei as referencias do gluon, dai ja veio outros erros...
>
> vou rever os videos do curso q fiz com o bruno rocha, apesar o curso ser
> voltado para o SQLLITE, em algum lugar ele fala das conexoes, vou ver se
> ele diz algo sobre postgresql, esse projeto q to começando é baseado nas
> explicacoes e ensinamentos q ele deu... acho q por isso ta dificil eu
> alterar, pois foi feito e configurado pro sqllite... vou estudar mais, do
> jeito q ta nao vai...
>
> agradeço imensamente sua ajuda OVIDIO, e desculpa por nao dá o retorno d
> sucesso...
>
>
>
> Em segunda-feira, 28 de outubro de 2013 08h44min52s UTC-2, Ovidio Marinho
> escreveu:
>>
>> Porque voce nao usa a ORM do web2py, e esta tentando criar o que existe
>> em models, nao mexa na configuração do gluon
>>
>> no seu db.py use no local do sqlite:
>>
>> import psycopg2
>>
>> db = DAL('postgres://usuario:senha@**localhost:5432/meubanco')
>>
>> OBS.: Usuario do Postgresql e senha do postgres.
>>
>>
>>
>>
>>
>>
>>  Ovidio Marinho Falcao Neto
>>   ITJP.NET.BR
>>  ovid...@gmail.com
>>  Brasil
>>
>>
>>
>> Em 27 de outubro de 2013 11:06, Jose Carlos Vicente Pereira <
>> carly...@gmail.com> escreveu:
>>
>>> Ola, bom dia... estou tentando conectar meu banco postgresql ao meu
>>> projeto, so q nao consigo.. veja meu codigo detalhado abaixo...
>>>
>>> --**--**
>>> --**--**
>>> 
>>> *no MODELS  - "appsettings.py"   ta assim*
>>>
>>> from gluon.storage import Storage
>>>  config = Storage(
>>> db=Storage(),
>>> mail=Storage(),
>>> auth=Storage()
>>> )
>>>
>>> import psycopg2
>>> #conn = psycopg2.connect(host='**localho**st', user='postgres',
>>> password='123',dbname='saude')
>>> conn = psycopg2.connect("dbname=saude user=postgres")
>>> db = conn.cursor()
>>>
>>> config.mail.sender = "alu...@blouweb.com"
>>> config.mail.server = "smtp.gmail.com:587" # "smtp.:25"
>>> config.mail.login = "alu...@blouweb.com:"
>>>
>>> response.title = "INFO-SAÚDE"
>>> response.description = "SAÚDE"
>>>
>>> # glob
>>> response.generic_patterns = ['*']
>>>
>>> *no MODELS   "database.py"   tem isso, no sqllite isso era usado, acho
>>> q pro postgresql nao sera usado*
>>>
>>> #coding: utf-8
>>>
>>> # conectar ao banco de dados
>>> # setar opcoes da DAL
>>>
>>> db = DAL(**config.db)
>>>
>>>
>>> *no MODELS   "datamodel_objects.py"   isso foi usado para criar as
>>> tabelas no sqllite, no postgresql ja criei as tabelas*
>>>
>>> db.define_table("cadcidade",
>>> Field("nome", "text", length=128, notnull=True, unique=True),
>>> Field("uf", "text", length=2, notnull=True),
>>> Field("cep", "text", length=8, notnull=True),
>>> Field("cod_ibge", "integer", length=7),
>>> auth.signature,
>>> format="%(nome)s"
>>> )
>>>
>>>
>>> *no CONTROLLERS  "bases.py"   tem esse codigo pra gerar a grid*
>>> *
>>> *
>>> def list_cidade():
>>> query = db.cadcidade.id > 0
>>> headers = {'cadcidade.nome':   'NOME',
>>> 'cadcidade.uf': 'UF',
>>> 'cadcidade.cep': 'CEP',
>>> 'cadcidade.cod_ibge': 'IBGE' }
>>>
>>> grid = SQLFORM.grid(query=query,
>>>  user_signature=False,
>>> paginate=20,
>>> searchable=False,
>>> csv=False,
>>> fields=[db.cadcidade.nome, db.cadcidade.uf, db.cadcidade.cep,
>>> db.cadcidade.cod_ibge],
>>> orderby=db.cadcidade.nome,
>>> headers=headers
>>> )
>>> return dict(grid=grid)
>>>
>>>
>>> dai esse *CONTROLLER* é exibido numa *VIEWS - BASES* -
>>> "list_cidade.html" o codigo ta assim...
>>>
>>> {{extend 'layout.html'}}
>>>
>>> {{block main}}
>>>
>>> 
>>>  CIDADES 
>>> 
>>>
>>> 
>>> {{=grid}}
>>> 
>>>
>>> {{end}}
>>>
>>>
>>> esse é o caminho q usei, a view ta sendo carregado sem erro, so q ta
>>> ligada no banco DUMMY.DB, acho q se nao tem conexao d banco o aplicativo
>>> gera esse banco automatico...
>>>
>>> o postgresql ta instalado correto, pois abro ele pelo PgAdmin e mexo nas
>>> tabelas sem problemas
>>>
>>> lembrando q usando a conexao do sqllite o projeto funciona sem
>>> problemas...
>>> --**--**
>>> --**--**
>>> --**-
>>>
>>> alguem pode me ajudar?
>>>
>>>
>>>  --
>>> 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
>>>  Iss

Re: [web2py] Conexao POSTGRESQL vs PYTHON/WEB2PY - problemas

2013-10-28 Thread Carlynhos77
ola, realmente esse trem nao vai... criei o arquivo db.py, joguei o codigo 
nele, tirei as referencias do gluon, dai ja veio outros erros...

vou rever os videos do curso q fiz com o bruno rocha, apesar o curso ser 
voltado para o SQLLITE, em algum lugar ele fala das conexoes, vou ver se 
ele diz algo sobre postgresql, esse projeto q to começando é baseado nas 
explicacoes e ensinamentos q ele deu... acho q por isso ta dificil eu 
alterar, pois foi feito e configurado pro sqllite... vou estudar mais, do 
jeito q ta nao vai...

agradeço imensamente sua ajuda OVIDIO, e desculpa por nao dá o retorno d 
sucesso...



Em segunda-feira, 28 de outubro de 2013 08h44min52s UTC-2, Ovidio Marinho 
escreveu:
>
> Porque voce nao usa a ORM do web2py, e esta tentando criar o que existe em 
> models, nao mexa na configuração do gluon
>
> no seu db.py use no local do sqlite:
>
> import psycopg2
>
> db = DAL('postgres://usuario:senha@localhost:5432/meubanco')
>
> OBS.: Usuario do Postgresql e senha do postgres.
>
>
>
>   
>
>
>  Ovidio Marinho Falcao Neto
>   ITJP.NET.BR
>  ovid...@gmail.com  
>  Brasil
>   
>
>
> Em 27 de outubro de 2013 11:06, Jose Carlos Vicente Pereira <
> carly...@gmail.com > escreveu:
>
>> Ola, bom dia... estou tentando conectar meu banco postgresql ao meu 
>> projeto, so q nao consigo.. veja meu codigo detalhado abaixo...
>>
>>
>> 
>> *no MODELS  - "appsettings.py"   ta assim* 
>>
>> from gluon.storage import Storage
>>  config = Storage(
>> db=Storage(),
>> mail=Storage(),
>> auth=Storage()
>> )
>>
>> import psycopg2
>> #conn = psycopg2.connect(host='**localhost', user='postgres', 
>> password='123',dbname='saude')
>> conn = psycopg2.connect("dbname=saude user=postgres")
>> db = conn.cursor()
>>
>> config.mail.sender = "alu...@blouweb.com "
>> config.mail.server = "smtp.gmail.com:587" # "smtp.:25"
>> config.mail.login = "alu...@blouweb.com :"
>>
>> response.title = "INFO-SAÚDE"
>> response.description = "SAÚDE"
>>
>> # glob
>> response.generic_patterns = ['*']
>>
>> *no MODELS   "database.py"   tem isso, no sqllite isso era usado, acho q 
>> pro postgresql nao sera usado*
>>
>> #coding: utf-8
>>
>> # conectar ao banco de dados
>> # setar opcoes da DAL
>>
>> db = DAL(**config.db)
>>
>>
>> *no MODELS   "datamodel_objects.py"   isso foi usado para criar as 
>> tabelas no sqllite, no postgresql ja criei as tabelas*
>>
>> db.define_table("cadcidade",
>> Field("nome", "text", length=128, notnull=True, unique=True),
>> Field("uf", "text", length=2, notnull=True),
>> Field("cep", "text", length=8, notnull=True),
>> Field("cod_ibge", "integer", length=7),
>> auth.signature,
>> format="%(nome)s"
>> )
>>
>>
>> *no CONTROLLERS  "bases.py"   tem esse codigo pra gerar a grid*
>> *
>> *
>> def list_cidade():
>> query = db.cadcidade.id > 0
>> headers = {'cadcidade.nome':   'NOME',
>> 'cadcidade.uf': 'UF',
>> 'cadcidade.cep': 'CEP',
>> 'cadcidade.cod_ibge': 'IBGE' }
>>
>> grid = SQLFORM.grid(query=query, 
>>  user_signature=False,
>> paginate=20,
>> searchable=False,
>> csv=False,
>> fields=[db.cadcidade.nome, db.cadcidade.uf, db.cadcidade.cep, 
>> db.cadcidade.cod_ibge],
>> orderby=db.cadcidade.nome,
>> headers=headers
>> )
>> return dict(grid=grid)
>>
>>
>> dai esse *CONTROLLER* é exibido numa *VIEWS - BASES* - 
>> "list_cidade.html" o codigo ta assim...
>>
>> {{extend 'layout.html'}}
>>
>> {{block main}}
>>
>> 
>>  CIDADES 
>> 
>> 
>> 
>> {{=grid}}
>> 
>>
>> {{end}}
>>
>>
>> esse é o caminho q usei, a view ta sendo carregado sem erro, so q ta 
>> ligada no banco DUMMY.DB, acho q se nao tem conexao d banco o aplicativo 
>> gera esse banco automatico...
>>
>> o postgresql ta instalado correto, pois abro ele pelo PgAdmin e mexo nas 
>> tabelas sem problemas
>>
>> lembrando q usando a conexao do sqllite o projeto funciona sem 
>> problemas...
>>
>> ---
>>
>> alguem pode me ajudar?
>>
>>
>>  -- 
>> 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/groups/opt_out.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Doc

Re: [web2py] Newbie authentication question

2013-10-28 Thread Richard Vézina
If you are sure that the user that will be manage by other user is 1 to
many (many users that can declared which user is their manager), you can do
that (self-reference). But this is only one part of the problem, I think
you need to create a group of admin_user that are allow to manage other
users, the one that reference them, so you can get the list of users that
are mananagable by a given admin user like so : db(db.auth_user.id ==
auth.user_id).select(db.auth_user.id) in this case the auth.user_id is the
admin user that is authenticated.

You better have a group of admin and user web2py RBAC to make sure you have
a better controller over the users allowed to manage other users. That way,
you can user the web2py tool to make sure only the users that have right
can access you manage_user function, something like that :

@auth.requires_login()
@auth.requires(lambda: auth.has_membership('admin'))
def manage_user():
rows = db(db.auth_user.id == auth.user_id).select(db.auth_user.id)
id_of_users_to_be_managed = [row.id for row in rows]
if request.vars.user_id in id_of_users_to_be_managed:
form = SQLFORM(db.auth_user, user_id)
...
else:
 form = 'You can't manage this user'
return dict(form=form)


:)

Richard






On Sun, Oct 27, 2013 at 7:05 PM, Mikael Cederberg wrote:

> Hi there and thanks for a stellar project - really cool.  I am trying to
> solve an issue that arose and was hoping for a pointer so I can solve it.
>
> I am wanting to use the authentication mechanism of web2py pretty much as
> is, but I need to be able to have one registered user, in some cases, be
> given the ability to administrate and act as other registered users.
> My thoughts were along the lines of adding a column parent_of to auth_user
> and if an id is specified here pointing towards another user, the specified
> id can administrate as that user. Would this be a proper way to go about
> it, and how could this be implemented?
>
> Any thoughts or ideas would be welcome.
>
> Tnx, Mikael
>
> --
> 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/groups/opt_out.
>

-- 
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/groups/opt_out.


[web2py] Re: NDB support for GAE

2013-10-28 Thread Massimo Di Pierro
If you send me a revised patch to do this, I will include. It may be better 
than using a different adapter.

On Monday, 28 October 2013 01:40:41 UTC-5, Quint wrote:
>
> Yes, using the same adapter with a parameter is also a possibility i 
> thought of. Don't really know anymore why i choose this. Maybe because 
> initially i wanted to create a plugable thingy without changing the DAL 
> code.

-- 
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/groups/opt_out.


Re: [web2py] Conexao POSTGRESQL vs PYTHON/WEB2PY - problemas

2013-10-28 Thread Ovidio Marinho
Isto nao faça conexões python dentro do gluon ela ja existe. voce tem que
fazer no models de cada aplicação.

ex: web2py\aplications\minhaapp1\model\db.py

import psycopg2

db = DAL('sqlite://storage.db')

db = DAL(' postgres://username:password@localhost/test')

Para cada aplicação uma conexao ou varias conexões se voce mexer na conexao
com o Gluon vc vai estar alterando a conexao global e nao a conexão para
cada aplicação em particular.




 Ovidio Marinho Falcao Neto
  ITJP.NET.BR
 ovidio...@gmail.com
 Brasil



Em 28 de outubro de 2013 10:22, Carlynhos77 escreveu:

> ola, parece q houve alteracoes aqui... estava usando a versao FOR WINDOWS
> e nao SOURCE CODE do web2py, ja troquei
>
> minha tela de administrador ta diferente da imagem q vc me mandou, agora
> apareceu igual a sua...
>
> quando vc diz nao mexer no GLUON, seria nao declarar isso aqui dentro d
> APPSETINGS.PY
>
> from gluon.storage import Storage
> config = Storage(
> db=Storage(),
> mail=Storage(),
> auth=Storage()
> )
>
> log abaixo desse codigo mostrado acima, ainda dentro d APPSENTINGS.PY, eu
> coloquei o codigo q vc me passou...
>
> import psycopg2
> db = DAL('postgres://postgres:123@localhost:5432/saude')
>
>
> apaguei todos os arquivos da pasta DATABASES
>
>
> no arquivo DATABASE.PY tem essa linha
>
> db = DAL(**config.db) mantenho ela?
>
>
> acho q fiz o q me me orientou... segue imagem do meu terminal administrador
>
>
> apos essas atualizacoes, apareceu esse TRACE BACK
>
>
> ---
>
> Traceback (most recent call last
> ):
>   File "C:\web2py\gluon\restricted.py", line 217, in restricted
>
> exec ccode in environment
>   File "C:/web2py/applications/info_saude/models/datamodel_application.py" 
> ,
>  line 42, in 
>
> auth.define_tables()
>   File "C:\web2py\gluon\tools.py", line 1736, in define_tables
>
> format='%(first_name)s %(last_name)s (%(id)s)'))
>   File "C:\web2py\gluon\dal.py", line 7935, in define_table
>
> table = self.lazy_define_table(tablename,*fields,**args)
>
>   File "C:\web2py\gluon\dal.py", line 7972, in lazy_define_table
>
> polymodel=polymodel)
>   File "C:\web2py\gluon\dal.py", line 1002, in create_table
>
> self.create_sequence_and_triggers(query,table)
>
>   File "C:\web2py\gluon\dal.py", line 2660, in create_sequence_and_triggers
>
> self.execute(query)
>   File "C:\web2py\gluon\dal.py", line 1836, in execute
>
> return self.log_execute(*a, **b)
>
>   File "C:\web2py\gluon\dal.py", line 1830, in log_execute
>
> ret = self.cursor.execute(command, *a[1:], **b)
> ProgrammingError: ERRO:  nenhum esquema foi selecionado para criá-lo(a)
>
>
> --
>
>
>
>
>
> Em segunda-feira, 28 de outubro de 2013 08h44min52s UTC-2, Ovidio Marinho
> escreveu:
>
>> Porque voce nao usa a ORM do web2py, e esta tentando criar o que existe
>> em models, nao mexa na configuração do gluon
>>
>> no seu db.py use no local do sqlite:
>>
>> import psycopg2
>>
>> db = DAL('postgres://usuario:senha@**localhost:5432/meubanco')
>>
>> OBS.: Usuario do Postgresql e senha do postgres.
>>
>>
>>
>>
>>
>>
>>  Ovidio Marinho Falcao Neto
>>   ITJP.NET.BR
>>  ovid...@gmail.com
>>  Brasil
>>
>>
>>
>> Em 27 de outubro de 2013 11:06, Jose Carlos Vicente Pereira <
>> carly...@gmail.com> escreveu:
>>
>>> Ola, bom dia... estou tentando conectar meu banco postgresql ao meu
>>> projeto, so q nao consigo.. veja meu codigo detalhado abaixo...
>>>
>>> --**--**
>>> --**--**
>>> 
>>> *no MODELS  - "appsettings.py"   ta assim*
>>>
>>> from gluon.storage import Storage
>>>  config = Storage(
>>> db=Storage(),
>>> mail=Storage(),
>>> auth=Storage()
>>> )
>>>
>>> import psycopg2
>>> #conn = psycopg2.connect(host='**localho**st', user='postgres',
>>> password='123',dbname='saude')
>>> conn = psycopg2.connect("dbname=saude user=postgres")
>>> db = conn.cursor()
>>>
>>> config.mail.sender = "alu...@blouweb.com"
>>> config.mail.server = "smtp.gmail.com:587" # "smtp.:25"
>>> config.mail.login = "alu...@blouweb.com:"
>>>
>>> response.title = "INFO-SAÚDE"
>>> response.description = "SAÚDE"
>>>
>>> # glob
>>> response.generic_patterns = ['*']
>>>
>>> *no MODELS   "database.py"   tem isso, no sqllite isso era usado, acho
>>> q pro postgresql nao sera usado*
>>>
>>> #coding: utf-8
>>>
>>> # conectar ao banco de dados
>>> # setar opcoes da DAL
>>>
>>> db = DA

[web2py] Re: Getting the current record in a custom widget

2013-10-28 Thread Anthony
On Sunday, October 27, 2013 8:40:18 PM UTC-4, mr.freeze wrote:

> I wouldn't say the use case is odd but it's definitely complex.  Then 
> again, without a context for custom widgets to operate in (i.e. no 
> knowledge of the record or form that they are bound to) only simple use 
> cases are possible.  Represent and widget are output/input analogs but for 
> some reason represent has access to the whole row whereas widget only gets 
> the field value.  I will propose a patch if it can be done unobtrusively 
> and without coupling Field to SQLFORM any further.
>

If a field requires special formatting depending on the values of other 
fields in the form, presumably that special formatting should apply in 
create forms as well as in edit forms when the values of the other fields 
are changed. Those cases require client-side logic. So, perhaps the 
rationale for not passing the record to the widget is that having the 
widget attempt to handle inter-field formatting dependencies would be 
inadequate and should therefore be handled entirely via JS (rather than 
having server-side logic handle the initial loading of edit records, with 
redundant JS logic to handle create forms and dynamic changes in edit 
forms).

Out of curiosity, what is your use case?

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/groups/opt_out.


Re: [web2py] Conexao POSTGRESQL vs PYTHON/WEB2PY - problemas

2013-10-28 Thread Carlynhos77
ola, bom dia rapaz, sinceramente ja me passou pela cabeça largar 
isso... e continuar no meu velho e bom Visual Basic... kkk

joguei esse codigo no APPSETINGS.PY

import psycopg2
db = DAL('postgres://postgres:123@localhost:5432/saude')

mando atualizar a tela e dá o erro

Traceback (most recent call last):
  File "C:\web2py\gluon\restricted.py", line 205, in restricted
exec ccode in environment
  File "C:/web2py/applications/info_saude/controllers/bases.py" 
, 
line 283, in 
  File "C:\web2py\gluon\globals.py", line 182, in 
self._caller = lambda f: f()
  File "C:/web2py/applications/info_saude/controllers/bases.py" 
, 
line 188, in list_cidade
query = db.CadCidade.id > 0
  File "C:\web2py\gluon\dal.py", line 6997, in __getattr__
return self[key]
  File "C:\web2py\gluon\dal.py", line 6991, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: 'CadCidade'


essa tabela CADCIDADE existe no banco, tem um registro cadastrado...



depois tentei jogar ele tabem no DATABASE.PY
import psycopg2
db = DAL('postgres://postgres:123@localhost:5432/saude')

deu erros tambem...

tem como saber logo apos:  db = DAL...
  se a linha realmente ta certa, conectada.. tipo dá um PRINT, UM OK.. algo



Em segunda-feira, 28 de outubro de 2013 08h44min52s UTC-2, Ovidio Marinho 
escreveu:
>
> Porque voce nao usa a ORM do web2py, e esta tentando criar o que existe em 
> models, nao mexa na configuração do gluon
>
> no seu db.py use no local do sqlite:
>
> import psycopg2
>
> db = DAL('postgres://usuario:senha@localhost:5432/meubanco')
>
> OBS.: Usuario do Postgresql e senha do postgres.
>
>
>
>   
>
>
>  Ovidio Marinho Falcao Neto
>   ITJP.NET.BR
>  ovid...@gmail.com  
>  Brasil
>   
>
>
> Em 27 de outubro de 2013 11:06, Jose Carlos Vicente Pereira <
> carly...@gmail.com > escreveu:
>
>> Ola, bom dia... estou tentando conectar meu banco postgresql ao meu 
>> projeto, so q nao consigo.. veja meu codigo detalhado abaixo...
>>
>>
>> 
>> *no MODELS  - "appsettings.py"   ta assim* 
>>
>> from gluon.storage import Storage
>>  config = Storage(
>> db=Storage(),
>> mail=Storage(),
>> auth=Storage()
>> )
>>
>> import psycopg2
>> #conn = psycopg2.connect(host='**localhost', user='postgres', 
>> password='123',dbname='saude')
>> conn = psycopg2.connect("dbname=saude user=postgres")
>> db = conn.cursor()
>>
>> config.mail.sender = "alu...@blouweb.com "
>> config.mail.server = "smtp.gmail.com:587" # "smtp.:25"
>> config.mail.login = "alu...@blouweb.com :"
>>
>> response.title = "INFO-SAÚDE"
>> response.description = "SAÚDE"
>>
>> # glob
>> response.generic_patterns = ['*']
>>
>> *no MODELS   "database.py"   tem isso, no sqllite isso era usado, acho q 
>> pro postgresql nao sera usado*
>>
>> #coding: utf-8
>>
>> # conectar ao banco de dados
>> # setar opcoes da DAL
>>
>> db = DAL(**config.db)
>>
>>
>> *no MODELS   "datamodel_objects.py"   isso foi usado para criar as 
>> tabelas no sqllite, no postgresql ja criei as tabelas*
>>
>> db.define_table("cadcidade",
>> Field("nome", "text", length=128, notnull=True, unique=True),
>> Field("uf", "text", length=2, notnull=True),
>> Field("cep", "text", length=8, notnull=True),
>> Field("cod_ibge", "integer", length=7),
>> auth.signature,
>> format="%(nome)s"
>> )
>>
>>
>> *no CONTROLLERS  "bases.py"   tem esse codigo pra gerar a grid*
>> *
>> *
>> def list_cidade():
>> query = db.cadcidade.id > 0
>> headers = {'cadcidade.nome':   'NOME',
>> 'cadcidade.uf': 'UF',
>> 'cadcidade.cep': 'CEP',
>> 'cadcidade.cod_ibge': 'IBGE' }
>>
>> grid = SQLFORM.grid(query=query, 
>>  user_signature=False,
>> paginate=20,
>> searchable=False,
>> csv=False,
>> fields=[db.cadcidade.nome, db.cadcidade.uf, db.cadcidade.cep, 
>> db.cadcidade.cod_ibge],
>> orderby=db.cadcidade.nome,
>> headers=headers
>> )
>> return dict(grid=grid)
>>
>>
>> dai esse *CONTROLLER* é exibido numa *VIEWS - BASES* - 
>> "list_cidade.html" o codigo ta assim...
>>
>> {{extend 'layout.html'}}
>>
>> {{block main}}
>>
>> 
>>  CIDADES 
>> 
>> 
>> 
>> {{=grid}}
>> 
>>
>> {{end}}
>>
>>
>> esse é o caminho q usei, a view ta sendo carregado sem erro, so q ta 
>> ligada no banco DUMMY.DB, acho q se nao tem conexao d banco o aplicativo 
>> gera esse banco automatico...
>>
>> o postgresql ta instalado correto, pois abro ele pelo PgAdmin e mexo nas 
>> tabelas sem problemas
>>
>> lembrando q usando a conexao do sqllite o projeto funciona sem 
>> problemas...
>>
>> --

Re: [web2py] DAL in intreactive shell - strange behaviour

2013-10-28 Thread Vinicius Assef
Start the shell with:
c:\suzand\swDev\private\web2py>python web2py.py -S gps -M

On Mon, Oct 28, 2013 at 7:10 AM, arutti  wrote:
> Hi,
>
> I'm trying to use DAL in web2py interactive shell.
>
> The troubles is that DAL doesn' show the already defined tables.
> I can create new tables perfectly
> They show up in SQLLite manager (Firefox add-on).
>
> After closing/reopening the shell, it's as if the database connexion didn't
> work correctly.
>
> Any idea what's happening ?
>
> Best regards,
> Andre
>
> see below a log of the interactive session.
>
> c:\suzand\swDev\private\web2py>python web2py.py -S gps
> web2py Web Framework
> Created by Massimo Di Pierro, Copyright 2007-2013
> Version 2.7.4-stable+timestamp.2013.10.14.15.16.29
> Database drivers available: SQLite(sqlite3), MySQL(pymysql),
> PostgreSQL(pg8000),
>  MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), Ingres(pyodbc), IMAP(imaplib)
> Python 2.7.2 (default, Jun 24 2011, 12:21:10) [MSC v.1500 32 bit (Intel)]
> Type "copyright", "credits" or "license" for more information.
>
> IPython 0.11 -- An enhanced Interactive Python.
> ? -> Introduction and overview of IPython's features.
> %quickref -> Quick reference.
> help  -> Python's own help system.
> object?   -> Details about 'object', use 'object??' for extra details.
>
> In [1]: db = DAL('sqlite://storage.sqlite')
>
> In [2]: db._tables
> Out[2]: []
>
> In [3]: db.define_table('foo')
> Out[3]: 
>
> In [4]: db.commit()
>
> In [5]: db.define_table('foo_2')
> Out[5]: 
>
> In [6]: db._tables
> Out[6]: ['foo', 'foo_2']
>
> In [7]:
> Do you really want to exit ([y]/n)? y
>
>
> c:\suzand\swDev\private\web2py>
> c:\suzand\swDev\private\web2py>python web2py.py -S gps
> web2py Web Framework
> Created by Massimo Di Pierro, Copyright 2007-2013
> Version 2.7.4-stable+timestamp.2013.10.14.15.16.29
> Database drivers available: SQLite(sqlite3), MySQL(pymysql),
> PostgreSQL(pg8000),
>  MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), Ingres(pyodbc), IMAP(imaplib)
> Python 2.7.2 (default, Jun 24 2011, 12:21:10) [MSC v.1500 32 bit (Intel)]
> Type "copyright", "credits" or "license" for more information.
>
> IPython 0.11 -- An enhanced Interactive Python.
> ? -> Introduction and overview of IPython's features.
> %quickref -> Quick reference.
> help  -> Python's own help system.
> object?   -> Details about 'object', use 'object??' for extra details.
>
> In [1]: db = DAL('sqlite://storage.sqlite')
>
> In [2]: db._tables
> Out[2]: []
>
> In [3]:
>
>
>
>
> --
> 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/groups/opt_out.

-- 
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/groups/opt_out.


Re: [web2py] Conexao POSTGRESQL vs PYTHON/WEB2PY - problemas

2013-10-28 Thread Ovidio Marinho
Porque voce nao usa a ORM do web2py, e esta tentando criar o que existe em
models, nao mexa na configuração do gluon

no seu db.py use no local do sqlite:

import psycopg2

db = DAL('postgres://usuario:senha@localhost:5432/meubanco')

OBS.: Usuario do Postgresql e senha do postgres.






 Ovidio Marinho Falcao Neto
  ITJP.NET.BR
 ovidio...@gmail.com
 Brasil



Em 27 de outubro de 2013 11:06, Jose Carlos Vicente Pereira <
carlynho...@gmail.com> escreveu:

> Ola, bom dia... estou tentando conectar meu banco postgresql ao meu
> projeto, so q nao consigo.. veja meu codigo detalhado abaixo...
>
>
> 
> *no MODELS  - "appsettings.py"   ta assim*
>
> from gluon.storage import Storage
> config = Storage(
> db=Storage(),
> mail=Storage(),
> auth=Storage()
> )
>
> import psycopg2
> #conn = psycopg2.connect(host='**localhost', user='postgres',
> password='123',dbname='saude')
> conn = psycopg2.connect("dbname=saude user=postgres")
> db = conn.cursor()
>
> config.mail.sender = "alu...@blouweb.com"
> config.mail.server = "smtp.gmail.com:587" # "smtp.:25"
> config.mail.login = "alu...@blouweb.com:"
>
> response.title = "INFO-SAÚDE"
> response.description = "SAÚDE"
>
> # glob
> response.generic_patterns = ['*']
>
> *no MODELS   "database.py"   tem isso, no sqllite isso era usado, acho q
> pro postgresql nao sera usado*
>
> #coding: utf-8
>
> # conectar ao banco de dados
> # setar opcoes da DAL
>
> db = DAL(**config.db)
>
>
> *no MODELS   "datamodel_objects.py"   isso foi usado para criar as
> tabelas no sqllite, no postgresql ja criei as tabelas*
>
> db.define_table("cadcidade",
> Field("nome", "text", length=128, notnull=True, unique=True),
> Field("uf", "text", length=2, notnull=True),
> Field("cep", "text", length=8, notnull=True),
> Field("cod_ibge", "integer", length=7),
> auth.signature,
> format="%(nome)s"
> )
>
>
> *no CONTROLLERS  "bases.py"   tem esse codigo pra gerar a grid*
> *
> *
> def list_cidade():
> query = db.cadcidade.id > 0
> headers = {'cadcidade.nome':   'NOME',
> 'cadcidade.uf': 'UF',
> 'cadcidade.cep': 'CEP',
> 'cadcidade.cod_ibge': 'IBGE' }
>
> grid = SQLFORM.grid(query=query,
>  user_signature=False,
> paginate=20,
> searchable=False,
> csv=False,
> fields=[db.cadcidade.nome, db.cadcidade.uf, db.cadcidade.cep,
> db.cadcidade.cod_ibge],
> orderby=db.cadcidade.nome,
> headers=headers
> )
> return dict(grid=grid)
>
>
> dai esse *CONTROLLER* é exibido numa *VIEWS - BASES* -
> "list_cidade.html" o codigo ta assim...
>
> {{extend 'layout.html'}}
>
> {{block main}}
>
> 
>  CIDADES 
> 
>
> 
> {{=grid}}
> 
>
> {{end}}
>
>
> esse é o caminho q usei, a view ta sendo carregado sem erro, so q ta
> ligada no banco DUMMY.DB, acho q se nao tem conexao d banco o aplicativo
> gera esse banco automatico...
>
> o postgresql ta instalado correto, pois abro ele pelo PgAdmin e mexo nas
> tabelas sem problemas
>
> lembrando q usando a conexao do sqllite o projeto funciona sem problemas...
>
> ---
>
> alguem pode me ajudar?
>
>
>  --
> 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/groups/opt_out.
>

-- 
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/groups/opt_out.


Re: [web2py] Re: Conexao POSTGRESQL com PYTHON/WEB2PY - problema

2013-10-28 Thread Ovidio Marinho
 *Não , Não mexa no Gluon nem crie conexões
Só urilize isto no local onde esta sa conexão sqlite.
*

Dica Macete: Apos substituir a conexao existente do Sqlite por
postgres://username:password@localhost/test

va no diretorio seuweb2py/applications/suaaplicação/databases e delete tudo
deixe zerado sem aquivos.





 Ovidio Marinho Falcao Neto
  ITJP.NET.BR
 ovidio...@gmail.com
 Brasil



Em 28 de outubro de 2013 07:55, Carlynhos77 escreveu:

> Ola, bom dia... ainda nao consegui resolver esse problema, nao consigo
> conectar o postgresql no projeto python/web2py... alguem pode me da mais
> alguma dica, ja vi varios exemplos mas nao dá certo...
>
>
>
> Em domingo, 27 de outubro de 2013 11h01min51s UTC-2, Carlynhos77 escreveu:
>
>> Ola, bom dia.. estou com um problema, nao consigo conectar meu banco de
>> dados postgresql ao meu projeto, iniciei utilizando o SQLLITE, conforme
>> aprendi no curso do bruno rocha, so q agora ja queria utilizar o
>> postgresql, dai veio os problemas... rs
>>
>> veja meu codigo...
>> --**--**
>> --**--**
>> --**--
>> vi as explicacoes e exemplos.. veja como esta meu codigo ate exibir a
>> grid...
>>
>> *no MODELS  - "appsettings.py"   ta assim*
>>
>> from gluon.storage import Storage
>> config = Storage(
>> db=Storage(),
>> mail=Storage(),
>> auth=Storage()
>> )
>>
>> import psycopg2
>> #conn = psycopg2.connect(host='**localhost', user='postgres',
>> password='123',dbname='saude')
>> conn = psycopg2.connect("dbname=saude user=postgres")
>> db = conn.cursor()
>>
>> config.mail.sender = "alu...@blouweb.com"
>> config.mail.server = "smtp.gmail.com:587" # "smtp.:25"
>> config.mail.login = "alu...@blouweb.com:"
>>
>> response.title = "INFO-SAÚDE"
>> response.description = "SAÚDE"
>>
>> # glob
>> response.generic_patterns = ['*']
>>
>> *no MODELS   "database.py"   tem isso, no sqllite isso era usado, acho q
>> pro postgresql nao sera usado*
>>
>> #coding: utf-8
>>
>> # conectar ao banco de dados
>> # setar opcoes da DAL
>>
>> db = DAL(**config.db)
>>
>>
>> *no MODELS   "datamodel_objects.py"   isso foi usado para criar as
>> tabelas no sqllite, no postgresql ja criei as tabelas*
>>
>> db.define_table("cadcidade",
>> Field("nome", "text", length=128, notnull=True, unique=True),
>> Field("uf", "text", length=2, notnull=True),
>> Field("cep", "text", length=8, notnull=True),
>> Field("cod_ibge", "integer", length=7),
>> auth.signature,
>> format="%(nome)s"
>> )
>>
>>
>> *no CONTROLLERS  "bases.py"   tem esse codigo pra gerar a grid*
>> *
>> *
>> def list_cidade():
>> query = db.cadcidade.id > 0
>> headers = {'cadcidade.nome':   'NOME',
>> 'cadcidade.uf': 'UF',
>> 'cadcidade.cep': 'CEP',
>> 'cadcidade.cod_ibge': 'IBGE' }
>>
>> grid = SQLFORM.grid(query=query,
>>  user_signature=False,
>> paginate=20,
>> searchable=False,
>> csv=False,
>> fields=[db.cadcidade.nome, db.cadcidade.uf, db.cadcidade.cep,
>> db.cadcidade.cod_ibge],
>> orderby=db.cadcidade.nome,
>> headers=headers
>> )
>> return dict(grid=grid)
>>
>>
>> dai esse *CONTROLLER* é exibido numa *VIEWS - BASES* -
>> "list_cidade.html" o codigo ta assim...
>>
>> {{extend 'layout.html'}}
>>
>> {{block main}}
>>
>> 
>>  CIDADES 
>> 
>>
>> 
>> {{=grid}}
>> 
>>
>> {{end}}
>>
>> --**--**
>> --**--**
>> --**--**---
>>
>> esse é o caminho q usei, a view ta sendo carregado sem erro, so q ta
>> ligada no banco DUMMY.DB, acho q se nao tem conexao d banco o aplicativo
>> gera esse banco automatico...
>>
>> o postgresql ta instalado correto, pois abro ele pelo PgAdmin e mexo nas
>> tabelas sem problemas
>>
>> ja olhei varios exemplos e codigo, procurei fazer igual aos exemplos, mas
>> mesmo assim algo dá errada...lembrand q no sqllite ta funcionando
>> perfeitamente...
>>
>> alguem pode me ajudar, duvidas basicas de iniciante... mas todo inicio é
>> complicado
>>
>>
>>  --
> 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/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.

[web2py] Re: Conexao POSTGRESQL com PYTHON/WEB2PY - problema

2013-10-28 Thread Carlynhos77
Ola, bom dia... ainda nao consegui resolver esse problema, nao consigo 
conectar o postgresql no projeto python/web2py... alguem pode me da mais 
alguma dica, ja vi varios exemplos mas nao dá certo...



Em domingo, 27 de outubro de 2013 11h01min51s UTC-2, Carlynhos77 escreveu:
>
> Ola, bom dia.. estou com um problema, nao consigo conectar meu banco de 
> dados postgresql ao meu projeto, iniciei utilizando o SQLLITE, conforme 
> aprendi no curso do bruno rocha, so q agora ja queria utilizar o 
> postgresql, dai veio os problemas... rs
>
> veja meu codigo...
>
> 
> vi as explicacoes e exemplos.. veja como esta meu codigo ate exibir a 
> grid...
>
> *no MODELS  - "appsettings.py"   ta assim* 
>
> from gluon.storage import Storage
> config = Storage(
> db=Storage(),
> mail=Storage(),
> auth=Storage()
> )
>
> import psycopg2
> #conn = psycopg2.connect(host='localhost', user='postgres', 
> password='123',dbname='saude')
> conn = psycopg2.connect("dbname=saude user=postgres")
> db = conn.cursor()
>
> config.mail.sender = "alu...@blouweb.com"
> config.mail.server = "smtp.gmail.com:587" # "smtp.:25"
> config.mail.login = "alu...@blouweb.com:"
>
> response.title = "INFO-SAÚDE"
> response.description = "SAÚDE"
>
> # glob
> response.generic_patterns = ['*']
>
> *no MODELS   "database.py"   tem isso, no sqllite isso era usado, acho q 
> pro postgresql nao sera usado*
>
> #coding: utf-8
>
> # conectar ao banco de dados
> # setar opcoes da DAL
>
> db = DAL(**config.db)
>
>
> *no MODELS   "datamodel_objects.py"   isso foi usado para criar as 
> tabelas no sqllite, no postgresql ja criei as tabelas*
>
> db.define_table("cadcidade",
> Field("nome", "text", length=128, notnull=True, unique=True),
> Field("uf", "text", length=2, notnull=True),
> Field("cep", "text", length=8, notnull=True),
> Field("cod_ibge", "integer", length=7),
> auth.signature,
> format="%(nome)s"
> )
>
>
> *no CONTROLLERS  "bases.py"   tem esse codigo pra gerar a grid*
> *
> *
> def list_cidade():
> query = db.cadcidade.id > 0
> headers = {'cadcidade.nome':   'NOME',
> 'cadcidade.uf': 'UF',
> 'cadcidade.cep': 'CEP',
> 'cadcidade.cod_ibge': 'IBGE' }
>
> grid = SQLFORM.grid(query=query, 
>  user_signature=False,
> paginate=20,
> searchable=False,
> csv=False,
> fields=[db.cadcidade.nome, db.cadcidade.uf, db.cadcidade.cep, 
> db.cadcidade.cod_ibge],
> orderby=db.cadcidade.nome,
> headers=headers
> )
> return dict(grid=grid)
>
>
> dai esse *CONTROLLER* é exibido numa *VIEWS - BASES* - 
> "list_cidade.html" o codigo ta assim...
>
> {{extend 'layout.html'}}
>
> {{block main}}
>
> 
>  CIDADES 
> 
> 
> 
> {{=grid}}
> 
>
> {{end}}
>
>
> ---
>
> esse é o caminho q usei, a view ta sendo carregado sem erro, so q ta 
> ligada no banco DUMMY.DB, acho q se nao tem conexao d banco o aplicativo 
> gera esse banco automatico...
>
> o postgresql ta instalado correto, pois abro ele pelo PgAdmin e mexo nas 
> tabelas sem problemas
>
> ja olhei varios exemplos e codigo, procurei fazer igual aos exemplos, mas 
> mesmo assim algo dá errada...lembrand q no sqllite ta funcionando 
> perfeitamente...
>
> alguem pode me ajudar, duvidas basicas de iniciante... mas todo inicio é 
> complicado
>
>
>

-- 
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/groups/opt_out.


[web2py] DAL in intreactive shell - strange behaviour

2013-10-28 Thread arutti
Hi,

I'm trying to use DAL in web2py interactive shell.

The troubles is that DAL doesn' show the already defined tables.
I can create new tables perfectly
They show up in SQLLite manager (Firefox add-on).

After closing/reopening the shell, it's as if the database connexion didn't 
work correctly.

Any idea what's happening ?

Best regards,
Andre

see below a log of the interactive session.

c:\suzand\swDev\private\web2py>python web2py.py -S gps
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2013
Version 2.7.4-stable+timestamp.2013.10.14.15.16.29
Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
PostgreSQL(pg8000),
 MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), Ingres(pyodbc), IMAP(imaplib)
Python 2.7.2 (default, Jun 24 2011, 12:21:10) [MSC v.1500 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.

IPython 0.11 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help  -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: db = DAL('sqlite://storage.sqlite')

In [2]: db._tables
Out[2]: []

In [3]: db.define_table('foo')
Out[3]: 

In [4]: db.commit()

In [5]: db.define_table('foo_2')
Out[5]: 

In [6]: db._tables
Out[6]: ['foo', 'foo_2']

In [7]:
Do you really want to exit ([y]/n)? y


c:\suzand\swDev\private\web2py>
c:\suzand\swDev\private\web2py>python web2py.py -S gps
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2013
Version 2.7.4-stable+timestamp.2013.10.14.15.16.29
Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
PostgreSQL(pg8000),
 MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), Ingres(pyodbc), IMAP(imaplib)
Python 2.7.2 (default, Jun 24 2011, 12:21:10) [MSC v.1500 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.

IPython 0.11 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help  -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: db = DAL('sqlite://storage.sqlite')

In [2]: db._tables
Out[2]: []

In [3]:


 

-- 
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/groups/opt_out.


[web2py] Re: Scheduler and updating db records

2013-10-28 Thread Paolo Valleri
This is a common issue with the scheduler, you have to explicitly force a 
commit
db.commit()
Paolo

On Monday, October 28, 2013 3:36:13 AM UTC+1, Ignacio Llamas Avalos Jr 
wrote:
>
> I am trying to create a task where every night the following function is 
> run to decrement the days left on my sticky entries. When I call the 
> function using a controller it does exactly as planned where it grabs the 
> sticky entries and decrements the day by 1. When I use the scheduler it 
> runs, but it doesn't update the database records. Am I doing something 
> wrong?
>
> # coding: utf8
> def stickies():
> sticky_entries = db(db.journal.is_sticky == True).select()
> for sticky in sticky_entries:
> days = sticky.days - 1
> if days == 0:
> sticky.is_sticky = False
> sticky.days = days
> sticky.update_record()
> return
>
> from gluon.scheduler import Scheduler
> Scheduler(db, dict(stickies = stickies) )
>
>

-- 
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/groups/opt_out.


[web2py] Deployment questions

2013-10-28 Thread Annet
I read the web2py book's chapter on deployment recipes. My application is 
now compliant with
all efficiency tricks listed here:

http://web2py.com/books/default/chapter/29/13/deployment-recipes#Efficiency-tricks


I host my app at webfaction. I created a static-only app to serve the files 
from my app's static
folder and I created a .htaccess file to add a MIME type for javascript and 
set caching headers.


I have three apps dbModel containing all database and static files, init to 
just retrieve data and
cms to crud data. 

In init I set session.connect(request, response, masterapp='cms'). Am I 
right to conclude that now
sessions are only stored in admin and init app's sessions folder?

In the past I used a custom version of the expire_sessions.py file to clean 
up sessions. I called
the file from the Linux crontab:



I read the book's paragraph on cleaning up sessions but I am not sure 
whether I understand what I read correctly.

To delete expired sessions every 5 minutes I open an SSH session and enter:

nohup python ~/webapps/w2p/web2py/web2py.py -S admin -M -R 
scripts/sessions2trash.py
nohup python ~/webapps/w2p/web2py/web2py.py -S init -M -R 
scripts/sessions2trash.py

To delete session older than 60 minutes ... I add this to the crontab:

11,31,51 * * * * ~/webapps/w2p/web2py/web2py.py -S admin -R 
scripts/sessions2trash.py -A -o -x 3600 -f -v
12,32,52 * * * * ~/webapps/w2p/web2py/web2py.py -S init -R 
scripts/sessions2trash.py -A -o -x 3600 -f -v

Is that correct?


I don't want my users to be confronted with error tickets, but as admin I 
do want to know whether
the app in production does produce error tickets, so I had a look at:

http://web2py.com/books/default/chapter/29/04/the-core#Routes-on-error
http://web2py.com/books/default/chapter/29/13/deployment-recipes#Collecting-tickets

I don't see how I combine these features to achieve what I want. I hope one 
of you can explain
me how to combine them.

Furthermore, I gave routes.py a try. I put this in web2py's root folder

routes_onerror = [
  ('init/*', '/init/default/error')
  ('cms/*', '/cms/default/error')
]

My first question is can I have:

routes_onerror = [
  ('init/*', '/init/default/error')
  ('init/smartapp/*', '/init/smartapp/error')
  ('cms/*', '/cms/default/error')
]

smartapp is a controller which views are ajax based. The view for 
init/default/error extends layout.html
the view for init/smartapp/error does not extend a view.

My second question, in development you do not use routes_onerror, do you?


I look forward to your answers,

Annet

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