Re: [web2py] Re: wrong record getting selected in recursive select

2016-09-01 Thread brooks lee
The extra space before "if t:" must have caused the syntax error.Sorry,my
bad.The code with the correct syntax is as follows:
#models/db1.py

db.define_table('Restaurant',
Field('Name',unique=True),
..
...auth.signature,format='%(Name)s')

db.define_table('Menu',
Field('menu','upload'),
Field('restaurant','reference Restaurant',writable=False))



###controller/func()
indices=db(db.Menu).select()
for index in indices:
t=db(index.restaurant.Name==request.args[0]).select(db.Menu.ALL).first()
if t:
record=db.Menu(t.id)
form=SQLFORM(db.Menu,record).process()
..
.


Regards,
Brooks

On Fri, Sep 2, 2016 at 12:54 AM, Dave S  wrote:

>
>
> On Thursday, September 1, 2016 at 11:47:55 AM UTC-7, @brooks wrote:
>>
>> So my question goes as follows:
>> #models/db1.py
>>
>> db.define_table('Restaurant',
>> Field('Name',unique=True),
>> ..
>> ...auth.signature,format='%(Name)s')
>>
>> db.define_table('Menu',
>> Field('menu','upload'),
>> Field('restaurant','reference Restaurant',writable=False))
>>
>>
>> controller/func()
>> indices=db(db.Menu).select()
>> for index in indices:
>> t=db(index.restaurant.Name==request.args[0]).select(db.Menu.
>> ALL).first()
>> if t:
>> record=db.Menu(t.id)
>> form=SQLFORM(db.Menu,record).process()
>> ..
>> .
>>
>> (I have one record in the Menu table now)
>> The question is that the first record gets selected even if the condition
>> is not true.I do not understand it.Please tell me what I am doing wrong.Any
>> help is appreciated.
>>
>> Regards,
>> Brooks
>>
>
> I dunno, but I get a syntax error trying to translate your for ... select
> into something I can try with -S and my tables.  Is db()
> meaningful?
>
> /dps
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/E4VyjG0jS94/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] Re: does db.rollback() roll back all concurrent users' data?

2016-09-01 Thread Dave S


On Thursday, September 1, 2016 at 6:11:12 PM UTC-7, Alex Glaros wrote:
>
> does db.rollback() roll back everyone's data in multi-tenant app, or just 
> that one user's?
>
> thanks
>
> Alex Glaros
>

Inside a transaction (and requests are automatically a transaction), the 
rollback should only be the changes of the transaction.
Code in a module may need to do a commit or rollback if altering the DB.

[Looks like a missing word in the book's *commit and rollback* paragraph, 
first sentence.]
 
Outside of a transaction (running a script, say) would only be the changes 
since the last commit (previous request, or explicit commit);
this could apply to code in a module, also.  If you are running scripts or 
modules in parallel, I'm not sure what the answer is.

/dps


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


[web2py] Re: Cannot Create Table Named "Items" - Already Exists

2016-09-01 Thread Brian Boatright
so it's just something in the web2py code base that has a problem with the 
word "items" as a database table name. 

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


[web2py] Smartgrid search: How do I search on integers and linked tables?

2016-09-01 Thread Luciano Laporta Podazza
Hello,

1. I noted that Smartgrid does not search on integers unless I select that 
specific field on the dropdown search widget menu, so I would like to know 
how to "enable" this by default so users can search by numbers too.

2. On the other hand, I would like to search on linked tables too. 

Is all this possible?, thanks 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/d/optout.


[web2py] does db.rollback() roll back all concurrent users' data?

2016-09-01 Thread Alex Glaros
does db.rollback() roll back everyone's data in multi-tenant app, or just 
that one user's?

thanks

Alex Glaros

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


[web2py] Re: Cannot Create Table Named "Items" - Already Exists

2016-09-01 Thread Dave S


On Thursday, September 1, 2016 at 5:20:36 PM UTC-7, Brian Boatright wrote:
>
> thanks to Yoel pointing out that "item" works I just changed the table 
> name to "item" instead of "items" but I would really like to see this issue 
> fixed or at least explained. it's either a bug or a reserved word that 
> isn't being detected correctly.
>
> Thanks all for the help so far. 
>

I have no trouble manually creating a table called 'items' in my sqlite3 
database.

/dps

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


[web2py] Re: Cannot Create Table Named "Items" - Already Exists

2016-09-01 Thread Brian Boatright
thanks to Yoel pointing out that "item" works I just changed the table name 
to "item" instead of "items" but I would really like to see this issue 
fixed or at least explained. it's either a bug or a reserved word that 
isn't being detected correctly.

Thanks all for the help so far. 

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


[web2py] Re: Cannot Create Table Named "Items" - Already Exists

2016-09-01 Thread Brian Boatright
indeed!

I'm new to web2py and python. if I knew a bit more I would try to edit the 
base.py function for define_table that might give some more details. the 
error stops right on line 819 of base.py. would be good to have self.tables 
print out as part of the error or even directly on the page.

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


[web2py] Re: Cannot Create Table Named "Items" - Already Exists

2016-09-01 Thread Dave S


On Thursday, September 1, 2016 at 4:09:13 PM UTC-7, Brian Boatright wrote:
>
> I haven't figured out how to get an interactive console on my windows 
> machine 
>

-command
 

> BUT I did upload the package to pythonanywhere and used their bash shell. 
>
> The only tables created were the standard authentication tables. 
>
>
> 
>

Puzzling.

/dps
 

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


[web2py] Re: Cannot Create Table Named "Items" - Already Exists

2016-09-01 Thread Brian Boatright
I haven't figured out how to get an interactive console on my windows 
machine BUT I did upload the package to pythonanywhere and used their bash 
shell. 

The only tables created were the standard authentication tables. 



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


[web2py] Re: profanity filter

2016-09-01 Thread Alex Glaros
thanks Dave, you're right.  If you have time, do you see any speed 
inefficiencies in my code?  Trying to improve.

for anyone interested, here is extensive bad-word list for many languages: 
 
https://github.com/LDNOOBW/List-of-Dirty-Naughty-Obscene-and-Otherwise-Bad-Words

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


[web2py] Re: Cannot Create Table Named "Items" - Already Exists

2016-09-01 Thread Dave S


On Thursday, September 1, 2016 at 3:42:59 PM UTC-7, Brian Boatright wrote:
>
> just to be sure it wasn't some odd cache issue or something I missed I 
> created a brand new simple app in the admin called "forum" and created a 
> new model file models.py and created a very basic items table.
>
> # -*- coding: utf-8 -*-
>> db.define_table('items',
>> Field('parentid','integer'),
>> Field('itemtypeid','integer'),
>> Field('name','string'))
>
>
> the error is the same as on my other app.
>
>>
>> Traceback (most recent call last):
>> File "C:\dev\web2py\gluon\restricted.py", line 227, in restricted
>> exec ccode in environment
>> File "C:/dev/web2py/applications/forum/models/models.py" 
>> , line 5, in 
>> 
>> Field('name','string'))
>> File "C:\dev\web2py\gluon\packages\dal\pydal\base.py", line 819, in 
>> define_table
>> raise SyntaxError('table already defined: %s' % tablename)
>> SyntaxError: table already defined: items
>
>
> I can upload the packaged app but all I did was create a new one and make 
> that models file. it's using all default db stuff (sqlite).
>


On your console (or terminal session), do 
sqlite3 applications/forum/databases/storage.sqlite
.tables

and see what tables are defined.


/dps

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


[web2py] Re: profanity filter

2016-09-01 Thread Dave S


On Thursday, September 1, 2016 at 3:11:42 PM UTC-7, Alex Glaros wrote:
>
> thanks Niphlod and Luis. It was always unclear to me how, where, and if 
> possible, to install packages. So that helps my long-term understanding a 
> lot.
>
> For the time being, can anyone please remind me how to extract the bad 
> word without braces in controller below?  
>
> def clean_bad_words(original_text):
> bad_words = 
> open(os.path.join(request.folder,'static','bad_words.txt')).readlines() 
> bad_word_is = None
> for line in bad_words:
> splitted = line.split()
> if splitted[0] in original_text:
> bad_word_is = splitted[0]
> return dict (bad_word_is = bad_word_is)
>
>
> def testing():   
> original_text = ''
> new_words_is = clean_bad_words(original_text)
> return dict(new_words_is = new_words_is)
>
> VIEW:  {{=new_words_is}} 
>
> this below is diplayed instead of just the word (): Would like it 
> without the braces and quotes.
> {'bad_word_is': ''}
>

In the view, wouldn't it be new_words_is['bad_word_is"] ?   Ordinary dict 
behavior?

/dps


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


[web2py] Re: Cannot Create Table Named "Items" - Already Exists

2016-09-01 Thread Brian Boatright
just to be sure it wasn't some odd cache issue or something I missed I 
created a brand new simple app in the admin called "forum" and created a 
new model file models.py and created a very basic items table.

# -*- coding: utf-8 -*-
> db.define_table('items',
> Field('parentid','integer'),
> Field('itemtypeid','integer'),
> Field('name','string'))


the error is the same as on my other app.

>
> Traceback (most recent call last):
> File "C:\dev\web2py\gluon\restricted.py", line 227, in restricted
> exec ccode in environment
> File "C:/dev/web2py/applications/forum/models/models.py" 
> , line 5, in <
> module>
> Field('name','string'))
> File "C:\dev\web2py\gluon\packages\dal\pydal\base.py", line 819, in 
> define_table
> raise SyntaxError('table already defined: %s' % tablename)
> SyntaxError: table already defined: items


I can upload the packaged app but all I did was create a new one and make 
that models file. it's using all default db stuff (sqlite).
 

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


[web2py] Re: profanity filter

2016-09-01 Thread Alex Glaros
thanks Niphlod and Luis. It was always unclear to me how, where, and if 
possible, to install packages. So that helps my long-term understanding a 
lot.

For the time being, can anyone please remind me how to extract the bad word 
without braces in controller below?  

def clean_bad_words(original_text):
bad_words = 
open(os.path.join(request.folder,'static','bad_words.txt')).readlines() 
bad_word_is = None
for line in bad_words:
splitted = line.split()
if splitted[0] in original_text:
bad_word_is = splitted[0]
return dict (bad_word_is = bad_word_is)


def testing():   
original_text = ''
new_words_is = clean_bad_words(original_text)
return dict(new_words_is = new_words_is)

VIEW:  {{=new_words_is}} 

this below is diplayed instead of just the word (): Would like it 
without the braces and quotes.
{'bad_word_is': ''}

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


[web2py] Re: Cannot Create Table Named "Items" - Already Exists

2016-09-01 Thread Brian Boatright
I always delete the database in mysql and create it again (no tables). 

Then delete all the files in the database folder.

When it runs again, as far as I know, everything is clean. 

My connection string is just a simple

> uri: mysql://root:password@localhost/project


and I don't see anything else in the appconfig.ini or db.py

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


[web2py] Re: profanity filter

2016-09-01 Thread Niphlod
definitely the way to go if you can, and I'd also add to learn about 
virtualenv as soon as you can.

for simple packages you may also place their source into site-packages on 
the web2py root dir (works even with the binaries)
Profanity doesn't depend on 3rd party packages, and the source code is in 
tar.gz with a standard structure... once you dig into it you end up in a 
folder containing setup.py. What you'd need to do is to copy the folder 
holding the source (that is the one at the same level of setup.py called 
"profanity") into site-packages (it's __init__.py should be in 
site-packages/profanity).

e.g. for profanity, the content of 
profanity-1.1.tar.gz/dist/profanity-1.1.tar/profanity-1.1/profanity/

should go into 

site-packages/profanity


On Thursday, September 1, 2016 at 6:24:42 PM UTC+2, Alex Glaros wrote:
>
> okay, I forgot have to use the web2py source distribution to install 
>

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


Re: [web2py] Cannot Create Table Named "Items" - Already Exists

2016-09-01 Thread Yoel Benitez Fonseca
i don't know of "items" but "item" is not a keyword for Python or
Web2py ... i'm using it right now in one of my projects:

db.define_table('item',
# item metadata
Field('provider', 'string', length=100, default=''),
Field('provider_service', 'string'),
Field('pubstatus', 'string', length=10, default='usable'),
Field('embargoed', 'datetime', default=None),



2016-09-01 17:11 GMT-04:00 Niphlod :
> items isn't a roblem for check_reserved.
>
> On Thursday, September 1, 2016 at 10:14:47 PM UTC+2, Richard wrote:
>>
>>
>> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=reserved+word#Reserved-keywords
>>
>> Do you have it in your connection string?
>>
>> You should be notified that it a mysql reserved word...
>>
>> If not... Have you change database? New empty database sound like you
>> restart database from scratch... web2py keep track of migration of models
>> you have to migrate=false fake_migrate=true then back to migrate=true to
>> allow web2py to sync with the database...
>>
>>
>> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=fake_migrate#migrate--fake_migrate
>>
>> Richard
>>
>> On Thu, Sep 1, 2016 at 3:52 PM, Brian Boatright  wrote:
>>>
>>> Is "items" a keyword for Python or Web2py? I'm using mysql and having
>>> web2py models file define a new table named "items" but it gives me an error
>>> that says the table already exists.
>>>
>>> If I change the name of the table to something like "items2" in the
>>> models.py file it works.
>>>
>>> The mysql database is empty of tables before this is run and I've
>>> confirmed there is no items table before it tries to run the models.py file.
>>> I can create a table manually named items so it isn't specific to MySQL
>>> database.
>>>
>>> Thanks for any help.
>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google Groups
>>> "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import this"

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


Re: [web2py] Cannot Create Table Named "Items" - Already Exists

2016-09-01 Thread Niphlod
items isn't a roblem for check_reserved.

On Thursday, September 1, 2016 at 10:14:47 PM UTC+2, Richard wrote:
>
>
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=reserved+word#Reserved-keywords
>
> Do you have it in your connection string?
>
> You should be notified that it a mysql reserved word...
>
> If not... Have you change database? New empty database sound like you 
> restart database from scratch... web2py keep track of migration of models 
> you have to migrate=false fake_migrate=true then back to migrate=true to 
> allow web2py to sync with the database...
>
>
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=fake_migrate#migrate--fake_migrate
>
> Richard
>
> On Thu, Sep 1, 2016 at 3:52 PM, Brian Boatright  > wrote:
>
>> Is "items" a keyword for Python or Web2py? I'm using mysql and having 
>> web2py models file define a new table named "items" but it gives me an 
>> error that says the table already exists. 
>>
>> If I change the name of the table to something like "items2" in the 
>> models.py file it works.
>>
>> The mysql database is empty of tables before this is run and I've 
>> confirmed there is no items table before it tries to run the models.py 
>> file. I can create a table manually named items so it isn't specific to 
>> MySQL database. 
>>
>> Thanks for any help. 
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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


Re: [web2py] Cannot Create Table Named "Items" - Already Exists

2016-09-01 Thread Richard Vézina
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=reserved+word#Reserved-keywords

Do you have it in your connection string?

You should be notified that it a mysql reserved word...

If not... Have you change database? New empty database sound like you
restart database from scratch... web2py keep track of migration of models
you have to migrate=false fake_migrate=true then back to migrate=true to
allow web2py to sync with the database...

http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=fake_migrate#migrate--fake_migrate

Richard

On Thu, Sep 1, 2016 at 3:52 PM, Brian Boatright  wrote:

> Is "items" a keyword for Python or Web2py? I'm using mysql and having
> web2py models file define a new table named "items" but it gives me an
> error that says the table already exists.
>
> If I change the name of the table to something like "items2" in the
> models.py file it works.
>
> The mysql database is empty of tables before this is run and I've
> confirmed there is no items table before it tries to run the models.py
> file. I can create a table manually named items so it isn't specific to
> MySQL database.
>
> Thanks for any help.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] Cannot Create Table Named "Items" - Already Exists

2016-09-01 Thread Brian Boatright
Is "items" a keyword for Python or Web2py? I'm using mysql and having 
web2py models file define a new table named "items" but it gives me an 
error that says the table already exists. 

If I change the name of the table to something like "items2" in the 
models.py file it works.

The mysql database is empty of tables before this is run and I've confirmed 
there is no items table before it tries to run the models.py file. I can 
create a table manually named items so it isn't specific to MySQL database. 

Thanks for any help. 

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


[web2py] Re: SQLForm.grid csv export

2016-09-01 Thread Remco Boerma
Although it's been half a year; for the record, see this 
post: https://groups.google.com/d/msg/web2py/6W-jf3EPb04/x3hSC5ySCgAJ 

Op donderdag 28 juli 2016 10:17:50 UTC+2 schreef Ryan Hood:
>
> Hello,
>
>  
>
> I'm pretty new to Web2py.  I need some help with the SQLForm.grid export 
> CSV functionality.I have the following basic structure:
>
>  
>
> *db.py*
>
> db.define_table('test',
>
> Field('name', 'string', length=50, notnull=True),
>
> Field('email', 'string', notnull=True),
>
> format="%(name)s")
>
> *default.py*
>
> def index():
>
> query=(db.test.id>0)
>
> fields=[db.test.id,db.test.name,db.test.email]
>
> forms=SQLFORM.grid(query=query, csv=True)
>
> return dict(forms=forms)
>
>  
>
> For some reason only the JSON and XML exports work but the CSV and TSV 
> exports won't work.  For CSV, I keep getting the following error:
>
>  
>
> **
>
>  
>
> NOTE: my argument list looks like this: 
>
> *Function argument list*
>
> (self=, k='_extra')
>
>  
>
> NOTE: I have tried a couple different versions of Web2py on both CentOS 
> and Windows and same error.
>
>  
>
> I'm sure I'm missing something small, but haven't been able to track it 
> down.  Any help would be appreciated.
>
>  
>
> Thank you,
>
> ryan
>

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


[web2py] Re: wrong record getting selected in recursive select

2016-09-01 Thread Dave S


On Thursday, September 1, 2016 at 11:47:55 AM UTC-7, @brooks wrote:
>
> So my question goes as follows:
> #models/db1.py
> 
> db.define_table('Restaurant',
> Field('Name',unique=True),
> ..
> ...auth.signature,format='%(Name)s')
>
> db.define_table('Menu',
> Field('menu','upload'),
> Field('restaurant','reference Restaurant',writable=False))
>
>
> controller/func()
> indices=db(db.Menu).select()
> for index in indices:
> t=db(index.restaurant.Name
> ==request.args[0]).select(db.Menu.ALL).first()
> if t:
> record=db.Menu(t.id)
> form=SQLFORM(db.Menu,record).process()
> ..
> .
>
> (I have one record in the Menu table now)
> The question is that the first record gets selected even if the condition 
> is not true.I do not understand it.Please tell me what I am doing wrong.Any 
> help is appreciated.
>
> Regards,
> Brooks
>

I dunno, but I get a syntax error trying to translate your for ... select 
into something I can try with -S and my tables.  Is db() 
meaningful?

/dps

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


Re: [web2py] Best way to pre-populate a database on start-up

2016-09-01 Thread Richard Vézina
private/* would be a good place to store it.

Richard

On Wed, Aug 31, 2016 at 3:15 PM, Niphlod  wrote:

> same deal, "different" organization.
> With an external script you can't call that function if not from an
> external process.
> Having it in a separated controller incurs in None performance-penalties
> (having it in a standard controller has None to a handful of ms penalty
> when that controller is hit for another function)... and you can offload
> the task, e.g., to the scheduler.
>
>
> On Wednesday, August 31, 2016 at 2:33:15 PM UTC+2, Manuele wrote:
>>
>> Il 30/08/16 21:40, Niphlod ha scritto:
>> > +1 for Dave .
>> >
>> > with isempty() in a model you're executing a query for each and every
>> > request for absolutely NO REASON.
>>
>> I usually create a script directory and put there scripts with commands
>> to be performed only once, such in the case of pre-populating or more in
>> general of application initialization with the sintax:
>>
>> $ python web2py.py -S myapp -M -R applications/myapp/scripts/myscript.py
>>
>> in case of model is not needed (and it's not the case of pre-population)
>> you can even not use the -M option.
>>
>> Do you think it could be a good way to suggest?
>>
>> Cheers
>>
>>
>> Manuele
>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] wrong record getting selected in recursive select

2016-09-01 Thread @brooks
So my question goes as follows:
#models/db1.py

db.define_table('Restaurant',
Field('Name',unique=True),
..
...auth.signature,format='%(Name)s')

db.define_table('Menu',
Field('menu','upload'),
Field('restaurant','reference Restaurant',writable=False))


controller/func()
indices=db(db.Menu).select()
for index in indices:
t=db(index.restaurant.Name==request.args[0]).select(db.Menu.ALL).first()
if t:
record=db.Menu(t.id)
form=SQLFORM(db.Menu,record).process()
..
.

(I have one record in the Menu table now)
The question is that the first record gets selected even if the condition 
is not true.I do not understand it.Please tell me what I am doing wrong.Any 
help is appreciated.

Regards,
Brooks

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


[web2py] redirection using ajax with javascript variables passed in the url.

2016-09-01 Thread @brooks

I am doing the following to pass the javascript variable from the view to 
the controller:
##default/rough2.html

{{extend 'layout.html'}}






var x=document.getElementById("demo");
jQuery(document).ready(function(){
geolocation();
})

function geolocation()  {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);

} else { 
x.innerHTML = "Geolocation is not supported by this browser.";
}
}

function showPosition(position) {
var lat = position.coords.latitude;
var lon= position.coords.longitude;

ajax('{{=URL('default','rough3')}}'+'?lat='+lat+'&lon='+lon,[],':eval');
}




#rough3() function
def rough3():
lat1=request.vars.lat
lon1=request.vars.lon
...
...

But it is "not getting redirected to rough3.html".I do not understand 
why?Please help me with this.I am really troubled with this.

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


[web2py] Re: profanity filter

2016-09-01 Thread Alex Glaros
okay, I forgot have to use the web2py source distribution to install 

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


[web2py] Re: profanity filter

2016-09-01 Thread Alex Glaros
from the web2py directory in DOS, I tried:

pip install  C:\alex\language\content\profanity-1.1\profanity

but received error: Unknown or unsupported command 'install'

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


[web2py] Re: profanity filter

2016-09-01 Thread Alex Glaros
have not installed anything before in web2py Luis.  How to implement in 
Windos?  Instructions say:

##Installation
pip install profanity

thanks,

Alex

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


[web2py] Re: profanity filter

2016-09-01 Thread luis . valladares
I've found some python packages, maybe it suits your needs:

https://pypi.python.org/pypi/profanity/1.1
https://github.com/jared-mess/profanity-filter

Or maybe adapting this:
https://www.languagetool.org/

El miércoles, 31 de agosto de 2016, 17:34:54 (UTC-4), Alex Glaros escribió:
>
> anyone have a working profanity filter I could copy?
>
> thanks
>
> Alex Glaros
>

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