[web2py] Re: Migrating Postgres to MySql

2016-09-16 Thread Joe Barnhart
Huh.  Just tried db.export_to_csv_file() again and it wasn't nearly as slow 
as I thought before.  It took about 2 minutes for a largish (but not my 
biggest) database, exported from Postgres.  As a fun thing to try, I ran 
the same command under the most recent pypy and the same export took only 
23 seconds!!  I had to do it twice and compare the output files to convince 
myself it actually worked.  But it did.

I'm not sure how long the import will take using python into MySql.  Pypy 
is not an option here as I don't have an all-python driver for mysql that 
works with pypy.  I'm sure it will take longer than the export, but I don't 
have to do this very often...

-- Joe

The idea about setting a "fence" and getting changes added since the last 
export is a pretty compelling one, however.

On Friday, September 16, 2016 at 2:28:09 PM UTC-7, Joe Barnhart wrote:
>
> I've been using PostgresSQL for my production site for quite awhile.  My 
> future improved site, however, will feature MySql for its database engine. 
>  (Not a diss on Postgres, it's just a lot easier to find hosting companies 
> who will rent me a supported-and-maintained MySql instance.)  I have 
> thousands of user logins and lots 'o history I want, yea even NEED, to 
> preserve.  I've been reading up on strategies for converting from one 
> database to another.
>
> For example, I can dump the Postgres database in its entirety into CSV 
> using the DAL, then read the data back into MySql.  That has some 
> attractiveness but I couldn't help noticing how s--l-o-w this process is. 
>  I let the dump run for about an hour and it wasn't done yet.  Then there's 
> the little problem of the developer.  He just can't leave things alone. 
>  The MySql database design is "much better" (read: different) than the 
> Postgres design.  (It makes no difference that I am actually the developer 
> of both.)  So I can't just export CSV and import it.  Not without editing 
> the CSV on the way.
>
> What if, instead, I create the MySql tables with an extra column to hold 
> the "old" id from the Postgres database?  I could then develop a 
> "transition" class that would open connections to both databases, read 
> records from the Postgres one, and insert them (with whatever mods are 
> required) into the MySql database.  When I process records from Postgres 
> which have dependencies on the "id" field from another table, I use the 
> "old_id" field to map it to the new id value.
>
> This process could take as long as it wants, and run concurrently with the 
> old system.  I could shut it down and restart it as needed if I kept a 
> "fence" of the highest id processed from the old database.  I would need to 
> do the tables in order of no dependencies to fullest dependencies, to make 
> sure the required dependent records are already in place when the table is 
> processed.
>
> After all is said and done, I could simply delete the "old_id" columns 
> from the affected MySql tables.  If I even care at that point.
>
> Am I missing something?  Or does this seem viable for a system with a 
> large database to migrate?
>
> -- Joe
>
>

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


[web2py] Re: how to add alt tags to images

2016-09-16 Thread Dave S


On Friday, September 16, 2016 at 12:51:12 PM UTC-7, Anthony wrote:
>
> What are you expecting to see? The "alt" text should only display on 
> screen in case the image can't be loaded.
>

I think browsers for the blind do text-to-speech on the alt text.  I 
haven't had to deal with that myself, but someone in a usenet group I read 
uses that type of browser.

/dps

 

>
> Anthony
>
> On Friday, September 16, 2016 at 3:44:21 PM UTC-4, Alex Glaros wrote:
>>
>> Need add alt tags to images for ADA  compliance
>>
>> Below doesn't seem to display any alt info
>>
>>  
>>
>> any suggestions appreciated
>>
>> 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: Smartgrid search: How do I search on integers and linked tables?

2016-09-16 Thread Luciano Laporta Podazza


On Tuesday, September 6, 2016 at 11:37:00 AM UTC-3, Massimo Di Pierro wrote:
>
> You can customize smartgrid and make your own search function. By default 
> you cannot.
>

Thanks Massimo!
 

>
> On Thursday, 1 September 2016 20:34:27 UTC-5, Luciano Laporta Podazza 
> wrote:
>>
>> 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] booking/event calendar

2016-09-16 Thread icodk
Looking for a front end event/booking calendar to be used in web2py 
application.
I actually found 49 on github (searching for javascript event calendar). 
Just before I try them all, would be thankful to hear others experience.
Thanks

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


[web2py] Migrating Postgres to MySql

2016-09-16 Thread Joe Barnhart
I've been using PostgresSQL for my production site for quite awhile.  My 
future improved site, however, will feature MySql for its database engine. 
 (Not a diss on Postgres, it's just a lot easier to find hosting companies 
who will rent me a supported-and-maintained MySql instance.)  I have 
thousands of user logins and lots 'o history I want, yea even NEED, to 
preserve.  I've been reading up on strategies for converting from one 
database to another.

For example, I can dump the Postgres database in its entirety into CSV 
using the DAL, then read the data back into MySql.  That has some 
attractiveness but I couldn't help noticing how s--l-o-w this process is. 
 I let the dump run for about an hour and it wasn't done yet.  Then there's 
the little problem of the developer.  He just can't leave things alone. 
 The MySql database design is "much better" (read: different) than the 
Postgres design.  (It makes no difference that I am actually the developer 
of both.)  So I can't just export CSV and import it.  Not without editing 
the CSV on the way.

What if, instead, I create the MySql tables with an extra column to hold 
the "old" id from the Postgres database?  I could then develop a 
"transition" class that would open connections to both databases, read 
records from the Postgres one, and insert them (with whatever mods are 
required) into the MySql database.  When I process records from Postgres 
which have dependencies on the "id" field from another table, I use the 
"old_id" field to map it to the new id value.

This process could take as long as it wants, and run concurrently with the 
old system.  I could shut it down and restart it as needed if I kept a 
"fence" of the highest id processed from the old database.  I would need to 
do the tables in order of no dependencies to fullest dependencies, to make 
sure the required dependent records are already in place when the table is 
processed.

After all is said and done, I could simply delete the "old_id" columns from 
the affected MySql tables.  If I even care at that point.

Am I missing something?  Or does this seem viable for a system with a large 
database to migrate?

-- Joe

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


[web2py] Re: field in list test

2016-09-16 Thread Anthony
This is a quirk of Field objects. Field inherits from Expression, and the 
__eq__ method of Expression returns a Query object (rather than testing for 
equality and returning a boolean). So, if you do something like myfield == 
some_object, you do not actually get a test of whether myfield is 
equivalent to some_object. Instead, you just get a Query object, which 
apparently evaluates to True in the code Python uses to check for the 
existence of an element in a list. It works this way so you can create DAL 
queries using the db.mytable.myfield == some_value syntax.

If you want to check for a field in a list, consider instead storing the 
field names:

f = db.item.id
fields = [f.name]
f.name in fields

Or using your current code, you can do:

any(field is f for field in fields)

Above, field == f would result in the same problem, but field is f avoids 
the creation of the Query object.

Anthony

On Friday, September 16, 2016 at 12:41:28 PM UTC-4, Yoel Benitez Fonseca 
wrote:
>
> Does this make sense to you? 
>
> In [1]: fields = list() 
>
> In [2]: f = db.item.id 
>
> In [3]: f in fields 
> Out[3]: False 
>
> In [4]: fields.append(f) 
>
> In [5]: f in fields 
> Out[5]: True 
>
> In [6]: f = db.item.headline 
>
> In [7]: f in fields 
> Out[7]: True 
>
> I mean, the last value of 'f' is a fields object but a different one. 
>
> -- 
> 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.


[web2py] Re: how to add alt tags to images

2016-09-16 Thread Alex Glaros
okay, never mind last question - I can see it looks correct from view-source

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


[web2py] Re: how to add alt tags to images

2016-09-16 Thread Alex Glaros
am I correct in that this highlighted part works in w2p for ADA compliance?

{{=IMG(_src=URL('static', 'images/small_new_gov.png'), _alt='photo of 
government and citizens')}} 

thanks Anthony

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


[web2py] Re: how to add alt tags to images

2016-09-16 Thread Anthony
You need to set the "title" attribute to get text to pop up when you hover. 
If you inspect that "Register to Vote" button, you'll see it has both an 
"alt" attribute and a "title" attribute.

Anthony

On Friday, September 16, 2016 at 4:05:26 PM UTC-4, Alex Glaros wrote:
>
> maybe I'm not understanding ADA requirements.  What was expecting to see 
> is the displayed text when you hover over the "register to vote button" at 
> bottom of this page:
>
> http://www.insurance.ca.gov/
>

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


[web2py] Re: Is it safe to use plain XMLHttpRequest instead of ajax() function?

2016-09-16 Thread Anthony
On Friday, September 16, 2016 at 7:58:26 AM UTC-4, Przemysław Loesch wrote:
>
> Massimo thank you very much for your answer. I have one more question a 
> bit out of the topic.
> Is it a way to increase web2py efficiency when it is used only for 
> database transactions and user authorization? I don't use web2py html 
> helpers, forms, views processing etc. Complete GUI of my app is created in 
> javascript and calls web2py asynchronously just to get some data as json. 
> In these conditions is it a part of web2py which could be "turned off" eg. 
> by removing imports of unnecessary modules or by setting variables? So far 
> the speed the server responses is very good but soon I'll have much bigger 
> load and just want to be sure that server side process is as 
> straightforward as it can be.
>

There is not really much framework functionality you can turn off or forego 
in order to increase performance, but here are a few things to consider:

On a given request, if you don't need the session, you should call 
session.forget(response) in order to skip checking the session for changes. 
For a bigger benefit, you can completely disable sessions for particular 
routes by using the pattern-based re-write system and adding 
dict(web2py_disable_session=True) to any relevant routes (see this example 
).
 
Unfortunately, this doesn't work with the parameter-based rewrite system.

Whenever you fetch data using the DAL, if you don't need the .update_record 
or .delete_record methods, do .select(..., cacheable=True), which will 
slightly speed up the creation of the Row objects. More generally, you can 
specify your own custom processor via .select(..., 
processor=custom_processor), which allows you to forego the creation of a 
Rows object altogether -- instead, your custom processor receives the list 
of tuples returned by the database driver, and you can do whatever minimal 
processing you need.

You can also skip the Auth initialization code on any routes that will not 
need Auth or any auth.user data (actually, you can get auth.user data for 
logged in users directly from session.auth.user).

There's another trick to get a modest speedup -- put your controller code 
in a module, import it in a model file, and send the response directly from 
the model (see this example 
).
 
Probably only worth it on requests that are otherwise very fast (i.e., not 
involving the database).

There are, of course, many other things you can do to improve efficiency, 
such as compiling the app and caching as much as possible.

Anthony

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


[web2py] Re: how to add alt tags to images

2016-09-16 Thread Alex Glaros
maybe I'm not understanding ADA requirements.  What was expecting to see is 
the displayed text when you hover over the "register to vote button" at 
bottom of this page:

http://www.insurance.ca.gov/

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


[web2py] Re: Is it safe to use plain XMLHttpRequest instead of ajax() function?

2016-09-16 Thread Anthony
On Friday, September 16, 2016 at 2:16:28 PM UTC-4, Dave S wrote:
>
>
> You're going to have at least a minimal view (generic.json, frex) to 
> provide the headers and the HTTP 200.
>

You do not need a view in order to have headers set or return an HTTP 
response -- that can all be done from a controller or even a model. 
Executing views adds overhead, so you should only use them if needed.
 

> But my understanding is that the models can be the slowest part of web2py 
> (as opposed to the backend), so using conditional models or moving extra 
> models out to the modules can be useful.
>

It's not that models in general are particularly slow, just that if you 
have many model files executing on every request, that may be adding 
unnecessary overhead if you don't really need everything being defined in 
each file on every request. All things being equal, if you execute and 
return a response from a single model file (e.g., via raise HTTP(...)), 
that should actually be a bit faster than executing and returning the same 
response from a controller file (with no model files), as the latter 
involves some additional framework code execution, including making a copy 
of the entire web2py environment.

Anthony

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


[web2py] Re: how to add alt tags to images

2016-09-16 Thread Anthony
What are you expecting to see? The "alt" text should only display on screen 
in case the image can't be loaded.

Anthony

On Friday, September 16, 2016 at 3:44:21 PM UTC-4, Alex Glaros wrote:
>
> Need add alt tags to images for ADA  compliance
>
> Below doesn't seem to display any alt info
>
>  
>
> any suggestions appreciated
>
> 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] how to add alt tags to images

2016-09-16 Thread Alex Glaros
Need add alt tags to images for ADA  compliance

Below doesn't seem to display any alt info

 

any suggestions appreciated

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: sqlite3 driver not found ((

2016-09-16 Thread Dave S


On Friday, September 16, 2016 at 11:51:02 AM UTC-7, Dmitri Ermolaev wrote:
>
> I install pyDALL https://github.com/web2py/pydal
> but same error ((
> in python command line - erro is same - not found driver!
>

What does your connection string look like?

/dps
 

>
> пятница, 16 сентября 2016 г., 21:34:57 UTC+3 пользователь Dmitri Ermolaev 
> написал:
>>
>> I try to install on Unix server - unpack .zip
>> and run apps - error:
>>  Failure to connect, tried 5 times: Traceback (most recent call last): 
>> File 
>> "/usr/local/lib/python2.7/site-packages/pyDAL-16.8-py2.7.egg/pydal/base.py", 
>> line 455, in __init__ self._adapter = adapter(**kwargs) File 
>> "/usr/local/lib/python2.7/site-packages/pyDAL-16.8-py2.7.egg/pydal/adapters/__init__.py",
>>  
>> line 40, in __call__ obj = super(AdapterMeta, cls).__call__(*args, 
>> **kwargs) File 
>> "/usr/local/lib/python2.7/site-packages/pyDAL-16.8-py2.7.egg/pydal/adapters/base.py",
>>  
>> line 373, in __init__ super(SQLAdapter, self).__init__(*args, **kwargs) 
>> File 
>> "/usr/local/lib/python2.7/site-packages/pyDAL-16.8-py2.7.egg/pydal/adapters/base.py",
>>  
>> line 50, in __init__ self.find_driver() File 
>> "/usr/local/lib/python2.7/site-packages/pyDAL-16.8-py2.7.egg/pydal/adapters/base.py",
>>  
>> line 101, in find_driver str(self.drivers)) RuntimeError: No driver of 
>> supported ones ('sqlite2', 'sqlite3') is available
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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: sqlite3 driver not found ((

2016-09-16 Thread Dmitri Ermolaev
I install pyDALL https://github.com/web2py/pydal
but same error ((
in python command line - erro is same - not found driver!

пятница, 16 сентября 2016 г., 21:34:57 UTC+3 пользователь Dmitri Ermolaev 
написал:
>
> I try to install on Unix server - unpack .zip
> and run apps - error:
>  Failure to connect, tried 5 times: Traceback (most recent call last): 
> File 
> "/usr/local/lib/python2.7/site-packages/pyDAL-16.8-py2.7.egg/pydal/base.py", 
> line 455, in __init__ self._adapter = adapter(**kwargs) File 
> "/usr/local/lib/python2.7/site-packages/pyDAL-16.8-py2.7.egg/pydal/adapters/__init__.py",
>  
> line 40, in __call__ obj = super(AdapterMeta, cls).__call__(*args, 
> **kwargs) File 
> "/usr/local/lib/python2.7/site-packages/pyDAL-16.8-py2.7.egg/pydal/adapters/base.py",
>  
> line 373, in __init__ super(SQLAdapter, self).__init__(*args, **kwargs) 
> File 
> "/usr/local/lib/python2.7/site-packages/pyDAL-16.8-py2.7.egg/pydal/adapters/base.py",
>  
> line 50, in __init__ self.find_driver() File 
> "/usr/local/lib/python2.7/site-packages/pyDAL-16.8-py2.7.egg/pydal/adapters/base.py",
>  
> line 101, in find_driver str(self.drivers)) RuntimeError: No driver of 
> supported ones ('sqlite2', 'sqlite3') is available
>

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


[web2py] Re: field in list test

2016-09-16 Thread Dave S


On Friday, September 16, 2016 at 9:41:28 AM UTC-7, Yoel Benitez Fonseca 
wrote:
>
> Does this make sense to you? 
>

Yes.
 

>
> In [1]: fields = list() 
>
> In [2]: f = db.item.id 
>
> In [3]: f in fields 
> Out[3]: False 
>
> In [4]: fields.append(f) 
>
> In [5]: f in fields 
> Out[5]: True 
>
> In [6]: f = db.item.headline 
>
> In [7]: f in fields 
> Out[7]: True 
>
> I mean, the last value of 'f' is a fields object but a different one. 
>


What you've stored in fields is an object reference; a reference to f, not 
to its value.

What are you trying to do?  Dynamic table handling, or forming a list of 
fields for SQLFORM or ??

/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] sqlite3 driver not found ((

2016-09-16 Thread Dmitri Ermolaev
Failure to connect, tried 5 times: Traceback (most recent call last): File 
"/usr/local/lib/python2.7/site-packages/pyDAL-16.8-py2.7.egg/pydal/base.py", 
line 455, in __init__ self._adapter = adapter(**kwargs) File 
"/usr/local/lib/python2.7/site-packages/pyDAL-16.8-py2.7.egg/pydal/adapters/__init__.py",
 
line 40, in __call__ obj = super(AdapterMeta, cls).__call__(*args, 
**kwargs) File 
"/usr/local/lib/python2.7/site-packages/pyDAL-16.8-py2.7.egg/pydal/adapters/base.py",
 
line 373, in __init__ super(SQLAdapter, self).__init__(*args, **kwargs) 
File 
"/usr/local/lib/python2.7/site-packages/pyDAL-16.8-py2.7.egg/pydal/adapters/base.py",
 
line 50, in __init__ self.find_driver() File 
"/usr/local/lib/python2.7/site-packages/pyDAL-16.8-py2.7.egg/pydal/adapters/base.py",
 
line 101, in find_driver str(self.drivers)) RuntimeError: No driver of 
supported ones ('sqlite2', 'sqlite3') is available

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


[web2py] Re: Is it safe to use plain XMLHttpRequest instead of ajax() function?

2016-09-16 Thread Dave S


On Friday, September 16, 2016 at 4:58:26 AM UTC-7, Przemysław Loesch wrote:
>
> Massimo thank you very much for your answer. I have one more question a 
> bit out of the topic.
> Is it a way to increase web2py efficiency when it is used only for 
> database transactions and user authorization? I don't use web2py html 
> helpers, forms, views processing etc. Complete GUI of my app is created in 
> javascript and calls web2py asynchronously just to get some data as json. 
> In these conditions is it a part of web2py which could be "turned off" eg. 
> by removing imports of unnecessary modules or by setting variables? So far 
> the speed the server responses is very good but soon I'll have much bigger 
> load and just want to be sure that server side process is as 
> straightforward as it can be.
> Przemek
>

You're going to have at least a minimal view (generic.json, frex) to 
provide the headers and the HTTP 200.  But my understanding is that the 
models can be the slowest part of web2py (as opposed to the backend), so 
using conditional models or moving extra models out to the modules can be 
useful.

(Caveat:  I'm just one of the "advanced beginners", but I think I've 
captured this part of the wisdom of the Respected Regulars.)

/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] field in list test

2016-09-16 Thread Yoel Benitez Fonseca
Does this make sense to you?

In [1]: fields = list()

In [2]: f = db.item.id

In [3]: f in fields
Out[3]: False

In [4]: fields.append(f)

In [5]: f in fields
Out[5]: True

In [6]: f = db.item.headline

In [7]: f in fields
Out[7]: True

I mean, the last value of 'f' is a fields object but a different one.

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


[web2py] Re: Web2py Solr UI

2016-09-16 Thread Ron Chatterjee
I never used heystack so its interesting. How the heystack has advantage 
over this?

query = SQLFORM.*build_query*(list_of_searchable_fields,search_text)





On Thursday, September 15, 2016 at 6:51:25 PM UTC-4, Donald McClymont wrote:
>
> Massimo has also posted this as a starting point 
> https://github.com/mdipierro/web2py-haystack  which may be a useful 
> starting point- I haven't used with solr but did manage to extend to GAE 
> Search without too much difficulty.
>
> Regards
> Donald
>
> On Wednesday, September 14, 2016 at 4:42:55 PM UTC+1, Massimo Di Pierro 
> wrote:
>>
>> You can ask here. If we can help for free so that everybody benefit the 
>> better. If instead you have private code and do not want to show, please 
>> contact one of the companies doing web2py support listed from the web2py 
>> page.
>>
>> On Wednesday, 14 September 2016 08:37:21 UTC-5, Morris Fourie wrote:
>>>
>>> I need assistance with Web2py and Solr UI. I am new and not at the right 
>>> level yet but am willing to pay. I hope I am at the right forum and come 
>>> anyone help
>>> Thanks
>>> Mo
>>>
>>>
>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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] Show Registration_Key attribute on grid

2016-09-16 Thread Oasis Agano
Im trying to add a registration_key to manage view so that the admin can 
approve a user in a view by just deleting the Pending 

CONTROLLER

@auth.requires_login()
@auth.requires_membership('Admin')
def manageusers():
grid = SQLFORM.smartgrid(db.auth_user,user_signature=True)
return locals()


MODEL

if auth.login==True:

db.auth_user.registration_key.readable = 
db.auth_user.registration_key.writable = True


the issue is that i cant even logout now


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


[web2py] Re: Is it safe to use plain XMLHttpRequest instead of ajax() function?

2016-09-16 Thread Przemysław Loesch
Massimo thank you very much for your answer. I have one more question a bit 
out of the topic.
Is it a way to increase web2py efficiency when it is used only for database 
transactions and user authorization? I don't use web2py html helpers, 
forms, views processing etc. Complete GUI of my app is created in 
javascript and calls web2py asynchronously just to get some data as json. 
In these conditions is it a part of web2py which could be "turned off" eg. 
by removing imports of unnecessary modules or by setting variables? So far 
the speed the server responses is very good but soon I'll have much bigger 
load and just want to be sure that server side process is as 
straightforward as it can be.
Przemek

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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: avoiding duplicate field names

2016-09-16 Thread Alex Glaros
thanks Niphlod, you're right.  Answer is right in the book.  Works now.

my_current_role_names = db(db.Role.role_owner_organization_FK == 
specificOrganizationID)
db.Role.role_name.requires = IS_NOT_IN_DB(my_current_role_names, 
'Role.role_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] Re: Web2py - How to update a table field appending a string to an existing field value

2016-09-16 Thread Meinolf
I had tried that and tried it just now but still gives a None value in the 
rated_items.search_term field. maybe it's got to do with the table def; my 
table definition is as follows:

db.define_table('rated_items',
Field('search_term','string'),
Field('user_id', 'reference auth_user', default=auth.user and 
auth.user.id),
Field('item_id', 'integer'),
Field('clicks', 'integer', default=0),
migrate=True,
)

On Friday, September 16, 2016 at 12:00:09 AM UTC+2, Meinolf wrote:
>
> Hi there
>
> So far i only know how to update a record by replacing the old field value 
> with the new value. Suppose i want to append the search_term string value 
> the corresponding text field so that both values are stored, how can i do 
> that in this code:
>
> myrow = db((db.rated_items.user_id==auth.user.id) & 
>  
> (db.rated_items.item_id==request.args(0))).update(search_term=str(request.vars.search_term)
>
> Would appreciate 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: avoiding duplicate field names

2016-09-16 Thread Niphlod
the query is right, but *requires=* *require *- excuse the repetition - a 
validator, not a query (those nifty IS_LENGTH() thingies)



On Friday, September 16, 2016 at 5:18:30 AM UTC+2, Alex Glaros wrote:
>
> are there any simple mistakes in this syntax or am I approaching it wrong?
>
> my_current_role_names = db(db.Role.role_owner_organization_FK == 
> specificOrganizationID)._select(db.Role.role_name) 
> db.Role.role_name.requires = ~db.Role.role_name.belongs(
> my_current_role_names)
>
>
> thanks
>
> Alex Glaros
>
>  Validation error, field:role_name (NOT 
> (Role.role_name IN (SELECT Role.role_name FROM Role WHERE 
> (Role.role_owner_organization_FK = 7 'exceptions.Exception'>(Validation error, field:role_name (NOT 
> (Role.role_name IN (SELECT Role.role_name FROM Role WHERE 
> (Role.role_owner_organization_FK = 7)
>
> Code listing
>
> 1862.
> 1863.
> 1864.
> 1865.
> 1866.
> 1867.
>
> 1868.
> 1869.
> 1870.
> 1871.
>
> (value, errors) = validator(value)
> except:
> import traceback
> print traceback.format_exc()
> msg = "Validation error, field:%s %s" % (name,validator)
> raise Exception(msg)
>
> if errors is not None:
> self.vars[name] = value
> self.errors[name] = errors
> break
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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.