[web2py] Re: mod_wsgi error caused (maybe) by css transferred with MIME type text/plain

2015-03-31 Thread Niphlod
aside from the fact that that config is uber-simple and not what web2py 
ships usually. who is serving css's ? apache or web2py ?

On Tuesday, March 31, 2015 at 7:05:25 AM UTC+2, weheh wrote:

 Thanks, Brian. My page does have a lot of ajax calls. The problem seems to 
 be that some of my css files aren't coming through. Firebug says they're 
 being delivered as text/plain instead of text/css. Consequently, the page 
 load incorrectly and users probably bail, causing the IO Error in mod_wsgi. 
 Have you had the css file problem? Here's the actual Firebug error message:

 Resource interpreted as Stylesheet but transferred with MIME type 
 text/plain: https://www.myapp.com/myapp/static/css/web2py.css;.


-- 
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: manually update password

2015-03-31 Thread Niphlod
why all this fuss ? let the form handle it instead of your code.

On Tuesday, March 31, 2015 at 3:07:57 AM UTC+2, José Eloy wrote:

 Sorry for the delay in answering.

 I have the following code for modify the auth_user table:

 administrador = db2.auth_user(request.args(0)) or 
 redirect(URL('ver_administradores'))
 form = SQLFORM(db2.auth_user, administrador, submit_button=Aceptar, 
 deletable=True, showid=False)  # update SQLFORM

 if form.validate():
  
 nombre = request.vars.first_name
 apellidos = request.vars.last_name
 usuario = request.vars.username
 myPassword = request.vars.password # I received the password 
 field of the form
 ...
   
 db2(db2.auth_user.id==id_administrador).update(first_name=nombre, 
 last_name=apellidos, username=usuario, 
 password=db2.auth_user.password.validate(myPassword)[0], ..) 

 I need to save the password using the update method. 
 How can I know if the user change the password or if the password is the 
 same? How can I save it? Is it correct to use 
 password=db2.auth_user.password.validate(myPassword)[0]?

 Regards.




-- 
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] Cloning SQLlite into PostgreSQL

2015-03-31 Thread Gael Princivalle
Hello.

Like a lot of users I need to clone an existing SQLlite db to new 
PostgreSQL db.
I've read this post in web2py-developers by Alan Etkin:
https://groups.google.com/forum/#!searchin/web2py-developers/sqlite$20postgres/web2py-developers/QxeJNByj6qc/cpBHsa1ymUkJ

However I've tried to use this script and my PosgreSQL db still empty.

My db:
dbsq = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'])
dbpg = DAL('postgres://user:pass@localhost:5432/postg_myapp',pool_size=1,
check_reserved=['all'])

My controller:
def migrate_to_pg():
migrate(dbsq, dbpg)
return dict()

def disable_triggers(pgdb):
for tablename in pgdb.tables():
pgdb.executesql(ALTER TABLE %s DISABLE TRIGGER ALL; % \
tablename)

def enable_triggers(pgdb):
for tablename in pgdb.tables():
pgdb.executesql(ALTER TABLE %s ENABLE TRIGGER ALL; % \
tablename)

def migrate(sqlitedb, pgdb):
Transfer data to PostgreSQL

Arguments:
sqlitedb: the Sqlite db  source connection
pgdb: the PostgreSQL db target connection

import logging
setval = select setval('%s'::regclass
setval += , (SELECT MAX(%s) FROM %s));
logging.debug(Disabling pg triggers temporarily)
disable_triggers(pgdb)
for table in pgdb.tables:
logging.debug(copying %s % table)
query = pgdb[table]._id  0
rows = pgdb(query).select()
colnames = [k[k.index(.)+1:] for k in rows.colnames]
logging.debug(pgdb._lastsql)
logging.debug(colnames)
rows = sqlitedb.executesql(pgdb._lastsql)
# clean up table
pgdb.executesql(TRUNCATE %s % table)
for i, row in enumerate(rows):
  logging.debug(inserting, i, len(rows))
  sql = INSERT INTO %s (%s) VALUES (%s) % (
  table,
  ','.join(colnames),
  ','.join([%s for k in colnames]),
  )
  logging.debug(sql)
  pgdb.executesql(sql, row)
# update serials
sequence = pgdb[table]._sequence_name
if sequence in [, None]:
sequence = %s_%s_seq % (table, colnames[0])
pgdb.executesql(setval % (sequence,
  colnames[0],
  table))
logging.debug(Re-enabling pg triggers)
enable_triggers(pgdb)
pgdb.commit()
logging.debug(Migration done)

When I run migrate_to_pg I don't have any kind of error but the PosgreSQL 
db still empty.

Someone can give me a help, or another solution for this migration?
I think it's necessary for web2py having a tool for this migration, giving 
an easy way for fresh web2py users like me that understand that they must 
migrate some existing applications to PostgreSQL to do it without headaches.

Thanks, regards.

-- 
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: Cloning SQLlite into PostgreSQL

2015-03-31 Thread Ron Chatterjee
As an alrenative. you can upload a csv file into web2py. Not a solution if 
you want to do things dynamically and all the time. But you can use the csv 
option.

On Tuesday, March 31, 2015 at 4:11:18 AM UTC-4, Gael Princivalle wrote:

 Hello.

 Like a lot of users I need to clone an existing SQLlite db to new 
 PostgreSQL db.
 I've read this post in web2py-developers by Alan Etkin:

 https://groups.google.com/forum/#!searchin/web2py-developers/sqlite$20postgres/web2py-developers/QxeJNByj6qc/cpBHsa1ymUkJ

 However I've tried to use this script and my PosgreSQL db still empty.

 My db:
 dbsq = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'])
 dbpg = DAL('postgres://user:pass@localhost:5432/postg_myapp',pool_size=1,
 check_reserved=['all'])

 My controller:
 def migrate_to_pg():
 migrate(dbsq, dbpg)
 return dict()

 def disable_triggers(pgdb):
 for tablename in pgdb.tables():
 pgdb.executesql(ALTER TABLE %s DISABLE TRIGGER ALL; % \
 tablename)

 def enable_triggers(pgdb):
 for tablename in pgdb.tables():
 pgdb.executesql(ALTER TABLE %s ENABLE TRIGGER ALL; % \
 tablename)

 def migrate(sqlitedb, pgdb):
 Transfer data to PostgreSQL
 
 Arguments:
 sqlitedb: the Sqlite db  source connection
 pgdb: the PostgreSQL db target connection
 
 import logging
 setval = select setval('%s'::regclass
 setval += , (SELECT MAX(%s) FROM %s));
 logging.debug(Disabling pg triggers temporarily)
 disable_triggers(pgdb)
 for table in pgdb.tables:
 logging.debug(copying %s % table)
 query = pgdb[table]._id  0
 rows = pgdb(query).select()
 colnames = [k[k.index(.)+1:] for k in rows.colnames]
 logging.debug(pgdb._lastsql)
 logging.debug(colnames)
 rows = sqlitedb.executesql(pgdb._lastsql)
 # clean up table
 pgdb.executesql(TRUNCATE %s % table)
 for i, row in enumerate(rows):
   logging.debug(inserting, i, len(rows))
   sql = INSERT INTO %s (%s) VALUES (%s) % (
   table,
   ','.join(colnames),
   ','.join([%s for k in colnames]),
   )
   logging.debug(sql)
   pgdb.executesql(sql, row)
 # update serials
 sequence = pgdb[table]._sequence_name
 if sequence in [, None]:
 sequence = %s_%s_seq % (table, colnames[0])
 pgdb.executesql(setval % (sequence,
   colnames[0],
   table))
 logging.debug(Re-enabling pg triggers)
 enable_triggers(pgdb)
 pgdb.commit()
 logging.debug(Migration done)

 When I run migrate_to_pg I don't have any kind of error but the PosgreSQL 
 db still empty.

 Someone can give me a help, or another solution for this migration?
 I think it's necessary for web2py having a tool for this migration, giving 
 an easy way for fresh web2py users like me that understand that they must 
 migrate some existing applications to PostgreSQL to do it without headaches.

 Thanks, regards.



-- 
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: 2.10.1 / Windows errors / cache

2015-03-31 Thread Massimo Di Pierro
2.10.2 fixes it as Leonel suggested.

On Tuesday, 31 March 2015 19:15:00 UTC-5, Leonel Câmara wrote:

 Awww dammit we forgot to update the admin module.

 I attached an admin.py file you can replace the one in the gluon with to 
 get this to work until we make a proper fix.


-- 
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] websocket messaging VS scheduler

2015-03-31 Thread Carlos Costa
I would like to use scheduler with a task sends websocket messages but it 
looks like they conflict with each other.
I am able to run only one of them.

If I start scheduler first, websocket freezes web2py.
If I start websocket first scheduler do not run any worker.

I start we2py with web2py.py -K app -a password -X -D15

In some action I do this to start the websocket

import subprocess
subprocess.call(python gluon/contrib/websocket_messaging.py -k mykey -p 
.split(' '))

but this freezes everything.

If I start websocket from shell manually both things work but I would like 
my app  to guarantee that things are running.

Some idea why this is not possible?

Running 2.9.12 with python 2.7 on Ubuntu 14.10

-- 
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: update table as boolean.

2015-03-31 Thread Anthony
Do you have a question? Any code to show?

On Tuesday, March 31, 2015 at 6:27:12 PM UTC-4, archana subramanyam wrote:

 Hi
 When i click on check box and confirm button ...the db with colo 'X' must 
 get updated to true (if checkbox is checked),else updted to false(if 
 checkbox not checked and on submitting form).


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


[web2py] Re: mod_wsgi error caused (maybe) by css transferred with MIME type text/plain

2015-03-31 Thread weheh
Thanks, Jim. 32-bit Apache Version 2.2.x  mod-wsgi for python 2.7

On Tuesday, March 31, 2015 at 1:46:26 PM UTC-7, Jim S wrote:

 What versions of Apache and mod-wsgi?  32 bit or 64 bit?

 -Jim



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


Re: [web2py] Re: 2.10.1 / Windows errors / cache

2015-03-31 Thread Kiran Subbaraman

Just cloned the repo, and noticed the 2.10.2 tag.
Tried this again, in this codebase, and the errors remain.
Please note, I have highlighted two issues that occur:

 * Install the sample app, view the default page. The page comes up
   just fine. Click page-refresh, and you see the first error: type
   'exceptions.IOError' [Errno 13] Permission denied
 * Go to the Admin page, and select clean, for this app. The second
   error: type 'exceptions.WindowsError' [Error 32] The process
   cannot access the file because it is being used by another process


Kiran Subbaraman
http://subbaraman.wordpress.com/about/

On Wed, 01-04-2015 8:58 AM, Massimo Di Pierro wrote:

2.10.2 fixes it as Leonel suggested.

On Tuesday, 31 March 2015 19:15:00 UTC-5, Leonel Câmara wrote:

Awww dammit we forgot to update the admin module.

I attached an admin.py file you can replace the one in the gluon
with to get this to work until we make a proper fix.

--
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 
mailto: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: mod_wsgi error caused (maybe) by css transferred with MIME type text/plain

2015-03-31 Thread weheh
I'm getting a 200 status on the css files that aren't being transferred 
correctly. Also, on Chrome  Firebug I can't find the same Net tab and view 
you describe, so I can't find that X-Powered-By line.


On Tuesday, March 31, 2015 at 2:09:53 PM UTC-7, Niphlod wrote:

 You need to activate the Net tab ... you're probably inspecting a 304 
 response, which doesn't carry the header: hit ctrl+f5 to erase the cache 
 and refresh the page.

 this is what it returns on my system

 Cache-ControlprivateConnectionkeep-aliveContent-Length117305Content-Typetext/css;
  
 charset=utf-8DateTue, 31 Mar 2015 21:06:50 GMTLast-ModifiedMon, 16 Mar 
 2015 07:42:10 GMTPragmacacheServerRocket 1.2.6 Python/2.7.8X-Powered-By
 web2py

 On Tuesday, March 31, 2015 at 10:54:09 PM UTC+2, Dave S wrote:



 On Tuesday, March 31, 2015 at 1:34:28 PM UTC-7, Niphlod wrote:

 web2py appends a X-Powered-By : web2py header.


 I'm thinking you are saying that is put into the css file's response 
 header; what's the best way to see that?   Firefox's developer tool doesn't 
 show headers in the CSS tab, and in the network tab I see just 
 Connection:, Content-Type:, Date:, and Server: (which is Rocket for 
 my case).

 The httpserver.log file for my Web2Py instance does show GET requests 
 for the CSS files.

 /dps still wet behind the ears


 On Tuesday, March 31, 2015 at 10:27:25 PM UTC+2, weheh wrote:

 How do I figure out whether web2py is serving the css files?

 On Tuesday, March 31, 2015 at 12:39:00 AM UTC-7, Niphlod wrote:

 aside from the fact that that config is uber-simple and not what 
 web2py ships usually. who is serving css's ? apache or web2py ?

 On Tuesday, March 31, 2015 at 7:05:25 AM UTC+2, weheh wrote:

 Thanks, Brian. My page does have a lot of ajax calls. The problem 
 seems to be that some of my css files aren't coming through. Firebug 
 says 
 they're being delivered as text/plain instead of text/css. Consequently, 
 the page load incorrectly and users probably bail, causing the IO Error 
 in 
 mod_wsgi. Have you had the css file problem? Here's the actual Firebug 
 error message:

 Resource interpreted as Stylesheet but transferred with MIME type 
 text/plain: https://www.myapp.com/myapp/static/css/web2py.css;.



-- 
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: Write dynamic query in DAL without extra nested parentheses

2015-03-31 Thread gb
Thanks, Gary!  Works perfectly.

On Tuesday, March 31, 2015 at 4:27:12 PM UTC-6, Gray Kanarek wrote:

 You want belongs, I think:

 query = db.product.id.belongs((selected_ids))



 On Saturday, March 28, 2015 at 12:14:44 PM UTC-4, gb wrote:

 What is the DAL Code to generate a query like this:
 SELECT * FROM product WHERE product.id=1 OR product.id=2 OR product.id=3 
 OR product.id product.id=4 OR product.id=5;
 or even:
 SELECT * FROM product WHERE (product.id=1) OR (product.id=2) OR (
 product.id=3) OR (product.id=4) OR (product.id=5);

 I've tried both the DAL code approaches below and I always end up with 
 crazy parentheses nesting which will eventually crash the DB driver e.g. in 
 sqlite: class 'sqlite3.OperationalError' parser stack overflow

 Is there another way to use the DAL, or is my only option to write the 
 SQL manually?

 db.define_table(product)

 selected_ids = [1,2,3,4,5]
 query = []
 for pid in selected_ids:
 query.append(db.product.id == pid)

 query = reduce(lambda a,b:a|b,query)
 #Ouputs this : (product.id = 1) OR (product.id = 2)) OR (
 product.id = 3)) OR (product.id = 4)) OR (product.id = 5))


 
 selected_ids = [1,2,3,4,5]
 query = []
 for pid in selected_ids:
 query |= db.product.id == pid

 #I get a bonus parenthesis with this method ((product.id = 1) OR 
 ) OR (product.id = 2)) OR (product.id = 3)) OR (product.id = 4)) OR (
 product.id = 5))



-- 
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] idea: new helpers

2015-03-31 Thread Dmitry Ermolaev
 DIV( _class='row my_class') = ROW(_class='my_class')

 DIV( _class='col-sm-4 my_class') = COL4(_class='my_class')

-- 
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] you mean me?

2015-03-31 Thread Manuele Pesenti
I noticed a Manuele Presenti is mentioned here:
http://www.web2py.com/books/default/chapter/29/01/introduction
but if you mean to mention me (and I would be VERY proud of it!!) my
correct surname is Pesenti :)

but I have always correct the spelling till I was a child :)

maybe I can correct my self the error... if you confirm you really mean
me :)

M. Pesenti

-- 
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: Cloning SQLlite into PostgreSQL

2015-03-31 Thread Willoughby
Well it has a bunch of log statements, were all of those OK?

On Tuesday, March 31, 2015 at 2:19:41 PM UTC-4, Gael Princivalle wrote:

 Thanks Ron but:with CSV export:
 auth_user_iduser
 3 John
 7 Sally

 And then you import your CSV file you will have:
 auth_user_iduser
 1 John
 2 Sally

 And so all relations between tables will be broken.
 Someone have a solution?

 Il giorno martedì 31 marzo 2015 15:10:53 UTC+2, Ron Chatterjee ha scritto:

 As an alrenative. you can upload a csv file into web2py. Not a solution 
 if you want to do things dynamically and all the time. But you can use the 
 csv option.

 On Tuesday, March 31, 2015 at 4:11:18 AM UTC-4, Gael Princivalle wrote:

 Hello.

 Like a lot of users I need to clone an existing SQLlite db to new 
 PostgreSQL db.
 I've read this post in web2py-developers by Alan Etkin:

 https://groups.google.com/forum/#!searchin/web2py-developers/sqlite$20postgres/web2py-developers/QxeJNByj6qc/cpBHsa1ymUkJ

 However I've tried to use this script and my PosgreSQL db still empty.

 My db:
 dbsq = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'])
 dbpg = DAL('postgres://user:pass@localhost:5432/postg_myapp',pool_size=1
 ,check_reserved=['all'])

 My controller:
 def migrate_to_pg():
 migrate(dbsq, dbpg)
 return dict()

 def disable_triggers(pgdb):
 for tablename in pgdb.tables():
 pgdb.executesql(ALTER TABLE %s DISABLE TRIGGER ALL; % \
 tablename)

 def enable_triggers(pgdb):
 for tablename in pgdb.tables():
 pgdb.executesql(ALTER TABLE %s ENABLE TRIGGER ALL; % \
 tablename)

 def migrate(sqlitedb, pgdb):
 Transfer data to PostgreSQL
 
 Arguments:
 sqlitedb: the Sqlite db  source connection
 pgdb: the PostgreSQL db target connection
 
 import logging
 setval = select setval('%s'::regclass
 setval += , (SELECT MAX(%s) FROM %s));
 logging.debug(Disabling pg triggers temporarily)
 disable_triggers(pgdb)
 for table in pgdb.tables:
 logging.debug(copying %s % table)
 query = pgdb[table]._id  0
 rows = pgdb(query).select()
 colnames = [k[k.index(.)+1:] for k in rows.colnames]
 logging.debug(pgdb._lastsql)
 logging.debug(colnames)
 rows = sqlitedb.executesql(pgdb._lastsql)
 # clean up table
 pgdb.executesql(TRUNCATE %s % table)
 for i, row in enumerate(rows):
   logging.debug(inserting, i, len(rows))
   sql = INSERT INTO %s (%s) VALUES (%s) % (
   table,
   ','.join(colnames),
   ','.join([%s for k in colnames]),
   )
   logging.debug(sql)
   pgdb.executesql(sql, row)
 # update serials
 sequence = pgdb[table]._sequence_name
 if sequence in [, None]:
 sequence = %s_%s_seq % (table, colnames[0])
 pgdb.executesql(setval % (sequence,
   colnames[0],
   table))
 logging.debug(Re-enabling pg triggers)
 enable_triggers(pgdb)
 pgdb.commit()
 logging.debug(Migration done)

 When I run migrate_to_pg I don't have any kind of error but the 
 PosgreSQL db still empty.

 Someone can give me a help, or another solution for this migration?
 I think it's necessary for web2py having a tool for this migration, 
 giving an easy way for fresh web2py users like me that understand that they 
 must migrate some existing applications to PostgreSQL to do it without 
 headaches.

 Thanks, regards.



-- 
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: Cloning SQLlite into PostgreSQL

2015-03-31 Thread Gael Princivalle
I'm sorry Willoughby but I don't understand your question.

With this csv export/import the problem is that id's change.

For example if you take a look to the auth_user table in my previous post, 
table auth_membership will have wrong auth_user id's:
auth_membership.id 
https://dev.tasko.it/mompala/appadmin/select/db?orderby=auth_membership.id  
   auth_membership.user_id 
https://dev.tasko.it/mompala/appadmin/select/db?orderby=auth_membership.group_id1
 
  3 (John)
2   7 (Sally)

And in each application that I have most of them are in relation, so that's 
a problem.
I've take a look to pgloader but it seems complicated to make a migration.
If someone have a detailed example it could be useful.

Il giorno martedì 31 marzo 2015 20:52:18 UTC+2, Willoughby ha scritto:

 Well it has a bunch of log statements, were all of those OK?

 On Tuesday, March 31, 2015 at 2:19:41 PM UTC-4, Gael Princivalle wrote:

 Thanks Ron but:with CSV export:
 auth_user_iduser
 3 John
 7 Sally

 And then you import your CSV file you will have:
 auth_user_iduser
 1 John
 2 Sally

 And so all relations between tables will be broken.
 Someone have a solution?

 Il giorno martedì 31 marzo 2015 15:10:53 UTC+2, Ron Chatterjee ha scritto:

 As an alrenative. you can upload a csv file into web2py. Not a solution 
 if you want to do things dynamically and all the time. But you can use the 
 csv option.

 On Tuesday, March 31, 2015 at 4:11:18 AM UTC-4, Gael Princivalle wrote:

 Hello.

 Like a lot of users I need to clone an existing SQLlite db to new 
 PostgreSQL db.
 I've read this post in web2py-developers by Alan Etkin:

 https://groups.google.com/forum/#!searchin/web2py-developers/sqlite$20postgres/web2py-developers/QxeJNByj6qc/cpBHsa1ymUkJ

 However I've tried to use this script and my PosgreSQL db still empty.

 My db:
 dbsq = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'
 ])
 dbpg = DAL('postgres://user:pass@localhost:5432/postg_myapp',pool_size=
 1,check_reserved=['all'])

 My controller:
 def migrate_to_pg():
 migrate(dbsq, dbpg)
 return dict()

 def disable_triggers(pgdb):
 for tablename in pgdb.tables():
 pgdb.executesql(ALTER TABLE %s DISABLE TRIGGER ALL; % \
 tablename)

 def enable_triggers(pgdb):
 for tablename in pgdb.tables():
 pgdb.executesql(ALTER TABLE %s ENABLE TRIGGER ALL; % \
 tablename)

 def migrate(sqlitedb, pgdb):
 Transfer data to PostgreSQL
 
 Arguments:
 sqlitedb: the Sqlite db  source connection
 pgdb: the PostgreSQL db target connection
 
 import logging
 setval = select setval('%s'::regclass
 setval += , (SELECT MAX(%s) FROM %s));
 logging.debug(Disabling pg triggers temporarily)
 disable_triggers(pgdb)
 for table in pgdb.tables:
 logging.debug(copying %s % table)
 query = pgdb[table]._id  0
 rows = pgdb(query).select()
 colnames = [k[k.index(.)+1:] for k in rows.colnames]
 logging.debug(pgdb._lastsql)
 logging.debug(colnames)
 rows = sqlitedb.executesql(pgdb._lastsql)
 # clean up table
 pgdb.executesql(TRUNCATE %s % table)
 for i, row in enumerate(rows):
   logging.debug(inserting, i, len(rows))
   sql = INSERT INTO %s (%s) VALUES (%s) % (
   table,
   ','.join(colnames),
   ','.join([%s for k in colnames]),
   )
   logging.debug(sql)
   pgdb.executesql(sql, row)
 # update serials
 sequence = pgdb[table]._sequence_name
 if sequence in [, None]:
 sequence = %s_%s_seq % (table, colnames[0])
 pgdb.executesql(setval % (sequence,
   colnames[0],
   table))
 logging.debug(Re-enabling pg triggers)
 enable_triggers(pgdb)
 pgdb.commit()
 logging.debug(Migration done)

 When I run migrate_to_pg I don't have any kind of error but the 
 PosgreSQL db still empty.

 Someone can give me a help, or another solution for this migration?
 I think it's necessary for web2py having a tool for this migration, 
 giving an easy way for fresh web2py users like me that understand that 
 they 
 must migrate some existing applications to PostgreSQL to do it without 
 headaches.

 Thanks, regards.



-- 
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: Cloning SQLlite into PostgreSQL

2015-03-31 Thread Willoughby
I was referring to the script from Alan Etkin in your first post.
It logs every step - what did the log steps say when you ran it?



On Tuesday, March 31, 2015 at 3:19:13 PM UTC-4, Gael Princivalle wrote:

 I'm sorry Willoughby but I don't understand your question.

 With this csv export/import the problem is that id's change.

 For example if you take a look to the auth_user table in my previous post, 
 table auth_membership will have wrong auth_user id's:
 auth_membership.id auth_membership.user_id 
 https://dev.tasko.it/mompala/appadmin/select/db?orderby=auth_membership.group_id1
  
   3 (John)
 2   7 (Sally)

 And in each application that I have most of them are in relation, so 
 that's a problem.
 I've take a look to pgloader but it seems complicated to make a migration.
 If someone have a detailed example it could be useful.

 Il giorno martedì 31 marzo 2015 20:52:18 UTC+2, Willoughby ha scritto:

 Well it has a bunch of log statements, were all of those OK?

 On Tuesday, March 31, 2015 at 2:19:41 PM UTC-4, Gael Princivalle wrote:

 Thanks Ron but:with CSV export:
 auth_user_iduser
 3 John
 7 Sally

 And then you import your CSV file you will have:
 auth_user_iduser
 1 John
 2 Sally

 And so all relations between tables will be broken.
 Someone have a solution?

 Il giorno martedì 31 marzo 2015 15:10:53 UTC+2, Ron Chatterjee ha 
 scritto:

 As an alrenative. you can upload a csv file into web2py. Not a solution 
 if you want to do things dynamically and all the time. But you can use the 
 csv option.

 On Tuesday, March 31, 2015 at 4:11:18 AM UTC-4, Gael Princivalle wrote:

 Hello.

 Like a lot of users I need to clone an existing SQLlite db to new 
 PostgreSQL db.
 I've read this post in web2py-developers by Alan Etkin:

 https://groups.google.com/forum/#!searchin/web2py-developers/sqlite$20postgres/web2py-developers/QxeJNByj6qc/cpBHsa1ymUkJ

 However I've tried to use this script and my PosgreSQL db still empty.

 My db:
 dbsq = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'
 ])
 dbpg = DAL('postgres://user:pass@localhost:5432/postg_myapp',pool_size
 =1,check_reserved=['all'])

 My controller:
 def migrate_to_pg():
 migrate(dbsq, dbpg)
 return dict()

 def disable_triggers(pgdb):
 for tablename in pgdb.tables():
 pgdb.executesql(ALTER TABLE %s DISABLE TRIGGER ALL; % \
 tablename)

 def enable_triggers(pgdb):
 for tablename in pgdb.tables():
 pgdb.executesql(ALTER TABLE %s ENABLE TRIGGER ALL; % \
 tablename)

 def migrate(sqlitedb, pgdb):
 Transfer data to PostgreSQL
 
 Arguments:
 sqlitedb: the Sqlite db  source connection
 pgdb: the PostgreSQL db target connection
 
 import logging
 setval = select setval('%s'::regclass
 setval += , (SELECT MAX(%s) FROM %s));
 logging.debug(Disabling pg triggers temporarily)
 disable_triggers(pgdb)
 for table in pgdb.tables:
 logging.debug(copying %s % table)
 query = pgdb[table]._id  0
 rows = pgdb(query).select()
 colnames = [k[k.index(.)+1:] for k in rows.colnames]
 logging.debug(pgdb._lastsql)
 logging.debug(colnames)
 rows = sqlitedb.executesql(pgdb._lastsql)
 # clean up table
 pgdb.executesql(TRUNCATE %s % table)
 for i, row in enumerate(rows):
   logging.debug(inserting, i, len(rows))
   sql = INSERT INTO %s (%s) VALUES (%s) % (
   table,
   ','.join(colnames),
   ','.join([%s for k in colnames]),
   )
   logging.debug(sql)
   pgdb.executesql(sql, row)
 # update serials
 sequence = pgdb[table]._sequence_name
 if sequence in [, None]:
 sequence = %s_%s_seq % (table, colnames[0])
 pgdb.executesql(setval % (sequence,
   colnames[0],
   table))
 logging.debug(Re-enabling pg triggers)
 enable_triggers(pgdb)
 pgdb.commit()
 logging.debug(Migration done)

 When I run migrate_to_pg I don't have any kind of error but the 
 PosgreSQL db still empty.

 Someone can give me a help, or another solution for this migration?
 I think it's necessary for web2py having a tool for this migration, 
 giving an easy way for fresh web2py users like me that understand that 
 they 
 must migrate some existing applications to PostgreSQL to do it without 
 headaches.

 Thanks, regards.



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

Re: [web2py] you mean me?

2015-03-31 Thread Marin Pranjić
Hehe, it seems that my name is written twice but both are wrong so maybe
that's not me either :D

Marin

On Tue, Mar 31, 2015 at 5:34 PM, Manuele Pesenti manuele.pese...@gmail.com
wrote:

 I noticed a Manuele Presenti is mentioned here:
 http://www.web2py.com/books/default/chapter/29/01/introduction
 but if you mean to mention me (and I would be VERY proud of it!!) my
 correct surname is Pesenti :)

 but I have always correct the spelling till I was a child :)

 maybe I can correct my self the error... if you confirm you really mean
 me :)

 M. Pesenti

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


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


[web2py] Re: Cloning SQLlite into PostgreSQL

2015-03-31 Thread Gael Princivalle
Thanks Ron but:with CSV export:
auth_user_iduser
3 John
7 Sally

And then you import your CSV file you will have:
auth_user_iduser
1 John
2 Sally

And so all relations between tables will be broken.
Someone have a solution?

Il giorno martedì 31 marzo 2015 15:10:53 UTC+2, Ron Chatterjee ha scritto:

 As an alrenative. you can upload a csv file into web2py. Not a solution if 
 you want to do things dynamically and all the time. But you can use the csv 
 option.

 On Tuesday, March 31, 2015 at 4:11:18 AM UTC-4, Gael Princivalle wrote:

 Hello.

 Like a lot of users I need to clone an existing SQLlite db to new 
 PostgreSQL db.
 I've read this post in web2py-developers by Alan Etkin:

 https://groups.google.com/forum/#!searchin/web2py-developers/sqlite$20postgres/web2py-developers/QxeJNByj6qc/cpBHsa1ymUkJ

 However I've tried to use this script and my PosgreSQL db still empty.

 My db:
 dbsq = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'])
 dbpg = DAL('postgres://user:pass@localhost:5432/postg_myapp',pool_size=1,
 check_reserved=['all'])

 My controller:
 def migrate_to_pg():
 migrate(dbsq, dbpg)
 return dict()

 def disable_triggers(pgdb):
 for tablename in pgdb.tables():
 pgdb.executesql(ALTER TABLE %s DISABLE TRIGGER ALL; % \
 tablename)

 def enable_triggers(pgdb):
 for tablename in pgdb.tables():
 pgdb.executesql(ALTER TABLE %s ENABLE TRIGGER ALL; % \
 tablename)

 def migrate(sqlitedb, pgdb):
 Transfer data to PostgreSQL
 
 Arguments:
 sqlitedb: the Sqlite db  source connection
 pgdb: the PostgreSQL db target connection
 
 import logging
 setval = select setval('%s'::regclass
 setval += , (SELECT MAX(%s) FROM %s));
 logging.debug(Disabling pg triggers temporarily)
 disable_triggers(pgdb)
 for table in pgdb.tables:
 logging.debug(copying %s % table)
 query = pgdb[table]._id  0
 rows = pgdb(query).select()
 colnames = [k[k.index(.)+1:] for k in rows.colnames]
 logging.debug(pgdb._lastsql)
 logging.debug(colnames)
 rows = sqlitedb.executesql(pgdb._lastsql)
 # clean up table
 pgdb.executesql(TRUNCATE %s % table)
 for i, row in enumerate(rows):
   logging.debug(inserting, i, len(rows))
   sql = INSERT INTO %s (%s) VALUES (%s) % (
   table,
   ','.join(colnames),
   ','.join([%s for k in colnames]),
   )
   logging.debug(sql)
   pgdb.executesql(sql, row)
 # update serials
 sequence = pgdb[table]._sequence_name
 if sequence in [, None]:
 sequence = %s_%s_seq % (table, colnames[0])
 pgdb.executesql(setval % (sequence,
   colnames[0],
   table))
 logging.debug(Re-enabling pg triggers)
 enable_triggers(pgdb)
 pgdb.commit()
 logging.debug(Migration done)

 When I run migrate_to_pg I don't have any kind of error but the PosgreSQL 
 db still empty.

 Someone can give me a help, or another solution for this migration?
 I think it's necessary for web2py having a tool for this migration, 
 giving an easy way for fresh web2py users like me that understand that they 
 must migrate some existing applications to PostgreSQL to do it without 
 headaches.

 Thanks, regards.



-- 
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: mod_wsgi error caused (maybe) by css transferred with MIME type text/plain

2015-03-31 Thread Jim S
What versions of Apache and mod-wsgi?  32 bit or 64 bit?

-Jim

On Tuesday, March 31, 2015 at 3:34:28 PM UTC-5, Niphlod wrote:

 web2py appends a X-Powered-By : web2py header.

 On Tuesday, March 31, 2015 at 10:27:25 PM UTC+2, weheh wrote:

 How do I figure out whether web2py is serving the css files?

 On Tuesday, March 31, 2015 at 12:39:00 AM UTC-7, Niphlod wrote:

 aside from the fact that that config is uber-simple and not what web2py 
 ships usually. who is serving css's ? apache or web2py ?

 On Tuesday, March 31, 2015 at 7:05:25 AM UTC+2, weheh wrote:

 Thanks, Brian. My page does have a lot of ajax calls. The problem seems 
 to be that some of my css files aren't coming through. Firebug says 
 they're 
 being delivered as text/plain instead of text/css. Consequently, the page 
 load incorrectly and users probably bail, causing the IO Error in 
 mod_wsgi. 
 Have you had the css file problem? Here's the actual Firebug error message:

 Resource interpreted as Stylesheet but transferred with MIME type 
 text/plain: https://www.myapp.com/myapp/static/css/web2py.css;.



-- 
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: mod_wsgi error caused (maybe) by css transferred with MIME type text/plain

2015-03-31 Thread Dave S


On Tuesday, March 31, 2015 at 1:34:28 PM UTC-7, Niphlod wrote:

 web2py appends a X-Powered-By : web2py header.


I'm thinking you are saying that is put into the css file's response 
header; what's the best way to see that?   Firefox's developer tool doesn't 
show headers in the CSS tab, and in the network tab I see just 
Connection:, Content-Type:, Date:, and Server: (which is Rocket for 
my case).

The httpserver.log file for my Web2Py instance does show GET requests for 
the CSS files.

/dps still wet behind the ears


 On Tuesday, March 31, 2015 at 10:27:25 PM UTC+2, weheh wrote:

 How do I figure out whether web2py is serving the css files?

 On Tuesday, March 31, 2015 at 12:39:00 AM UTC-7, Niphlod wrote:

 aside from the fact that that config is uber-simple and not what web2py 
 ships usually. who is serving css's ? apache or web2py ?

 On Tuesday, March 31, 2015 at 7:05:25 AM UTC+2, weheh wrote:

 Thanks, Brian. My page does have a lot of ajax calls. The problem seems 
 to be that some of my css files aren't coming through. Firebug says 
 they're 
 being delivered as text/plain instead of text/css. Consequently, the page 
 load incorrectly and users probably bail, causing the IO Error in 
 mod_wsgi. 
 Have you had the css file problem? Here's the actual Firebug error message:

 Resource interpreted as Stylesheet but transferred with MIME type 
 text/plain: https://www.myapp.com/myapp/static/css/web2py.css;.



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


[web2py] web2py.com is down

2015-03-31 Thread Jim S
Something went wrong :-( 

This website is hosted by PythonAnywhere, an online hosting environment. 
Something went wrong while trying to load it; please try again later. 
 
If this is your PythonAnywhere-hosted site, there may be a bug in your 
code. Check your site's server and error logs for any messages — you can 
view them from the Web tab https://www.pythonanywhere.com/web_app_setup/ 
inside PythonAnywhere. 

You'll find a series of tips on how to debug problems, and solutions to 
common issues on our Help pages https://www.pythonanywhere.com/wiki/ 

If you get completely stuck, then drop us a line at 
supp...@pythonanywhere.com, in the forums, or using the Send feedback 
link on the site, quoting the error code below. 
 
Error code: Unhandled Exception 


Just making sure someone is aware of it...


-- 
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.com is down

2015-03-31 Thread Dave S


On Tuesday, March 31, 2015 at 1:48:02 PM UTC-7, Jim S wrote:

 Something went wrong :-(


I get the same screen at the moment, from Southern California.

FWIW, I have a site monitored by Uptime Robot; I got a notification in 
January, for an outage of an hour-and-a-half.
URL:http://www.uptimerobot.com
I'm sure there are other services with similar capability out there.

/dps



 

  This website is hosted by PythonAnywhere, an online hosting environment. 
 Something went wrong while trying to load it; please try again later. 
  
 If this is your PythonAnywhere-hosted site, there may be a bug in your 
 code. Check your site's server and error logs for any messages — you can 
 view them from the Web tab https://www.pythonanywhere.com/web_app_setup/ 
 inside PythonAnywhere. 

 You'll find a series of tips on how to debug problems, and solutions to 
 common issues on our Help pages https://www.pythonanywhere.com/wiki/ 

 If you get completely stuck, then drop us a line at 
 sup...@pythonanywhere.com javascript:, in the forums, or using the 
 Send feedback link on the site, quoting the error code below. 
  
 Error code: Unhandled Exception 


 Just making sure someone is aware of it...




-- 
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: mod_wsgi error caused (maybe) by css transferred with MIME type text/plain

2015-03-31 Thread Niphlod
You need to activate the Net tab ... you're probably inspecting a 304 
response, which doesn't carry the header: hit ctrl+f5 to erase the cache 
and refresh the page.

this is what it returns on my system

Cache-ControlprivateConnectionkeep-aliveContent-Length117305Content-Typetext/css;
 
charset=utf-8DateTue, 31 Mar 2015 21:06:50 GMTLast-ModifiedMon, 16 Mar 2015 
07:42:10 GMTPragmacacheServerRocket 1.2.6 Python/2.7.8X-Powered-Byweb2py

On Tuesday, March 31, 2015 at 10:54:09 PM UTC+2, Dave S wrote:



 On Tuesday, March 31, 2015 at 1:34:28 PM UTC-7, Niphlod wrote:

 web2py appends a X-Powered-By : web2py header.


 I'm thinking you are saying that is put into the css file's response 
 header; what's the best way to see that?   Firefox's developer tool doesn't 
 show headers in the CSS tab, and in the network tab I see just 
 Connection:, Content-Type:, Date:, and Server: (which is Rocket for 
 my case).

 The httpserver.log file for my Web2Py instance does show GET requests 
 for the CSS files.

 /dps still wet behind the ears


 On Tuesday, March 31, 2015 at 10:27:25 PM UTC+2, weheh wrote:

 How do I figure out whether web2py is serving the css files?

 On Tuesday, March 31, 2015 at 12:39:00 AM UTC-7, Niphlod wrote:

 aside from the fact that that config is uber-simple and not what web2py 
 ships usually. who is serving css's ? apache or web2py ?

 On Tuesday, March 31, 2015 at 7:05:25 AM UTC+2, weheh wrote:

 Thanks, Brian. My page does have a lot of ajax calls. The problem 
 seems to be that some of my css files aren't coming through. Firebug says 
 they're being delivered as text/plain instead of text/css. Consequently, 
 the page load incorrectly and users probably bail, causing the IO Error 
 in 
 mod_wsgi. Have you had the css file problem? Here's the actual Firebug 
 error message:

 Resource interpreted as Stylesheet but transferred with MIME type 
 text/plain: https://www.myapp.com/myapp/static/css/web2py.css;.



-- 
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: mod_wsgi error caused (maybe) by css transferred with MIME type text/plain

2015-03-31 Thread Brian M
Mine shows this for a css file

HTTP/1.1 200 OK
Date: Tue, 31 Mar 2015 21:30:03 GMT
Server: Apache/2.2.22 (Win32) mod_wsgi/3.3 Python/2.7.2
Content-Length: 2961
X-Powered-By: web2py
Last-Modified: Sat, 15 Mar 2014 03:13:58 GMT
Pragma: cache
Cache-Control: private
X-UA-Compatible: IE=edge
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/css; charset=utf-8



I've got Apache configured per the Windows section in the web2py book. 
(Which incidentally appears to be down at the moment)

-Brian

On Tuesday, March 31, 2015 at 4:09:53 PM UTC-5, Niphlod wrote:

 You need to activate the Net tab ... you're probably inspecting a 304 
 response, which doesn't carry the header: hit ctrl+f5 to erase the cache 
 and refresh the page.

 this is what it returns on my system

 Cache-ControlprivateConnectionkeep-aliveContent-Length117305Content-Typetext/css;
  
 charset=utf-8DateTue, 31 Mar 2015 21:06:50 GMTLast-ModifiedMon, 16 Mar 
 2015 07:42:10 GMTPragmacacheServerRocket 1.2.6 Python/2.7.8X-Powered-By
 web2py

 On Tuesday, March 31, 2015 at 10:54:09 PM UTC+2, Dave S wrote:



 On Tuesday, March 31, 2015 at 1:34:28 PM UTC-7, Niphlod wrote:

 web2py appends a X-Powered-By : web2py header.


 I'm thinking you are saying that is put into the css file's response 
 header; what's the best way to see that?   Firefox's developer tool doesn't 
 show headers in the CSS tab, and in the network tab I see just 
 Connection:, Content-Type:, Date:, and Server: (which is Rocket for 
 my case).

 The httpserver.log file for my Web2Py instance does show GET requests 
 for the CSS files.

 /dps still wet behind the ears


 On Tuesday, March 31, 2015 at 10:27:25 PM UTC+2, weheh wrote:

 How do I figure out whether web2py is serving the css files?

 On Tuesday, March 31, 2015 at 12:39:00 AM UTC-7, Niphlod wrote:

 aside from the fact that that config is uber-simple and not what 
 web2py ships usually. who is serving css's ? apache or web2py ?

 On Tuesday, March 31, 2015 at 7:05:25 AM UTC+2, weheh wrote:

 Thanks, Brian. My page does have a lot of ajax calls. The problem 
 seems to be that some of my css files aren't coming through. Firebug 
 says 
 they're being delivered as text/plain instead of text/css. Consequently, 
 the page load incorrectly and users probably bail, causing the IO Error 
 in 
 mod_wsgi. Have you had the css file problem? Here's the actual Firebug 
 error message:

 Resource interpreted as Stylesheet but transferred with MIME type 
 text/plain: https://www.myapp.com/myapp/static/css/web2py.css;.



-- 
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] update table as boolean.

2015-03-31 Thread archana subramanyam
Hi
When i click on check box and confirm button ...the db with colo 'X' must 
get updated to true (if checkbox is checked),else updted to false(if 
checkbox not checked and on submitting form).

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


[web2py] Re: Table Migration on GAE

2015-03-31 Thread Sébastien Loix
I just downloaded and tested the latest source for testers on GAE.

Migration does work perfectly for the tables inside the models but still 
does not work for the auth.settings.extra_fields['auth_user'] = 
(...Fields)
It is no big deal for me as I have installed phpMyAdmin (as an app version) 
and manually created the extra field for auth_user table but just so you 
know it.

Thanks for the update!

 

On Saturday, 28 March 2015 17:29:24 UTC+1, Massimo Di Pierro wrote:

 http://web2py.com/examples/default/download

 On Saturday, 28 March 2015 11:14:44 UTC-5, Sébastien Loix wrote:

 Hello Massimo,
 Where can I find the version for tester?
 Also I am using SQL with MySQL with GAE through Cloud SQL, so the 
 check_reserved keywords is necessary right?

 Once I have the new version I will test it and report here.
 Thanks


 El martes, 24 de marzo de 2015, 17:32:09 (UTC+1), Massimo Di Pierro 
 escribió:

 I spoke too soon. Please wait I post a new version for testers. I will 
 email this list.
 Then try:

 db = DAL('google:sql://[app-name]:[db-name]/[table-name]')
 ...
 auth.settings.extra_fields['auth_user'] = [Field('username_fb', 
 length=128, default=, unique=True, writable=False, readable=False)]
 auth.define_tables(username=False, signature=False)

 consider that migrate_enabled is true by default so no need to set it. 
 Also the check_reserved keywords is designed for SQL and not GAE. It does 
 not hurt but it is not necessary. I do not swear by lazy_table because they 
 have some caveats. Let's try without that.

 Can you help us check if this work? If, not what behaviour do you see? 
 Do you get a traceback?


 On Tuesday, 24 March 2015 11:18:06 UTC-5, Sébastien Loix wrote:

 Thank you for the answer.
 Could you explain a bit more the there are no migrations on GAE, is 
 it only for the actual version and the fixed version will solve it?
 I realised that I am using the 2.10.0-beta version of web2py. The one 
 downloaded from the main download page.
 Thanks for the help

 El martes, 24 de marzo de 2015, 8:31:51 (UTC+1), Massimo Di Pierro 
 escribió:

 1) there are no migrations on GAE, web2py will still create .table 
 files but they serve no purpose.
 2) GAE support is broken in 2.9.12. It works in trunk pydal and we 
 will released a fixed version this week

 On Monday, 23 March 2015 21:53:04 UTC-5, Sébastien Loix wrote:

 Hi,

 I am having difficulties with table migration on GAE.

 I deployed perfectly in the Google App Engine and everything is 
 working fine.

 I then needed to make some change in the auth_user adding some extra 
 field but when I deploy again the new version, the migration doesn't 
 occur 
 and the new column is not created.

 Here is the code used:

 db = DAL('google:sql://[app-name]:[db-name]/[table-name]', 
 migrate_enabled=True, check_reserved=['all'], lazy_tables=True)

 then below:

 auth.settings.extra_fields['auth_user'] = [Field('username_fb', 
 length=128, default=, unique=True, writable=False, readable=False)]
 auth.define_tables(username=False, signature=False, migrate=True)

 Any idea why the migration doesn't occur?

 Is there a way to force web2py to do migration somehow?

 Thanks for the help!
 Best,
 Sebastian



-- 
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] sorting ip address

2015-03-31 Thread Matheus Suffi
Hello,

im trying to sort an IP adddres list, this is the only result i getting
192.168.1.1
192.168.1.10
192.168.1.11

i want to list in that order:
192.168.1.1
192.168.1.2
192.168.1.3
192.168.1.4

Any ideias ?

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


Re: [web2py] Re: RuntimeError: table appears corrupted

2015-03-31 Thread James O' Driscoll
I had the same problem today.

Had server running for less than a month, the table was from SQLITE.

I am looking for preventative measures rather than reactionary.

Regards,
James 

On Thursday, July 11, 2013 at 9:23:18 PM UTC+10, Tomek Krasuski wrote:

 THX.



 W dniu sobota, 29 grudnia 2012 06:48:51 UTC+1 użytkownik Richard Penman 
 napisał:

 These work: 
 DAL(uri, migrate=False, fake_migrate=False) 
 DAL(uri, migrate=False, fake_migrate=True) 

 These produce Runtime error: 
 DAL(uri, migrate=True, fake_migrate=False) 
 DAL(uri, migrate=True, fake_migrate=True) 



-- 
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] Deployment Recipe Web2Py on PythonAnywhere

2015-03-31 Thread NeoToren
I have summarized my deployment recipe to PythonAnywhere:

http://www.icd10doc.com/init/recipes/DeployWeb2PyPythonAnywhere

Hope it helps.
NeoToren

-- 
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: PythonAnywhere performance is significantly slower than locally

2015-03-31 Thread NeoToren
PythonAnywhere took care of it...
Some rogue processes on their behalf 
Now everything is working great and I am happy as a clam on high-tide
Thanks
NeoToren

On Saturday, March 21, 2015 at 4:21:40 PM UTC-4, NeoToren wrote:

 My website is using MySQL and consists mostly of queries and simple 
 display of textual results. No images or fancy CSS.

 Locally, queries response time is *sub second*.
 Deployed to PythonAnywhere (using the couple of basic efficiency tricks in 
 the book) - and the same queries may take *7-8 seconds each !*
 PA support mentioned that inefficiencies in my code, which are not evident 
 locally may become an issue on the network.
 Ok...what kind of inefficiencies should I look for ? 

 Any ideas how I can improve the performance when hosted at PythonAnywhere 
 ? 
 Anybody experienced similar issues ?

 Thanks



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


[web2py] Re: SQL designer still not working

2015-03-31 Thread gb
Not sure exactly what you mean, but you can use this and select to export 
to web2py DAL:

https://code.google.com/p/wwwsqldesigner/
(I've ported it here)
https://github.com/borng/wwwsqldesigner

Live Demo:
http://ondras.zarovi.cz/sql/demo/

On Sunday, March 29, 2015 at 11:31:50 AM UTC-6, Ron Chatterjee wrote:

 After so long SQL designer still not working. Not only it doesn't 
 generate the DAL tables/field. There are no option for import/export 
 either. Would be nice to have an import function so we can input XML (at 
 least) and convert that into DAL. Any reason why its being held up? Any 
 timeframe when it will be fixed? 

 Its kind of was a nice feature to have for web2py. Specially the import, 
 export...saves lot of time! I know its not part of web2py community but 
 rather a 3rd party development. But would be nice to have a feature. Wish I 
 had enough info to fix. 


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


[web2py] web2py 2.10.1 is OUT

2015-03-31 Thread Massimo Di Pierro
- welcome app defaults to Bootstrap 3
- DAL - pyDAL (thanks Giovanni, Niphlod, Paolo)
  - new modular dal
  - fixed problems with GAE support
  - moved to full NDB support
  - improved connection pooling logic
- optional cache.ram.max_ram_utilization = 90 (experimental)
- improved cache.disk logic (thanks Niphlod and Leonel)
- lots of pep8 improvements, thanks Richard
- added support for email attchments when auth.settings.server='gae'
- fixed app.yaml.example for GAE
- fixed many small issues
- many many more tests (thanks Giovanni, Niphlod, Paolo)
- upgrading static libraries (bootstrap, codemirror, jquery, etc)

-- 
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: mod_wsgi error caused (maybe) by css transferred with MIME type text/plain

2015-03-31 Thread weheh
How do I figure out whether web2py is serving the css files?

On Tuesday, March 31, 2015 at 12:39:00 AM UTC-7, Niphlod wrote:

 aside from the fact that that config is uber-simple and not what web2py 
 ships usually. who is serving css's ? apache or web2py ?

 On Tuesday, March 31, 2015 at 7:05:25 AM UTC+2, weheh wrote:

 Thanks, Brian. My page does have a lot of ajax calls. The problem seems 
 to be that some of my css files aren't coming through. Firebug says they're 
 being delivered as text/plain instead of text/css. Consequently, the page 
 load incorrectly and users probably bail, causing the IO Error in mod_wsgi. 
 Have you had the css file problem? Here's the actual Firebug error message:

 Resource interpreted as Stylesheet but transferred with MIME type 
 text/plain: https://www.myapp.com/myapp/static/css/web2py.css;.



-- 
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: mod_wsgi error caused (maybe) by css transferred with MIME type text/plain

2015-03-31 Thread Niphlod
web2py appends a X-Powered-By : web2py header.

On Tuesday, March 31, 2015 at 10:27:25 PM UTC+2, weheh wrote:

 How do I figure out whether web2py is serving the css files?

 On Tuesday, March 31, 2015 at 12:39:00 AM UTC-7, Niphlod wrote:

 aside from the fact that that config is uber-simple and not what web2py 
 ships usually. who is serving css's ? apache or web2py ?

 On Tuesday, March 31, 2015 at 7:05:25 AM UTC+2, weheh wrote:

 Thanks, Brian. My page does have a lot of ajax calls. The problem seems 
 to be that some of my css files aren't coming through. Firebug says they're 
 being delivered as text/plain instead of text/css. Consequently, the page 
 load incorrectly and users probably bail, causing the IO Error in mod_wsgi. 
 Have you had the css file problem? Here's the actual Firebug error message:

 Resource interpreted as Stylesheet but transferred with MIME type 
 text/plain: https://www.myapp.com/myapp/static/css/web2py.css;.



-- 
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 web2py is good for below requirements?

2015-03-31 Thread Massimo Di Pierro


On Saturday, 28 March 2015 11:14:44 UTC-5, Anandhakumar Radhakrishnan wrote:

 Hi,


 I have planned to create a website with certain requirement please tell 
 whether this will support in web2py.

 1. Dynamic Page


yes. That is what we do best but you may want to complete with a client 
side JS.
 

 2. Multi Vendors like olx.com


http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Common-fields-and-multi-tenancy

3. Email Services 


http://web2py.com/books/default/chapter/29/08
 

 4. Comparison charts


I suggest http://www.chartjs.org/ (works with web2py as well as any other 
framework).
 


 And please tell why the web2py is best compare to other frame works in 
 python.


-- 
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 web2py is good for below requirements?

2015-03-31 Thread Massimo Di Pierro


On Saturday, 28 March 2015 11:14:44 UTC-5, Anandhakumar Radhakrishnan wrote:

 Hi,


 I have planned to create a website with certain requirement please tell 
 whether this will support in web2py.

 1. Dynamic Page
 2. Multi Vendors like olx.com
 3. Email Services 
 4. Comparison charts

 And please tell why the web2py is best compare to other frame works in 
 python.


http://www.infoworld.com/article/2622836/application-development/pillars-of-python--six-python-web-frameworks-compared.html
 



-- 
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: SQLite: select within transaction

2015-03-31 Thread Niphlod
you're basically asking for a select ... for update, that isn't supported 
on many backends. Asking for it in SQLite means locking THE ENTIRE table .

usually you'd mimick what you want (without hurting performances so much) 
with an additional field.


db(db.table.id == x).update(hidden=True)
db.commit()
rec = db.table(x)

and then

rec.anotherfield = f(rec.field)
rec.hidden = False
rec.update_record()
db.commit()
#or
db(db.table.id == x).update(anotherfield=f(rec.field), hidden=False)
db.commit()


On Wednesday, April 1, 2015 at 12:27:34 AM UTC+2, Val K wrote:

 Hi!
 Here is controller's logic:
 1. Get field value: 
   fld_v= db.table[i].any_field

 2. Evaluate new value depending on existing one:   
new_fld_v=fun(fld_v)

 3. Update record with new value: 
db(db.table.id==i).update(any_field=new_fld_v)

 The problem:
 After first step (i.e. after SELECT)  just a SHARED lock is acquired (see 
 SQLite docs).  Thus, any other request can call the same controller and get 
 the same field's value and etc.
 How can I allow sequential calls only to prevent any other's SELECT until 
 UPDATE? I know about BEGIN DEFERRED/IMMEDIATE/EXCLUSIVE, also
 I know web2py enclose all request/controller's calls in something like 
 BEGIN/COMMIT, but  SQLite doesn't support nested BEGIN/COMMIT (except 
 SAVEPOINT).
 What is default isolation_level/locking_mode is realized during web2py 
 request process?
 Is there safe solution or I worry for nothing?




-- 
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: sorting ip address

2015-03-31 Thread Niphlod
use the power, luke! 
aside from various networking libraries out there, the problem is rather 
simple 
what you're getting back is the alphabetical order  .
what you need instead is to sort every triplet as an integer.
In reality, python strings for ip addresses are good enough, if taken 
separately, i.e. 
1 is lower than 10 even if 1 and 10 are strings.

so, to order your ip addresses, you just split every ip address by .

given a list of
 
myips = [
'192.168.4.1',
'192.168.1.10',
'192.168.1.11',
]

what_you_want = sorted(myips, key=lambda x: x.split('.'))

-- 
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: Change the default application to run

2015-03-31 Thread Niphlod
have a look at 
http://web2py.com/books/default/chapter/29/04/the-core#URL-rewrite

On Wednesday, April 1, 2015 at 12:27:11 AM UTC+2, wei zhu wrote:

 Hello Team

 I found the application welcome was set to the default application to 
 run when you just type your_name.pythonanywhere.com. Is there a way to 
 change it to any application I want? and one more question, if you type 
 127.0.0.XXX:8000, it will show 127.0.0.XXX:8000/welcome/default/index, it 
 is OK, but when I use my own domin, it looks like 
 www.my_domin.com/welcome/default/index, it's kind of ugly, it shows three 
 layers there, at least if it only shows www.my_domin.com/welcome. and it 
 will be much better if it only shows like www.my_domin.com, I don't know 
 if it will be possible or not?

 Thanks Wei


-- 
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 2.10.1 is OUT

2015-03-31 Thread Massimo Di Pierro
Also. Thanks to Kathy and Luca for all your GAE tests!

On Tuesday, 31 March 2015 17:26:18 UTC-5, Massimo Di Pierro wrote:

 - welcome app defaults to Bootstrap 3
 - DAL - pyDAL (thanks Giovanni, Niphlod, Paolo)
   - new modular dal
   - fixed problems with GAE support
   - moved to full NDB support
   - improved connection pooling logic
 - optional cache.ram.max_ram_utilization = 90 (experimental)
 - improved cache.disk logic (thanks Niphlod and Leonel)
 - lots of pep8 improvements, thanks Richard
 - added support for email attchments when auth.settings.server='gae'
 - fixed app.yaml.example for GAE
 - fixed many small issues
 - many many more tests (thanks Giovanni, Niphlod, Paolo)
 - upgrading static libraries (bootstrap, codemirror, jquery, etc)



-- 
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: Fixed issue 1422 introduced a bug in generic rss views?

2015-03-31 Thread Carlos Fillol Sendra
Removing str( and .encode('utf-8', 'replace')) strings from rss 
function in gluon.serializers.py seems to solve the issue (at least it 
worked for me).

def rss(feed):
if not 'entries' in feed and 'items' in feed:
feed['entries'] = feed['items']
now = datetime.datetime.now()
rss = rss2.RSS2(title=feed.get('title', '(notitle)'),
link=feed.get('link', None),
description=feed.get('description', ''),
lastBuildDate=feed.get('created_on', now),
items=[rss2.RSSItem(
   title=entry.get('title', '(notitle)'),
   link=entry.get('link', None),
   description=entry.get('description', ''),
   pubDate=entry.get('created_on', now)
   ) for entry in feed.get('entries', [])])
return rss.to_xml(encoding='utf-8')

I'm using web2py 2.9.5 and Python 2.7.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/d/optout.


[web2py] Re: Write dynamic query in DAL without extra nested parentheses

2015-03-31 Thread gb
I have a list of products (much less than 1000) that the users can select 
or unselect--I supposed I could only select on the unselected items.  

If it's above 80 or so sqlite throws class 'sqlite3.OperationalError' 
parser stack overflow, see code below:

db.define_table(product)
query = []
for i in xrange(90):
query.append(db.product.id == i)

query = reduce(lambda a,b:a|b,query)

db(query).select()

However, the suggested code works great! 

query = db.product.id.belongs([list of ids])


Thanks, Anthony!

On Sunday, March 29, 2015 at 12:11:13 PM UTC-6, Niphlod wrote:

 btw: sqlite has a pretty deep default value that should handle 1000 of 
 those or. but or the sake of your app is it reaally necessary to 
 fetch records in a single query asking for 1000 specific values ?

 On Saturday, March 28, 2015 at 6:37:03 PM UTC+1, Anthony wrote:

 In this particular case, you should instead use .belongs():

 query = db.product.id.belongs([list of ids])

 It's an interesting problem, though. A somewhat hackish solution would be:

 query = ' OR '.join(str(db.product.id == i) for i in [list of ids])

 The problem is that OR and AND operators always wrap the operands in 
 parentheses, even when not necessary. The result is the nesting you observe 
 when using reduce() or appending in a loop. Perhaps there should be a way 
 to suppress the parentheses when not needed.

 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] SQLite: select within transaction

2015-03-31 Thread Val K
Hi!
Here is controller's logic:
1. Get field value: 
  fld_v= db.table[i].any_field

2. Evaluate new value depending on existing one:   
   new_fld_v=fun(fld_v)

3. Update record with new value: 
   db(db.table.id==i).update(any_field=new_fld_v)

The problem:
After first step (i.e. after SELECT)  just a SHARED lock is acquired (see 
SQLite docs).  Thus, any other request can call the same controller and get 
the same field's value and etc.
How can I allow sequential calls only to prevent any other's SELECT until 
UPDATE? I know about BEGIN DEFERRED/IMMEDIATE/EXCLUSIVE, also
I know web2py enclose all request/controller's calls in something like 
BEGIN/COMMIT, but  SQLite doesn't support nested BEGIN/COMMIT (except 
SAVEPOINT).
What is default isolation_level/locking_mode is realized during web2py 
request process?
Is there safe solution or I worry for nothing?


-- 
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] Change the default application to run

2015-03-31 Thread wei zhu


Hello Team

I found the application welcome was set to the default application to run 
when you just type your_name.pythonanywhere.com. Is there a way to change 
it to any application I want? and one more question, if you type 
127.0.0.XXX:8000, it will show 127.0.0.XXX:8000/welcome/default/index, it 
is OK, but when I use my own domin, it looks 
like www.my_domin.com/welcome/default/index, it's kind of ugly, it shows 
three layers there, at least if it only shows www.my_domin.com/welcome. and 
it will be much better if it only shows like www.my_domin.com, I don't know 
if it will be possible or not?

Thanks Wei

-- 
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: Write dynamic query in DAL without extra nested parentheses

2015-03-31 Thread Gray Kanarek
You want belongs, I think:

query = db.product.id.belongs((selected_ids))



On Saturday, March 28, 2015 at 12:14:44 PM UTC-4, gb wrote:

 What is the DAL Code to generate a query like this:
 SELECT * FROM product WHERE product.id=1 OR product.id=2 OR product.id=3 
 OR product.id product.id=4 OR product.id=5;
 or even:
 SELECT * FROM product WHERE (product.id=1) OR (product.id=2) OR (
 product.id=3) OR (product.id=4) OR (product.id=5);

 I've tried both the DAL code approaches below and I always end up with 
 crazy parentheses nesting which will eventually crash the DB driver e.g. in 
 sqlite: class 'sqlite3.OperationalError' parser stack overflow

 Is there another way to use the DAL, or is my only option to write the 
 SQL manually?

 db.define_table(product)

 selected_ids = [1,2,3,4,5]
 query = []
 for pid in selected_ids:
 query.append(db.product.id == pid)

 query = reduce(lambda a,b:a|b,query)
 #Ouputs this : (product.id = 1) OR (product.id = 2)) OR (
 product.id = 3)) OR (product.id = 4)) OR (product.id = 5))


 
 selected_ids = [1,2,3,4,5]
 query = []
 for pid in selected_ids:
 query |= db.product.id == pid

 #I get a bonus parenthesis with this method ((product.id = 1) OR 
 ) OR (product.id = 2)) OR (product.id = 3)) OR (product.id = 4)) OR (
 product.id = 5))


-- 
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: sorting ip address

2015-03-31 Thread Niphlod
nope, wrong... sorry, I reaally need some bed time ^_^ 

You NEED to convert triplets to integers before sorting.

no worries though...

what_you_want = sorted(myips, key=lambda x:tuple(map(int, x.split('.'



is the correct one.

-- 
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: mod_wsgi error caused (maybe) by css transferred with MIME type text/plain

2015-03-31 Thread Dave S


On Tuesday, March 31, 2015 at 2:09:53 PM UTC-7, Niphlod wrote:

 You need to activate the Net tab ... you're probably inspecting a 304 
 response, which doesn't carry the header: hit ctrl+f5 to erase the cache 
 and refresh the page.



Ooops.  Some trainer could make a living off me, eh?  yes, I get more when 
I do that.
 


 this is what it returns on my system

 Cache-ControlprivateConnectionkeep-aliveContent-Length117305Content-Typetext/css;
  
 charset=utf-8DateTue, 31 Mar 2015 21:06:50 GMTLast-ModifiedMon, 16 Mar 
 2015 07:42:10 GMTPragmacacheServerRocket 1.2.6 Python/2.7.8X-Powered-By
 web2py


Much like that, in fact.

Thanks for the tip.

Dave
/dps

 

 On Tuesday, March 31, 2015 at 10:54:09 PM UTC+2, Dave S wrote:



 On Tuesday, March 31, 2015 at 1:34:28 PM UTC-7, Niphlod wrote:

 web2py appends a X-Powered-By : web2py header.


 I'm thinking you are saying that is put into the css file's response 
 header; what's the best way to see that?   Firefox's developer tool doesn't 
 show headers in the CSS tab, and in the network tab I see just 
 Connection:, Content-Type:, Date:, and Server: (which is Rocket for 
 my case).

 The httpserver.log file for my Web2Py instance does show GET requests 
 for the CSS files.

 /dps still wet behind the ears


 On Tuesday, March 31, 2015 at 10:27:25 PM UTC+2, weheh wrote:

 How do I figure out whether web2py is serving the css files?

 On Tuesday, March 31, 2015 at 12:39:00 AM UTC-7, Niphlod wrote:

 aside from the fact that that config is uber-simple and not what 
 web2py ships usually. who is serving css's ? apache or web2py ?

 On Tuesday, March 31, 2015 at 7:05:25 AM UTC+2, weheh wrote:

 Thanks, Brian. My page does have a lot of ajax calls. The problem 
 seems to be that some of my css files aren't coming through. Firebug 
 says 
 they're being delivered as text/plain instead of text/css. Consequently, 
 the page load incorrectly and users probably bail, causing the IO Error 
 in 
 mod_wsgi. Have you had the css file problem? Here's the actual Firebug 
 error message:

 Resource interpreted as Stylesheet but transferred with MIME type 
 text/plain: https://www.myapp.com/myapp/static/css/web2py.css;.



-- 
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: 2.10.1 / Windows errors / cache

2015-03-31 Thread Leonel Câmara
Awww dammit we forgot to update the admin module.

I attached an admin.py file you can replace the one in the gluon with to 
get this to work until we make a proper fix.

-- 
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.
#!/usr/bin/env python
# -*- coding: utf-8 -*-


| This file is part of the web2py Web Framework
| Copyrighted by Massimo Di Pierro mdipie...@cs.depaul.edu
| License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)

Utility functions for the Admin application
---

import os
import sys
import traceback
import zipfile
import urllib
from shutil import rmtree
from gluon.utils import web2py_uuid
from gluon.fileutils import w2p_pack, w2p_unpack, w2p_pack_plugin, w2p_unpack_plugin
from gluon.fileutils import up, fix_newlines, abspath, recursive_unlink
from gluon.fileutils import read_file, write_file, parse_version
from gluon.restricted import RestrictedError
from gluon.settings import global_settings
from gluon.cache import CacheOnDisk


if not global_settings.web2py_runtime_gae:
import site


def apath(path='', r=None):
Builds a path inside an application folder

Args:
path(str): path within the application folder
r: the global request object



opath = up(r.folder)
while path[:3] == '../':
(opath, path) = (up(opath), path[3:])
return os.path.join(opath, path).replace('\\', '/')


def app_pack(app, request, raise_ex=False, filenames=None):
Builds a w2p package for the application

Args:
app(str): application name
request: the global request object
Returns:
filename of the w2p file or None on error


try:
if filenames is None: app_cleanup(app, request)
filename = apath('../deposit/web2py.app.%s.w2p' % app, request)
w2p_pack(filename, apath(app, request), filenames=filenames)
return filename
except Exception, e:
if raise_ex:
raise
return False


def app_pack_compiled(app, request, raise_ex=False):
Builds a w2p bytecode-compiled package for the application

Args:
app(str): application name
request: the global request object

Returns:
filename of the w2p file or None on error



try:
filename = apath('../deposit/%s.w2p' % app, request)
w2p_pack(filename, apath(app, request), compiled=True)
return filename
except Exception, e:
if raise_ex:
raise
return None


def app_cleanup(app, request):
Removes session, cache and error files

Args:
app(str): application name
request: the global request object

Returns:
True if everything went ok, False otherwise


r = True

# Remove error files
path = apath('%s/errors/' % app, request)
if os.path.exists(path):
for f in os.listdir(path):
try:
if f[:1] != '.': os.unlink(os.path.join(path, f))
except IOError:
r = False

# Remove session files
path = apath('%s/sessions/' % app, request)
if os.path.exists(path):
for f in os.listdir(path):
try:
if f[:1] != '.': recursive_unlink(os.path.join(path, f))
except IOError:
r = False

# Remove cache files
CacheOnDisk(folder=apath('%s/cache/' % app, request)).clear()
path = apath('%s/cache/' % app, request)
if os.path.exists(path):
for f in os.listdir(path):
try:
if f[:1] != '.': recursive_unlink(os.path.join(path, f))
except IOError:
r = False
return r


def app_compile(app, request):
Compiles the application

Args:
app(str): application name
request: the global request object

Returns:
None if everything went ok, traceback text if errors are found


from compileapp import compile_application, remove_compiled_application
folder = apath(app, request)
try:
compile_application(folder)
return None
except (Exception, RestrictedError):
tb = traceback.format_exc(sys.exc_info)
remove_compiled_application(folder)
return tb


def app_create(app, request, force=False, key=None, info=False):
Create a copy of welcome.w2p (scaffolding) app

Args:
app(str): application name
request: the global request object


path = apath(app, request)
if not os.path.exists(path):
try:
os.mkdir(path)
except:
if