Re: [web2py] Re: web2canvas looks nice

2013-06-11 Thread Jason (spot) Brower
Excited to try this when it's in english.
BR,
Jason


On Mon, Jun 10, 2013 at 5:39 PM, Michael Herman herma...@gmail.com wrote:

 Interesting. There's huge potential for projects like this:

- http://javelinapp.com/ (

 http://pandodaily.com/2013/06/10/javelin-the-lean-startup-app-thats-a-product-of-lean-startup-methodology/
)
-

 http://www.kickstarter.com/projects/jmitchel3/coding-for-entrepreneurs/?ref=kicktraq

 To launch an MVP, it's so much more than coding. That's the easy part in
 my opinion. Plus, once you *find *something and get it validated, there's
 so much of the busy side that you have to focus on that many people tend to
 forget about. Anyway, I think web2py or perhaps Rails would be great for
 just tossing up a landing page, hit it with Adwords and see if the idea
 sticks. I'm writing a blog post on it now and creating a prototype using
 Flask.

 I'd love to hear more about your project and be involved in the
 alpha/beta. You can contact me on here or at mich...@realpython.com.
 Cheers!


 On Sunday, June 9, 2013 7:06:25 PM UTC-7, Gustavo Souza wrote:

 Hello guys, I'm the one responsible for this project, I intend to make it
 multi language, is currently only in Portuguese.


 2013/6/8 samuel bonilla pytho...@gmail.com

 Alan solo me gusta la aplicación, me parece interesante.
 El 09/06/2013 08:32, Alan Etkin spam...@gmail.com escribió:

  wowww. nice LOL


 Do you like it or it makes you laugh? (or both?) Both is fine, although
 rare.

  --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit https://groups.google.com/d/**
 topic/web2py/rfyhvXxtGcY/**unsubscribe?hl=enhttps://groups.google.com/d/topic/web2py/rfyhvXxtGcY/unsubscribe?hl=en
 .
 To unsubscribe from this group and all its topics, send an email to
 web2py+un...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .



  --

 ---
 You received this message because you are subscribed to the Google
 Groups web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to web2py+un...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .






 --
 **
 *
 *
 *Gustavo de Souza Lima*
 gus...@agenciax4.com.br
 DESENVOLVEDOR

 *(21) 2423-4351* (escritório)
 *(21) 8163-0309* (celular)

 Twitter: @dodilei https://twitter.com/dodilei
 Google+: gplus.to/dodilei

 tech4noobs.agenciax4.com.br/

  --

 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] web2py down after adding a table in db.py

2013-06-11 Thread Rocco
Dear all,

it's more than a year that I'm using web2py to develop scientific 
application for marine acoustic data analysis and stock assessment. 
For many years I used LAMP and moving to web2py has been very exciting. I 
saved a lot of developing time, and the products are better in look and 
usability.

But sometime I get some problem that leave me in big trouble.

I'm using web2py in a ubuntu i686 linux, with apache and wsgi module. The 
dbms is postgres/postgis

This time my big error has been to rename a field in a table. After that 
web2py frozed with no ticket, no warning, no messages.
I tried to restart apache, but web2py won't start. Also the welcome app 
gives me a connection timeout.

So I decided to edit manually via ssh the db.py resuming the previous 
version. Web2py restarted with no problem, but when I added a new table, i 
got again the trouble.

What shall I do?





-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] formatting dates as plain english text

2013-06-11 Thread ssuresh
Hi,
What is the preferred approach in converting datetimes to plain english 
text as  2 hours ago, last monday ,1 month ago etc? Are there any 
web2py functions available or is it better to manipulate it using 
javascript libraries like http://momentjs.com/?

regds,
suresh

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: formatting dates as plain english text

2013-06-11 Thread 黄祥
had you already take a look pretty date?

ref:
http://www.web2py.com/book/default/chapter/14#Pretty-dates

best regards

On Tuesday, June 11, 2013 3:43:04 PM UTC+7, ssuresh wrote:

 Hi,
 What is the preferred approach in converting datetimes to plain english 
 text as  2 hours ago, last monday ,1 month ago etc? Are there any 
 web2py functions available or is it better to manipulate it using 
 javascript libraries like http://momentjs.com/?

 regds,
 suresh


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: web2py down after adding a table in db.py

2013-06-11 Thread Rocco

Ok, I solved using 

fake_migrate_all=True

Thanks to Angelo, who helped me :)

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: formatting dates as plain english text

2013-06-11 Thread ssuresh
oops..I somehow missed that.. pretty-dates is what i need..Thanx a lot

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Combining rows

2013-06-11 Thread webpypy

yes, I am sure it is working without as_dict().


Regards,

 Ashraf



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: I have an error with AutocompleteWidget

2013-06-11 Thread Massimo Di Pierro
Fixed now in trunk.

On Monday, 10 June 2013 22:14:34 UTC-5, www.diazluis.com wrote:

 files presented below: 
 controller 
 modules 
 models 
 and throws error 

 controller: 
 ## 
 @auth.requires_login() 
 def update(): 

 ubicacion = db.ubicacion(auth_user=auth_user_id) 

 db.ubicacion.ciudad_pais.widget = SQLFORM.widgets.autocomplete( 
  request, db.ciudad_pais.nombre, min_length=2, id_field=
 db.ciudad_pais.id) 

 if ubicacion is None: 
 form = crud.create(db.ubicacion, next=URL('index')) 
 else: 
 form = crud.update(db.ubicacion, record=ubicacion.id, 
 next=URL('index')) 

 return dict(form=form) 
 ## 



 models/a20_ciudad.py 
 ## 
 # -*- coding: utf-8 -*- 


 from applications.welcome.modules import table_ciudad_pais 

 models_ciudad_pais = table_ciudad_pais.Models(db) 
 models_ciudad_pais.define_table() 
 ## 




 models/a50_ubicacion.py 
 ## 
 # -*- coding: utf-8 -*- 

 from applications.welcome.modules import table_ubicacion 

 models_ubicacion = table_ubicacion.Models(db, auth_user_id) 
 models_ubicacion.define_table() 
 ## 



 modules/table_ciudad_pais.py 
 ### 
 # -*- coding: utf-8 -*- 


 from gluon.dal import Field 
 from gluon import current 
 from gluon.validators import * 
 from gluon.http import redirect 
 from gluon.html import XML, TAG, URL 


 from applications.welcome.modules import app_function 


 class Models(object): 


 def __init__(self, db, migrate=True): 
 self.request = current.request 
 self.session = current.session 
 self.dominio = current.request.env.http_host 

 self.m_function = app_function.App_function() 

 self.db = db 

 self.ciudad_pais = None 
 self.bloqueo = False 

 self.migrate = migrate 




 def define_table(self): 

 self.db.define_table('ciudad_pais', 

 Field('f_id', 'string', writable=False), 
 Field('nombre', 'string', writable=False), 

 migrate=self.migrate, 

 format = '%(nombre)s' 
 ) 


 #label 



 def chequeo(self, location): 
 self.location = location 
 self.db.ciudad_pais.update_or_insert(f_id=self.location['id'], 
 nombre=self.location['name']) 
 self.ciudad_pais = self.db.ciudad_pais(f_id=self.location['id']) 
 return self.ciudad_pais 

 # 


 modules/table_ubicacion.py 
 ### 
 # -*- coding: utf-8 -*- 


 from gluon.dal import Field 
 from gluon import current 
 from gluon.validators import * 
 from gluon.sqlhtml import SQLFORM 

 from applications.welcome.modules import app_function 
 from applications.welcome.modules import app_var 
 from applications.welcome.modules import facebook as Facebook 

 from datetime import time 


 class Models(object): 


 def __init__(self, db, usuario_id, migrate=True): 
 self.request = current.request 
 self.session = current.session 

 self.m_var = app_var.App_var() 
 self.m_function = app_function.App_function() 

 self.db = db 

 self.auth_user_id = usuario_id 

 self.migrate = migrate 

 self.bloqueo = None 


 def define_table(self): 

 self.db.define_table('ubicacion', 
 Field('ciudad_pais', self.db.ciudad_pais), 
 Field('zona', self.db.zona, writable=False, readable=False), 
 Field('tlf', 'string'), 
 Field('fecha_update', 'datetime', 
 default=self.request.now, readable=False, writable=False), 

 Field('auth_user', self.db.auth_user, 
 default=self.auth_user_id, writable=False, readable=False), 

 migrate=self.migrate, 

 #format = lambda row: ('%s') % (row.fprofile['first_name']) 
 ) 

 #requires 
 self.db.ubicacion.ciudad_pais.requires = IS_IN_DB(self.db, 
 'ciudad_pais.id', self.db.ciudad_pais._format, zero=None) 
 self.db.ubicacion.tlf.requires = [ 
 IS_EMPTY_OR( 
 IS_LENGTH(maxsize=32, minsize=10) 
 ) 
 ] 
  


 ERROR: 
 ### 
 Traceback (most recent call last): 
   File /home/diazluis2007/vps/gluon/restricted.py, line 212, in 
 restricted 
 exec ccode in environment 
   File 
 /home/diazluis2007/vps/applications/welcome/controllers/ubicacion.py, 
 line 32, in module 
   File /home/diazluis2007/vps/gluon/globals.py, line 194, in lambda 
 self._caller = lambda f: f() 
   File /home/diazluis2007/vps/gluon/tools.py, line 3022, in f 
 return action(*a, **b) 
   File 
 /home/diazluis2007/vps/applications/welcome/controllers/ubicacion.py, 
 line 22, in update 
 request, db.ciudad_pais.nombre, min_length=2, 
 id_field=db.ciudad_pais.id, help_fields=None) 
   File /home/diazluis2007/vps/gluon/sqlhtml.py, line 673, in __init__ 
 self.callback() 
   File /home/diazluis2007/vps/gluon/sqlhtml.py, line 683, in callback 
 rows = 

[web2py] d3.js stays in view even after selecting menu change

2013-06-11 Thread greaneym
I am learning D3 to use it in an app for visualization but having problems 
with multiple graphs loading when I only want one to show per menu 
selection.

Using the bootstrap welcome app, I am able to load d3 examples using a 
tabbable nav menu, however, once loaded they do not go away between 
clicking tabs.

Is the javascript functionality (below) to unload a default in web2py or do 
I have to put
some code in to force an unload inbetween selections of the tab menu?

body onunload=SomeJavaScriptCode
window.onunload=function(){SomeJavaScriptCode};

I've also tried the following,

1. use a controller function that uses redirect to a url as in Massimo's 
Processing JS example, but that effect then loses the ability to use the 
tab menu.


2. instead of LOAD ing paths, I made the D3 views into files.js and LOADed 
those but the behavior is still the same. The graphs load but don't 
disappear between tab selections, or some of them do not.
(http://stackoverflow.com/questions/14389974/how-do-i-get-different-tabs-to-load-separate-javascript-files)

There are likely many ways to do this, but I haven't been successful yet at 
finding an answer.

Thanks for any help.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] d3.js stays in view even after selecting menu change

2013-06-11 Thread António Ramos
I had problems also with fullcalendar inside twitter bootstrap tabs
The fullcalendar only works in the first tab. Moving it to next tabs bring
problems


2013/6/11 greaneym grean...@gmail.com

 I am learning D3 to use it in an app for visualization but having problems
 with multiple graphs loading when I only want one to show per menu
 selection.

 Using the bootstrap welcome app, I am able to load d3 examples using a
 tabbable nav menu, however, once loaded they do not go away between
 clicking tabs.

 Is the javascript functionality (below) to unload a default in web2py or
 do I have to put
 some code in to force an unload inbetween selections of the tab menu?

 body onunload=SomeJavaScriptCode
 window.onunload=function(){SomeJavaScriptCode};

 I've also tried the following,

 1. use a controller function that uses redirect to a url as in Massimo's
 Processing JS example, but that effect then loses the ability to use the
 tab menu.


 2. instead of LOAD ing paths, I made the D3 views into files.js and LOADed
 those but the behavior is still the same. The graphs load but don't
 disappear between tab selections, or some of them do not.
 (
 http://stackoverflow.com/questions/14389974/how-do-i-get-different-tabs-to-load-separate-javascript-files
 )

 There are likely many ways to do this, but I haven't been successful yet
 at finding an answer.

 Thanks for any help.

  --

 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] d3.js stays in view even after selecting menu change

2013-06-11 Thread Niphlod
usually with tabs you have to re-initiate your something as soon as the 
tab is shown because the element is hidden when the onload event is fired 
when loading the page.
This happens, e.g., with google maps loaded in query ui tabs, so probably 
d3 has the same exact issue.

Il giorno martedì 11 giugno 2013 16:55:54 UTC+2, Ramos ha scritto:

 I had problems also with fullcalendar inside twitter bootstrap tabs
 The fullcalendar only works in the first tab. Moving it to next tabs bring 
 problems


 2013/6/11 greaneym grea...@gmail.com javascript:

 I am learning D3 to use it in an app for visualization but having 
 problems with multiple graphs loading when I only want one to show per menu 
 selection.

 Using the bootstrap welcome app, I am able to load d3 examples using a 
 tabbable nav menu, however, once loaded they do not go away between 
 clicking tabs.

 Is the javascript functionality (below) to unload a default in web2py or 
 do I have to put
 some code in to force an unload inbetween selections of the tab menu?

 body onunload=SomeJavaScriptCode
 window.onunload=function(){SomeJavaScriptCode};

 I've also tried the following,

 1. use a controller function that uses redirect to a url as in Massimo's 
 Processing JS example, but that effect then loses the ability to use the 
 tab menu.


 2. instead of LOAD ing paths, I made the D3 views into files.js and 
 LOADed those but the behavior is still the same. The graphs load but don't 
 disappear between tab selections, or some of them do not.
 (
 http://stackoverflow.com/questions/14389974/how-do-i-get-different-tabs-to-load-separate-javascript-files
 )

 There are likely many ways to do this, but I haven't been successful yet 
 at finding an answer.

 Thanks for any help.

  -- 
  
 --- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to web2py+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  




-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Session object gets written even when there is no change in the content

2013-06-11 Thread Aravindan Rs
Hi,

We use web2py in GAE environment and during our performance tuning we 
realized that session objects are getting written in every request - even 
in requests which do not modify the session object. I raised an issue 
regarding this in the web2py issue tracker where I've provided details (
https://code.google.com/p/web2py/issues/detail?id=1524). After some 
debugging I realized that actual session object does not change but the 
pickled string changes each time (e.g. order of items is not guaranteed in 
a dictionary) resulting is different hash each time which in turn results 
in the object being written to DB each time.

Most of my requests does not write to the session object - still every 
request results in write to session table. This impacts my system 
performance adversely + incurs higher cost as GAE charges for every DB 
read/write.

I think it is a difficult problem for web2py to solve - I assume I have to 
find a workaround in my code.

I'm thinking of using session.forget() in the right places. I know the code 
places where I write to session object. I assume web2py code writes to 
session object in login, logout and possibly few other authentication 
related flows. Are there other places to take care of? 

Is there a more elegant solution to my problem?

Thanks and regards,
Aravind.

PS: Though one can implement the above solution with just forget method - 
I would have loved also to have unforget method - I could have simply 
said forget() in one of the model files and unforget() in every place there 
is write to session object. 

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Session object gets written even when there is no change in the content

2013-06-11 Thread Derek
I don't think it would be too difficult to solve. Just use an 'OrderedDict' 
instead of a regular dict.

http://docs.python.org/2/library/collections.html#collections.OrderedDict

On Tuesday, June 11, 2013 9:21:21 AM UTC-7, Aravindan Rs wrote:

 Hi,

 We use web2py in GAE environment and during our performance tuning we 
 realized that session objects are getting written in every request - even 
 in requests which do not modify the session object. I raised an issue 
 regarding this in the web2py issue tracker where I've provided details (
 https://code.google.com/p/web2py/issues/detail?id=1524). After some 
 debugging I realized that actual session object does not change but the 
 pickled string changes each time (e.g. order of items is not guaranteed in 
 a dictionary) resulting is different hash each time which in turn results 
 in the object being written to DB each time.

 Most of my requests does not write to the session object - still every 
 request results in write to session table. This impacts my system 
 performance adversely + incurs higher cost as GAE charges for every DB 
 read/write.

 I think it is a difficult problem for web2py to solve - I assume I have to 
 find a workaround in my code.

 I'm thinking of using session.forget() in the right places. I know the 
 code places where I write to session object. I assume web2py code writes to 
 session object in login, logout and possibly few other authentication 
 related flows. Are there other places to take care of? 

 Is there a more elegant solution to my problem?

 Thanks and regards,
 Aravind.

 PS: Though one can implement the above solution with just forget method 
 - I would have loved also to have unforget method - I could have simply 
 said forget() in one of the model files and unforget() in every place there 
 is write to session object. 



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Session object gets written even when there is no change in the content

2013-06-11 Thread Derek
To add on a bit more to this...
it appears the hash is calculated by doing an md5 of the globals digest. 
However, it appears the 'update or insert' logic is strange. Line 555 of 
globals.py adds request.now to the modified_datetime, so in this case, 
wouldn't it always insert and never update?
In any case, I think maybe this will help...
editing storage.py, change the PickleableStorage to this...

def PickleableStorage(data):
return Storage(dict(sorted((k,v) for (k,v) in data.items() if 
isinstance(v,PICKABLE), key=lambda t: t[0])))

I haven't tested it, but the idea is to sort it by key first...

On Tuesday, June 11, 2013 9:46:36 AM UTC-7, Derek wrote:

 I don't think it would be too difficult to solve. Just use an 
 'OrderedDict' instead of a regular dict.

 http://docs.python.org/2/library/collections.html#collections.OrderedDict

 On Tuesday, June 11, 2013 9:21:21 AM UTC-7, Aravindan Rs wrote:

 Hi,

 We use web2py in GAE environment and during our performance tuning we 
 realized that session objects are getting written in every request - even 
 in requests which do not modify the session object. I raised an issue 
 regarding this in the web2py issue tracker where I've provided details (
 https://code.google.com/p/web2py/issues/detail?id=1524). After some 
 debugging I realized that actual session object does not change but the 
 pickled string changes each time (e.g. order of items is not guaranteed in 
 a dictionary) resulting is different hash each time which in turn results 
 in the object being written to DB each time.

 Most of my requests does not write to the session object - still every 
 request results in write to session table. This impacts my system 
 performance adversely + incurs higher cost as GAE charges for every DB 
 read/write.

 I think it is a difficult problem for web2py to solve - I assume I have 
 to find a workaround in my code.

 I'm thinking of using session.forget() in the right places. I know the 
 code places where I write to session object. I assume web2py code writes to 
 session object in login, logout and possibly few other authentication 
 related flows. Are there other places to take care of? 

 Is there a more elegant solution to my problem?

 Thanks and regards,
 Aravind.

 PS: Though one can implement the above solution with just forget method 
 - I would have loved also to have unforget method - I could have simply 
 said forget() in one of the model files and unforget() in every place there 
 is write to session object. 



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: using _after_delete callback when enable_record_versioning() is used

2013-06-11 Thread Lamps902
Thanks, Anthony - forgot about the _after_update callback. Could you please 
clarify how to use it in this situation? I was trying this:

def create_after_update_callback(self, db, id):

def update_mytable1_record(s, f, id): 
  if not db(db.auth_user.id == 
id).is_active:   
# perform updates on table

db.auth_user._after_update.append(lambda s, f: 
update_mytable1_record(s=s, f=f, id = id))

Any attempts to select()/inspect the table row being deleted, whether 
through the set object (s) or the auth_user table, result in a list index 
out of range error (I guess I can't access the object as a result of 
is_active being set to False?).


On Monday, June 10, 2013 10:31:24 PM UTC-5, Anthony wrote:

 Can you use the _after_update callback instead?

 On Monday, June 10, 2013 5:32:12 PM UTC-4, Lamps902 wrote:

 When enable_record_versioning is being utilized, db rows aren't actually 
 deleted, but the is_active bit is flipped off instead. As far as I can 
 tell, this means that the _after_delete callback for a given table won't be 
 called, which is problematic when you are using this callback to 
 delete/flip off 'is active' bits of associated rows in other tables. Is 
 there any convenient way around this, or will it simply be necessary to 
 forgo the callback, and flip the is_active bit of associated records in 
 other tables manually by performing an update() when deleting a record?



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Session object gets written even when there is no change in the content

2013-06-11 Thread Niphlod
strange that nobody reported issue with that before. @derek: 
unfortunately, every nested structure would need to be ordered to produce 
the same string. pickle just states that the object that you dump is the 
same one that you load, i.e. dict1 == dict2, but doesn't guarantee that the 
serialization format is always the same for equal objects.

PS: neds to be tested apparently deepcopying the object before 
dumps-ing it result in the exact same serialization. Don't know if it's a 
viable way.

On Tuesday, June 11, 2013 8:01:33 PM UTC+2, Derek wrote:

 To add on a bit more to this...
 it appears the hash is calculated by doing an md5 of the globals digest. 
 However, it appears the 'update or insert' logic is strange. Line 555 of 
 globals.py adds request.now to the modified_datetime, so in this case, 
 wouldn't it always insert and never update?
 In any case, I think maybe this will help...
 editing storage.py, change the PickleableStorage to this...

 def PickleableStorage(data):
 return Storage(dict(sorted((k,v) for (k,v) in data.items() if 
 isinstance(v,PICKABLE), key=lambda t: t[0])))

 I haven't tested it, but the idea is to sort it by key first...

 On Tuesday, June 11, 2013 9:46:36 AM UTC-7, Derek wrote:

 I don't think it would be too difficult to solve. Just use an 
 'OrderedDict' instead of a regular dict.

 http://docs.python.org/2/library/collections.html#collections.OrderedDict

 On Tuesday, June 11, 2013 9:21:21 AM UTC-7, Aravindan Rs wrote:

 Hi,

 We use web2py in GAE environment and during our performance tuning we 
 realized that session objects are getting written in every request - even 
 in requests which do not modify the session object. I raised an issue 
 regarding this in the web2py issue tracker where I've provided details (
 https://code.google.com/p/web2py/issues/detail?id=1524). After some 
 debugging I realized that actual session object does not change but the 
 pickled string changes each time (e.g. order of items is not guaranteed in 
 a dictionary) resulting is different hash each time which in turn results 
 in the object being written to DB each time.

 Most of my requests does not write to the session object - still every 
 request results in write to session table. This impacts my system 
 performance adversely + incurs higher cost as GAE charges for every DB 
 read/write.

 I think it is a difficult problem for web2py to solve - I assume I have 
 to find a workaround in my code.

 I'm thinking of using session.forget() in the right places. I know the 
 code places where I write to session object. I assume web2py code writes to 
 session object in login, logout and possibly few other authentication 
 related flows. Are there other places to take care of? 

 Is there a more elegant solution to my problem?

 Thanks and regards,
 Aravind.

 PS: Though one can implement the above solution with just forget 
 method - I would have loved also to have unforget method - I could have 
 simply said forget() in one of the model files and unforget() in every 
 place there is write to session object. 



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Session object gets written even when there is no change in the content

2013-06-11 Thread Niphlod
apparently the issue (i.e. different strings can be generated for the 
same object) is documented at 
http://docs.python.org/2/library/pickle.html#id10




-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: web2canvas looks nice

2013-06-11 Thread joseph simpson
Google translate does a good job on most of this material..


On Tue, Jun 11, 2013 at 12:47 AM, Jason (spot) Brower
encomp...@gmail.comwrote:

 Excited to try this when it's in english.
 BR,
 Jason


 On Mon, Jun 10, 2013 at 5:39 PM, Michael Herman herma...@gmail.comwrote:

 Interesting. There's huge potential for projects like this:

- http://javelinapp.com/ (

 http://pandodaily.com/2013/06/10/javelin-the-lean-startup-app-thats-a-product-of-lean-startup-methodology/
)
-

 http://www.kickstarter.com/projects/jmitchel3/coding-for-entrepreneurs/?ref=kicktraq

 To launch an MVP, it's so much more than coding. That's the easy part in
 my opinion. Plus, once you *find *something and get it validated,
 there's so much of the busy side that you have to focus on that many people
 tend to forget about. Anyway, I think web2py or perhaps Rails would be
 great for just tossing up a landing page, hit it with Adwords and see if
 the idea sticks. I'm writing a blog post on it now and creating a prototype
 using Flask.

 I'd love to hear more about your project and be involved in the
 alpha/beta. You can contact me on here or at mich...@realpython.com.
 Cheers!


 On Sunday, June 9, 2013 7:06:25 PM UTC-7, Gustavo Souza wrote:

 Hello guys, I'm the one responsible for this project, I intend to make
 it multi language, is currently only in Portuguese.


 2013/6/8 samuel bonilla pytho...@gmail.com

 Alan solo me gusta la aplicación, me parece interesante.
 El 09/06/2013 08:32, Alan Etkin spam...@gmail.com escribió:

  wowww. nice LOL


 Do you like it or it makes you laugh? (or both?) Both is fine,
 although rare.

  --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit https://groups.google.com/d/**
 topic/web2py/rfyhvXxtGcY/**unsubscribe?hl=enhttps://groups.google.com/d/topic/web2py/rfyhvXxtGcY/unsubscribe?hl=en
 .
  To unsubscribe from this group and all its topics, send an email to
 web2py+un...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .



  --

 ---
 You received this message because you are subscribed to the Google
 Groups web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to web2py+un...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .






 --
 **
 *
 *
 *Gustavo de Souza Lima*
 gus...@agenciax4.com.br
 DESENVOLVEDOR

 *(21) 2423-4351* (escritório)
 *(21) 8163-0309* (celular)

 Twitter: @dodilei https://twitter.com/dodilei
 Google+: gplus.to/dodilei

 tech4noobs.agenciax4.com.br/

  --

 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




  --

 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.






-- 
Joe Simpson

Sent From My DROID!!

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Web2py Grid: Hiding from the main grid but show on other views

2013-06-11 Thread Joe Magaro
Hi, I am just learning web2py and I have a working grid: 
form=SQLFORM.grid(db.CodeMaster,editable=auth.has_membership('Editor_Group'), 
create=auth.has_membership('Editor_Group'),deletable=auth.has_membership('Editor_Group')
)
 
There is a field in db.CodeMaster that I would like to hide from the grid 
view, but have it shown in other views.
 
I tried db.CodeMaster.Code_Example.readable = False
 
That seemed to work except it removed it from all views except edit.
 
Any help is appreciated!

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] How to change default controller / default function

2013-06-11 Thread D Dan
It looks pretty straightforward base on the online book

Default application, controller, and function
default_application
default_controller
default_function

When using the pattern-based system, the name of the default application, 
controller, and function can be changed from *init*, *default*, and 
*index*respectively 
to another name by setting the appropriate value in routes.py:

default_application = myapp
default_controller = admin
default_function = start

And this is mode code (I added these lines to routes.py of 'my application')

*default_application = myapplication   **default_controller = 
mycontroller**default_function = home **BASE =''**routers = {**BASE: 
dict(**default_application = **myapplication**,   **
default_controller = **mycontroller**,**default_function = home,
**),   **}*
*
*
*But it does't work at all. Something I am missing?*
*
*
*Thanks*



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Session object gets written even when there is no change in the content

2013-06-11 Thread Niphlod
@derek : request.now is just a field that represents the row that needs to 
go to the db. is then either inserted or updated accordingly to the 
record_id found (more precisely, it tries to update and then if no updates 
are detected it inserts it). at the beginning of the try_store_whatever 
there's the self._unchanged() check, that is the one producing the issue.

@massimo and devs: apparently this is not solvable empirically basing our 
unchanged check on the hash of the pickled string (even if deepcopying 
seems to return consistent behaviour). Given that the pickle docs doesn't 
assure that consistent strings are generated, I think the only way is to 
create a slightly different implementation of Storage for session (or just 
change the Storage implementation) to keep a record of the Storage actually 
being changed. If I'm not mistaken, it's a dict, so every call to
__setitem__
__delitem__
pop (if key exists)
setdefault (if key does not exists)
update
clear ?
needs to flip a something (boolean) that gets checked in the _unchanged() 
function.

On Tuesday, June 11, 2013 11:14:06 PM UTC+2, Niphlod wrote:

 apparently the issue (i.e. different strings can be generated for the 
 same object) is documented at 
 http://docs.python.org/2/library/pickle.html#id10




-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Web2py Grid: Hiding from the main grid but show on other views

2013-06-11 Thread Massimo Di Pierro
I tried db.CodeMaster.Code_Example.readable = False
I tried db.CodeMaster.Code_Example.writable = False

Now put the two lines in the action before the grid(...) and it will only 
apply to that grid.

On Tuesday, 11 June 2013 15:34:30 UTC-5, Joe Magaro wrote:

 Hi, I am just learning web2py and I have a working grid: 
 form=SQLFORM.grid(db.CodeMaster,editable=auth.has_membership('Editor_Group'), 
 create=auth.has_membership('Editor_Group'),deletable=auth.has_membership('Editor_Group')
 )
  
 There is a field in db.CodeMaster that I would like to hide from the grid 
 view, but have it shown in other views.
  
 I tried db.CodeMaster.Code_Example.readable = False
  
 That seemed to work except it removed it from all views except edit.
  
 Any help is appreciated!


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: requires_login() not working for second instance of auth

2013-06-11 Thread André Kablu
Nevermind... found that this is no bug...

need to add
auth.settings.controller = 'x'

;)

Em segunda-feira, 10 de junho de 2013 23h17min49s UTC-3, André Kablu 
escreveu:

 I wrote some code here extending auth to create different sessions...

 Then I could create here the second instance of Auth... 
 However I strongly think you are right... do all that code is not worth... 
 too much code and handling to solve a minor problem...
 the field in the auth table is much more simple to implement... hahahaha

 Also I think I`d found another bug while trying to create all this code...

 To set a different login page I did this:

 auth_admin.settings.login_url = URL('controller', 'user', args='login')

 However if you put a wrong user and pass... it is redirecting back to the 
 original default/user function and not the customized login_url... 




 Em segunda-feira, 10 de junho de 2013 11h04min18s UTC-3, Anthony escreveu:

 I started a discussion about it here: 
 https://groups.google.com/d/msg/web2py-developers/E9ug6m6WHhE/XkPjiojqTOIJ. 
 I was thinking it might be possible to just specify a base prefix which 
 would get used both to name the session object and to prefix all the table 
 names (the default would be auth, which would replicate the current 
 behavior). I didn't look too deeply to see if anything else would be 
 required, but feel free to give it a shot.

 Anthony

 On Monday, June 10, 2013 1:04:29 AM UTC-4, André Kablu wrote:

 Thanks again Anthony! It is a good alternative. ..

 However It would be very good if we could use 2 auth... 
 As you can see I'd changed table names...

 I'll study auth class in deep to see if i can extend it and change some 
 function to make it accept some parameter so it would be possible to set 
 what session to use...



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Session object gets written even when there is no change in the content

2013-06-11 Thread Massimo Di Pierro
Can you please open a ticket about this. We'll need to think about this and 
we do not want to forget.

On Tuesday, 11 June 2013 16:47:08 UTC-5, Niphlod wrote:

 @derek : request.now is just a field that represents the row that needs to 
 go to the db. is then either inserted or updated accordingly to the 
 record_id found (more precisely, it tries to update and then if no updates 
 are detected it inserts it). at the beginning of the try_store_whatever 
 there's the self._unchanged() check, that is the one producing the issue.

 @massimo and devs: apparently this is not solvable empirically basing our 
 unchanged check on the hash of the pickled string (even if deepcopying 
 seems to return consistent behaviour). Given that the pickle docs doesn't 
 assure that consistent strings are generated, I think the only way is to 
 create a slightly different implementation of Storage for session (or just 
 change the Storage implementation) to keep a record of the Storage actually 
 being changed. If I'm not mistaken, it's a dict, so every call to
 __setitem__
 __delitem__
 pop (if key exists)
 setdefault (if key does not exists)
 update
 clear ?
 to the underlying dict needs to flip a something (boolean) that gets 
 checked in the _unchanged() function.

 On Tuesday, June 11, 2013 11:14:06 PM UTC+2, Niphlod wrote:

 apparently the issue (i.e. different strings can be generated for the 
 same object) is documented at 
 http://docs.python.org/2/library/pickle.html#id10




-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] how to change the content of an IFRAME from a jquery menu

2013-06-11 Thread Stef Mientki

hello,

Starting again with web2py (did a simple experiment 3 years ago),
I'm struggling with changing the content of an IFrame.

I've a few pages, one of them contains a vertical jquery menu on the 
left and an IFrame on the right (setting the width of the IFrame is also 
a small problem). Now I can attach URLs to the menu buttons, but that 
will redirect to the external file.


I want the external file to be shown in the IFrame.

How can it be done.

cheers,
Stef

--

--- 
You received this message because you are subscribed to the Google Groups web2py-users group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: PostgreSQL: duplicate key value...

2013-06-11 Thread Cliff Kachinske
Your source table defines id as an integer.  Your target table defines id 
as a string with length 8.  

Therefore it will not auto increment.  Suggest you look at the manual for 
your target database to see how to do an auto increment integer for primary 
key.

On Monday, June 10, 2013 11:55:32 AM UTC-4, lesssugar wrote:

 Good to know, thanks.

 W dniu poniedziałek, 10 czerwca 2013 17:35:04 UTC+2 użytkownik Niphlod 
 napisał:

 sorry to interrupt your monologue but, BTW, web2py's table definition has 
 no notion of compound unique indexes, so the only way to enforce them (if 
 you need those) is to alter the table manually (as you did).

 Il giorno lunedì 10 giugno 2013 14:51:05 UTC+2, lesssugar ha scritto:

 OK, found a way around. I executed the following commands in postgres 
 and the CSV file imported correctly:

 ALTER TABLE city DROP CONSTRAINT city_country_key;
 ALTER TABLE city ADD CONSTRAINT city_country_key UNIQUE (name, 
 country,region
 );

 Cheers.

 On Monday, June 10, 2013 1:36:47 PM UTC+2, lesssugar wrote:

 Further with my monolog... Seems I need to implement this im my table 
 definition:

 UNIQUE KEY `country` USING BTREE (`country`,`name`,`region`)

 How do I do it in web2py?


 On Monday, June 10, 2013 1:24:20 PM UTC+2, lesssugar wrote:

 Yeah, the question is: how 'country' can be a UNIQUE KEY if countries 
 have hundreds of cities. In the table, hundreds of cities will belong to 
 the same country, so the no wonder the contry code (which is two letters) 
 will not be unique. I'm confused.

 On Monday, June 10, 2013 12:59:26 PM UTC+2, lesssugar wrote:

 OK, I'm starting to think it's a wrongly defined table. The table I 
 would like to import has following structure:

 CREATE TABLE `cities` (
   `ID` int(8) unsigned NOT NULL auto_increment,
   `country` char(2) NOT NULL,
   `region` char(3) NOT NULL,
   `url` varchar(50) NOT NULL,
   `name` varchar(50) NOT NULL,
   `latitude` double NOT NULL,
   `longitude` double NOT NULL,
   PRIMARY KEY  (`ID`),
   UNIQUE KEY `country` USING BTREE (`country`,`name`,`region`)
 ) ENGINE=InnoDB AUTO_INCREMENT=207637 DEFAULT CHARSET=utf8;

 My 'city' table definition looks like this:

 db.define_table('city',
 Field('id', length=8),
 Field('country', length=2, unique=True),
 Field('region', length=3),
 Field('url', length=50),
 Field('name', length=50),
 Field('latitude', 'double'),
 Field('longitude', 'double'),
 format=lambda r: r.name
 )

 Does someone see an error here?

 On Monday, June 10, 2013 12:35:23 AM UTC+2, lesssugar wrote:

 I'm aware this might be rather a postgresql question but maybe 
 someone knows how to deal with it.

 I defined 'city' table

 db.define_table('city',
 Field('id', length=8),
 Field('country', length=2, unique=True),
 Field('region', length=3),
 Field('url', length=50),
 Field('name', length=50),
 Field('latitude', 'double'),
 Field('longitude', 'double'),
 format=lambda r: r.name
 )

 The table is empty and I'm trying to import data from CSV file using 
 web2py's appadmin (the CSV provides fixed IDs).

 Every time I import the file I get the following error:

 *duplicate key value violates unique constraint city_country_key'*
 *
 *
 I found many similar problems on the net and one of the reasons 
 causing this error was lack of sync between (in my case) 'city' and 
 'city_id_seq'. However the sync seems to be OK, because:

 A. select max(id) from city; -- returns nothing (the table 'city' is 
 empty as I wrote)
 B. select nextval('city_id_seq'); -- returns an integer value

 So the result of B.  the result of A. which would suggest it's not 
 a sync problem. I've been fighting with this all day. If someone knows 
 what's going on, please let me know.



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Session object gets written even when there is no change in the content

2013-06-11 Thread Aravindan Rs
You can find the issue at 
https://code.google.com/p/web2py/issues/detail?id=1524


On Wednesday, 12 June 2013 04:35:48 UTC+5:30, Massimo Di Pierro wrote:

 Can you please open a ticket about this. We'll need to think about this 
 and we do not want to forget.

 On Tuesday, 11 June 2013 16:47:08 UTC-5, Niphlod wrote:

 @derek : request.now is just a field that represents the row that needs 
 to go to the db. is then either inserted or updated accordingly to the 
 record_id found (more precisely, it tries to update and then if no updates 
 are detected it inserts it). at the beginning of the try_store_whatever 
 there's the self._unchanged() check, that is the one producing the issue.

 @massimo and devs: apparently this is not solvable empirically basing our 
 unchanged check on the hash of the pickled string (even if deepcopying 
 seems to return consistent behaviour). Given that the pickle docs doesn't 
 assure that consistent strings are generated, I think the only way is to 
 create a slightly different implementation of Storage for session (or just 
 change the Storage implementation) to keep a record of the Storage actually 
 being changed. If I'm not mistaken, it's a dict, so every call to
 __setitem__
 __delitem__
 pop (if key exists)
 setdefault (if key does not exists)
 update
 clear ?
 to the underlying dict needs to flip a something (boolean) that gets 
 checked in the _unchanged() function.

 On Tuesday, June 11, 2013 11:14:06 PM UTC+2, Niphlod wrote:

 apparently the issue (i.e. different strings can be generated for the 
 same object) is documented at 
 http://docs.python.org/2/library/pickle.html#id10




-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: how to change the content of an IFRAME from a jquery menu

2013-06-11 Thread Anthony
Google is your friend. :-)

http://stackoverflow.com/questions/2930315/changing-iframe-source-with-jquery

On Tuesday, June 11, 2013 6:59:37 PM UTC-4, aapaap wrote:

 hello, 

 Starting again with web2py (did a simple experiment 3 years ago), 
 I'm struggling with changing the content of an IFrame. 

 I've a few pages, one of them contains a vertical jquery menu on the 
 left and an IFrame on the right (setting the width of the IFrame is also 
 a small problem). Now I can attach URLs to the menu buttons, but that 
 will redirect to the external file. 

 I want the external file to be shown in the IFrame. 

 How can it be done. 

 cheers, 
 Stef 


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.