[web2py] Custom library function

2014-05-08 Thread Gael Princivalle
Hello all.

Is there a way to have a custom library file where I can put some custom 
functions ?

For example in default.py:

def index():
a = 4
b = my_custom_function(a)
return dict(b = b)


And in my library file:

def my_custom_function(my_var):
var = my_var + 3
return var

-- 
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: Does Web2py Postgres Adapter support JSON as native type ?

2014-05-08 Thread Mandar Vaze / मंदार वझे
Niphlod,

Thanks for your answer.
Just to clarify that I have understood I need not worry, Web2py DAL code
will pick the right/correct adapter for me, and will support native JSON

Cool !!

-Mandar


On Mon, May 5, 2014 at 12:24 AM, Niphlod niph...@gmail.com wrote:

 the postgres2 adapter is a proof of concept for working with arrays, it's
 not stable nor tested. stick to postgres.

 the default adapter for postgres first checks the version of the backend
 and then updates the mappings to the proper type is json native support
 is available.


 On Sunday, May 4, 2014 7:23:07 PM UTC+2, Mandar Vaze wrote:

 I looked at the gluon/dla.py - and it seems native_json is set to true
 only for MongoDBAdapter (Default value in BaseAdapter is False)

 Postgres supports native datatype JSON since 9.3 (9.2?)
 But PostgresAdapter maps JSON DAL type to TEXT for PostgresAdapter

 1. What am I missing (if anything) because Web2py does not support JSON
 as native data type ?
 2. There seems to be postgres:psycopg2 and postgres*2*:psycopg2 in the
 adapter list (Neither seems to support native type JSON) - but which one
 should I use ?  Is there a choice, or does web2py automatically select one
 for me (based on what ?)

 Thanks,
 -Mandar

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


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


Re: [web2py] Re: SQLFORM.grid search with custom request.vars

2014-05-08 Thread Paolo Valleri
I opened an issue https://code.google.com/p/web2py/issues/detail?id=1931


On Wednesday, May 7, 2014 3:24:38 PM UTC+2, Anthony wrote:

 On Wednesday, May 7, 2014 4:00:33 AM UTC-4, Paolo Valleri wrote:

 The workaround of the hidden fields seems to be much more complex for 
 this simple issue, isn't it?
 In this specific case, we make a search in my point of view the most 
 appropriate action should be a POST since we submit data to be processed. A 
 drawback of that change will be that with the post, a user is not able to 
 bookmark the search result.


 In addition to not allowing bookmarking, POST will cause problems if the 
 user does a refresh or hits the back button (i.e., the browser will ask if 
 you want to re-submit the form data). Anyway, I think the hidden fields 
 could be added with a few lines of code, so shouldn't be too complex.

 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] How would you design a recipe app?

2014-05-08 Thread csavorgn
Hi everyone,
I would like to write an app to organize recipes. Besides creating/updating 
the recipes, I will add functionalities based
on the ingredients the recipes use. Therefore, I thought of creating a 
table which will store the recipes and another for the ingredients.
Every recipe will have a variable number of ingredients with the 
corresponding quantities. How would you store this info (the pair 
ingredient-quantity) in the database? And how would you build a nice form 
to enter the recipes?
Thanks
Carlo

-- 
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] web2py conference - online talks

2014-05-08 Thread António Ramos
The angular talk was very informative.
+1 to Angular and web2py




2014-05-06 4:09 GMT+01:00 Massimo Di Pierro massimo.dipie...@gmail.com:

 I do not think so.


 On Monday, 5 May 2014 10:38:17 UTC-5, marco mansilla wrote:

 Is there any chance to download this videos to watch offline?, that
 would be awesome.

 Marco.

  Please find below the links to the video of the first web2py
  conference. Videos are not broken into talks.
  There is no audio for the first 2minutes but no talk either, only
  service announcements.
 
 
  *Part #1 (from start to lunch break)*
 
  https://colflash.cdm.depaul.edu/colflashweb/
 COLFlashPlayer.aspx?ID=183272
 
  10:00-10:10! Conference Opening
 
  10:10-10:20! “What's New with the PSF” by Brian Curtin
 
  10:20-11:00! “History of web2py” by Massimo Di Pierro
 
  11:00-11:40! Learn web2py the Really Hard Way by Anthony Bastardi
  11:40-12:20! Stereodose by Mark Li
 
  12:20-12:30! Planet Host by Jason Burosh
 
  *Part #2 (from tutorial to coffee break)*
 
  https://colflash.cdm.depaul.edu/colflashweb/
 COLFlashPlayer.aspx?ID=183273
 
  13:00:13:40! hands-on web2py tutorial by Clifford Williams
 
  13:40-14:20! Angular and web2py by Amber Doctor
 
  14:20-14:40 ! Stitching together the tree of life with web2py by
  Richard Ree 1
 
  4:40-15:00! ShipElf: Automated Fulfillment with Web2Py by Peter
  Szczepanski
 
  15:00-15:20! MyIRE - What is Open Source Science? by Mark Graves
 
  15:20-15:40! Introduction to Mongodb by Marco Chou
 
  *Part #3 (from coffee break to end)*
 
  https://colflash.cdm.depaul.edu/colflashweb/
 COLFlashPlayer.aspx?ID=183274
 
  16:00-16:20! Introduction to OpenShift by Craig Brott
 
  16:20-16:40! Introduction to Hypermedia API by Bryan Barnard
 
  16:40-17:00! web2py and the Semantic web by Chris Baron
 
  17:00-17-20! Teaching an old dog new tricks by Don O'Hara
 
  17:20-17:30! Conference Closing
 

  --
 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: Uforum - a forum web2py application

2014-05-08 Thread Stefaan Himpe
 
 I have created a web2py forum software, now currently only in the Dutch
 but wil be ported to english.

Ziet er goed uit!


-- 
http://technogems.blogspot.com
http://a-touch-of-music.blogspot.com
http://youtube.com/stefaanhimpe


-- 
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: Here's how to run Web2Py on IBM BlueMix

2014-05-08 Thread Massimo Di Pierro
Thank you Duncan,

this is very valuable. There should be a setup script for this shipping 
with web2py. Is there any IBM blog wjere we could advertise it?

Massimo

On Tuesday, 6 May 2014 19:29:48 UTC-5, duncan macneil wrote:

 Hi all,

 I've been trying out the www.bluemix.net IBM PaaS. 

 It took me a bit of digging to realise there is in fact a Python runtime. 
 But you need a buildpack. The setup is different enough from Heroku to 
 warrant this mini-HowTo:

 Step 1:

 Use the source version of Web2Py and copy the entire lot into a folder 
 path: 'env/app' so that web2py.py is in the 'app' folder.

 Step 2:

 You need to have a requirements.txt file in the 'app' folder -- even if it 
 is empty. (Although you might want to add a single line with just psycopg2, 
 for example.)

 Step 3: 

 You need to have a manifest.yml in the 'en'v folder (top level of the 
 project) with something like the following content:

 applications:
 - host: mycoolapp
   name: mycoolapp
   command: python web2py.py -a 'yourpassword' -i 0.0.0.0 -p $PORT
   path: app
   domain: ng.bluemix.net
   mem: 128M
   buildpack: git://github.com/ephoning/heroku-buildpack-python.git
   instances: 1

 You need to make sure that 'mycoolapp' is changed to be unique and 
 'yourpassword' is changed, too, obviously.

 Step 4:

 Push this entire 'env' directory to BlueMix by navigating to the 'env' 
 directory and running:

 cf push

 This assumes you have installed the CloudFoundry CLI command line tool, 
 although it also works if you put all the same resources described above 
 into an empty/new linked JazzHub git project from BlueMix and simply press 
 'Deploy' from the web page provided. Handy.

 Some points to consider:

 1. The file structure will hold and run the default SQLite db internally, 
 but that's probably not what you want because the files are not 
 designed/guaranteed to be persistent (flushed with a new/fresh deploy, for 
 instance). Instead you can add PostgreSQL and use that for data persistence 
 -- BlueMix gives you a Postgres connection URL, ready to use! You just add 
 it as a service to the app.

 2. If you change instances = 1 to a larger number, then you'll probably 
 also want to add a Redis service and use Redis for sessions (or a db for 
 sessions). This will most likely allow people to remain logged in when they 
 are load balanced via round robin to another instance, but I have not 
 tested that. (What I *did* test is that you don't stay logged in with 
 multiple instances running, which suggests for larger-scale apps with 
 multiple instances running you'l want a central Redis for sessions.)

 3. You get a SSL-ready address at something like 
 https://mycoolapp.ng.bluemix.net (wildcard certificate exists for *.
 ng.bluemic.net), but since it seems to have some kind of reverse proxy, 
 Web2Py doesn't detect that the admin is being used under HTTPS: so you 
 might want to also store errors in the DB, too. The default with Web2Py is 
 errors in stored the file path. Or modify the app admin to ignore HTTPS 
 (just remember to use HTTPS when logging in!) 

 I hope this helps someone. BlueMix is free during Beta. Pricing to be 
 announced in June, I think. It will be interesting to see what the pricing 
 is.

 Overall I think the service is pretty good -- especially if you need 
 formal DevOps. IBM have made the DevOps thing quite neat in BlueMix. I 
 particularly like being able to 'click the Postgres hexagon' and get a DB 
 connection URL back without any install/setup issues.

 Regs,
 Duncan.



-- 
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: Here's how to run Web2Py on IBM BlueMix

2014-05-08 Thread Willoughby
Is Azure in your shoot-out?  I'd be interested in hearing those results...

On Wednesday, May 7, 2014 9:07:34 PM UTC-4, duncan macneil wrote:


 I don't wanna be one of those guys who just compares on price alone 
 but I will obviously be comparing price to other options. (By which I mean 
 'value for money' not 'lowest price' SmartCloud got criticism for being 
 'more expensive' than the lowest common denominator, but I doubt those who 
 complained actually took out those servers for a test-run to see how snappy 
 they were for the price-points on offer.)

 I'd also need to spend time working out how things like backups, billing 
 (and on-billing), alerts, CDN and other features work before diving in. 
 Nothing too serious, but it does take an investment of time to learn these 
 things.

 But to sum it all up it really has to do with fit for purpose. On smaller 
 projects, there's not too much going on in one release cycle. So a simple 
 'post-and-host' will do for me. On larger projects where there are big 
 releases, bug fixes, custom field-office releases and the need for 
 continuous testing between all these, I can see how the near-automated 
 devops would save me having a full-time devops costs.

 If you'll indulge me: There's a real opportunity here for IBM to sell not 
 just to its own direct customers, but to its customers customers. To see 
 what I mean, put yourself in the shoes of a small-to-medium software 
 business. The whole time is spent selling and re-selling the business the 
 proposition. What helps me is not so much the marketing collateral which 
 convinces *me *to use BlueMix, but marketing collateral that I can use to 
 convince my customers that I'm in the right zone using BlueMix. 

 When my customers ask Where will my data live? I often answer With 
 Amazon. You'd be surprised how many respond, What, the book sellers?. 
 I'd rather say: Your data and business-continuity will live with IBM. Take 
 a look at this (imaginary) url, which explains all the details: 
 http://bluemix.net/once-my-developer-is-done-building-my-awesome-software-how-will-IBM-safeguard-my-data-and-keep-my-app-running-smoothly?
  
 

 That's obviously a ridiculous example, but you get the idea.

 On Thursday, 8 May 2014 03:22:14 UTC+10, Dave S wrote:

 On Tuesday, May 6, 2014 5:29:48 PM UTC-7, duncan macneil wrote:

 Hi all,

 I've been trying out the www.bluemix.net IBM PaaS. 

 It took me a bit of digging to realise there is in fact a Python 
 runtime. But you need a buildpack. The setup is different enough from 
 Heroku to warrant this mini-HowTo:



 Hey, thanks for posting this.  Sounds like you'd give BlueMix a thumbs 
 up; what would sway you to [or not to] go into production with it, compared 
 with other hosting?

 /dps



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


Re: [web2py] Re: Does Web2py Postgres Adapter support JSON as native type ?

2014-05-08 Thread Niphlod
yep, that's right.

On Thursday, May 8, 2014 9:05:44 AM UTC+2, Mandar Vaze wrote:

 Niphlod,

 Thanks for your answer.
 Just to clarify that I have understood I need not worry, Web2py DAL code 
 will pick the right/correct adapter for me, and will support native JSON

 Cool !!

 -Mandar


 On Mon, May 5, 2014 at 12:24 AM, Niphlod nip...@gmail.com 
 javascript:wrote:

 the postgres2 adapter is a proof of concept for working with arrays, it's 
 not stable nor tested. stick to postgres.

 the default adapter for postgres first checks the version of the backend 
 and then updates the mappings to the proper type is json native support 
 is available.


 On Sunday, May 4, 2014 7:23:07 PM UTC+2, Mandar Vaze wrote:

 I looked at the gluon/dla.py - and it seems native_json is set to true 
 only for MongoDBAdapter (Default value in BaseAdapter is False)

 Postgres supports native datatype JSON since 9.3 (9.2?)
 But PostgresAdapter maps JSON DAL type to TEXT for PostgresAdapter

 1. What am I missing (if anything) because Web2py does not support JSON 
 as native data type ?
 2. There seems to be postgres:psycopg2 and postgres*2*:psycopg2 in the 
 adapter list (Neither seems to support native type JSON) - but which one 
 should I use ?  Is there a choice, or does web2py automatically select one 
 for me (based on what ?)

 Thanks,
 -Mandar

  -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 You received this message because you are subscribed to a topic in the 
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/web2py/lYZ-et59-o0/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 web2py+un...@googlegroups.com javascript:.
 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: How would you design a recipe app?

2014-05-08 Thread 黄祥
please take a look at cookbook web2py appliances.

ref:
http://www.web2py.com/appliances

best regards,
stifan

-- 
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: Does Web2py Postgres Adapter support JSON as native type ?

2014-05-08 Thread Anthony
And here's where it happens in the code: 
https://github.com/web2py/web2py/blob/master/gluon/dal.py#L2886

Anthony

On Thursday, May 8, 2014 3:05:44 AM UTC-4, Mandar Vaze wrote:

 Niphlod,

 Thanks for your answer.
 Just to clarify that I have understood I need not worry, Web2py DAL code 
 will pick the right/correct adapter for me, and will support native JSON

 Cool !!

 -Mandar


 On Mon, May 5, 2014 at 12:24 AM, Niphlod niph...@gmail.com wrote:

 the postgres2 adapter is a proof of concept for working with arrays, it's 
 not stable nor tested. stick to postgres.

 the default adapter for postgres first checks the version of the backend 
 and then updates the mappings to the proper type is json native support 
 is available.


 On Sunday, May 4, 2014 7:23:07 PM UTC+2, Mandar Vaze wrote:

 I looked at the gluon/dla.py - and it seems native_json is set to true 
 only for MongoDBAdapter (Default value in BaseAdapter is False)

 Postgres supports native datatype JSON since 9.3 (9.2?)
 But PostgresAdapter maps JSON DAL type to TEXT for PostgresAdapter

 1. What am I missing (if anything) because Web2py does not support JSON 
 as native data type ?
 2. There seems to be postgres:psycopg2 and postgres*2*:psycopg2 in the 
 adapter list (Neither seems to support native type JSON) - but which one 
 should I use ?  Is there a choice, or does web2py automatically select one 
 for me (based on what ?)

 Thanks,
 -Mandar

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




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


[web2py] Re: Custom library function

2014-05-08 Thread mcamel
It sounds you are looking for a module.

You can place 'mylibrary.py' at the module folder of your app, and import 
its functions onto controllers or models, like:

from mylibrary import my_custom_function

You can add this to a model file to get changes at your modules without 
restarting web2py:

from gluon.custom_import import track_changes; track_changes(True)


I think you can also place your modules at 'site-packages' folder, so that 
any app can access them. There's more about this at the manual.


Regards.


El jueves, 8 de mayo de 2014 08:52:00 UTC+2, Gael Princivalle escribió:

 Hello all.

 Is there a way to have a custom library file where I can put some custom 
 functions ?

 For example in default.py:

 def index():
 a = 4
 b = my_custom_function(a)
 return dict(b = b)


 And in my library file:

 def my_custom_function(my_var):
 var = my_var + 3
 return var


-- 
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] Reload page on component form submit

2014-05-08 Thread Carlos Cesar Caballero Díaz
I need to reload a page when a component form is submitted, the book 
says that |ajax_trap=False| indicates that forms must be submitted 
normally, thus reloading the entire page. Using |ajax_trap=False |the 
page is reloaded, but the form action is not executed (there is no new 
entry in the db table). There is my code:


db.py:
...
db.define_table('mytable',Field('myfield','string'))


default.py:
...
def test_component():
form = crud.create(db.mytable)
return dict(form=form)
...


default/test_component.load:
{{=form}}

default/index.php:
{{
=LOAD('default','test_component.load',ajax_trap=False)
}}


||


--

Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

--
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: Reload page on component form submit

2014-05-08 Thread Anthony
You should not set ajax_trap=False, as that will cause the form to be 
submitted to the action of the parent page rather than the action of the 
component. Instead, in your form processing code, if the form is accepted, 
you can do a redirect to the parent page URL, which will cause that URL to 
reload.

Anthony

On Thursday, May 8, 2014 9:50:08 AM UTC-4, Carlos Cesar Caballero Díaz 
wrote:

  I need to reload a page when a component form is submitted, the book says 
 that ajax_trap=False indicates that forms must be submitted normally, 
 thus reloading the entire page. Using ajax_trap=False the page is 
 reloaded, but the form action is not executed (there is no new entry in the 
 db table). There is my code:

 db.py:
 ...
 db.define_table('mytable',Field('myfield','string'))


 default.py:
 ...
 def test_component():
 form = crud.create(db.mytable)
 return dict(form=form)
 ...


 default/test_component.load:
 {{=form}}

 default/index.php:
 {{
 =LOAD('default','test_component.load',ajax_trap=False)
 }}


 

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


[web2py] Re: How would you design a recipe app?

2014-05-08 Thread csavorgn
Thanks Stifan, but in the link you sent I couldn't find the implementation 
of the the cookbook
Carlo


On Thursday, May 8, 2014 2:51:47 PM UTC+2, 黄祥 wrote:

 please take a look at cookbook web2py appliances.

 ref:
 http://www.web2py.com/appliances

 best regards,
 stifan


-- 
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] X509 Documentation is wrong

2014-05-08 Thread LoveWeb2py
Book says:

from gluon.contrib.login_methods.x509_auth import X509Account
auth.settings.actions_disabled=['register','change_password','request_reset_password']
auth.settings.login_form = X509Account()

http://web2py.com/books/default/chapter/29/09/access-control#Other-login-methods-and-login-forms

after searching on the net I found X509Account should be X509Auth and 
X509Account is X509Auth()

Hope this helps someone in the future.

Also, is there somewhere we could find more documentation on pulling a users 
certs? I am running httpd with wsgi 

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: apply static html/graphic to layout template

2014-05-08 Thread Andrey K
Thanks a lot for your feedback and suggestions! It support my vague vision:) 
Now I am certain on the way to go about it. Thanks again!

-- 
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: Web2Py Pages module (basic CMS)

2014-05-08 Thread Rene Dohmen
Hi Again,

Just updated the web2py-pages master branch with 2 .w2p files.
And started a new branch (develop) which contains a complete welcome app 
with the page plugin already working that can be used as an appliance to 
speed up testing and developing with it.
https://github.com/acidjunk/web2py-pages/tree/develop

Kind Regards
Rene

On Wednesday, May 7, 2014 5:19:09 PM UTC+2, Michele Comitini wrote:

 You can test it in recent DAL.  It's still experimental, but well 
 supported in PostgreSQL.  Just add the following options when 
 instantiating a new DAL object: 

 ignore_field_case=False, entity_quoting=True 



 mic 

 2014-05-07 11:26 GMT+02:00 Álvaro J. Iradier 
 alvaro@polartech.esjavascript:: 

  Back in 2011 I proposed using quoted identifiers for databases 
 supporting 
  it: 
  
  https://groups.google.com/d/msg/web2py/aSPtD_mGXdM/4Eflv-edEUEJ 
  
  I think the check_reserved option is a valid fix, but databases like 
  PostgreSql that allow using any word as identifier by quoting it should 
 use 
  this instead of checking for reserved words. It is a pain to hit this 
 kind 
  of issue when migrating from one database to another. Could this be 
  rethinked again? 
  
  Thanks. 
  
  El martes, 6 de mayo de 2014 19:24:15 UTC+2, Rene Dohmen escribió: 
  
  Hi Villas, 
  
  page is a restricted word in postgres and some other DB's I think. We 
  started development in web2py 1.99.1 with sqlite. 
  it's a valid sqlite tableName. The problem for us is that we can't 
 rename 
  it very easing without breaking a lot of apps. 
  The problem that we had with building a web2py plugin is that it's not 
 so 
  nice to overwrite db.py; and that has strict sql keyword checks in 
 there by 
  default. 
  
  I will create a w2p file from it tomorrow. For now you can copy the git 
  tree over an app; and it should work (when you have the needed deps) 
  Online references: http://www.formatics.nl (it's 95% page module) 
  
  Kind Regards 
  
  Rene 
  
  On Friday, February 28, 2014 1:34:50 AM UTC+1, villas wrote: 
  
  Hi Rene 
  Is there a plugin now? 
  BTW the whole idea of using check_reserved is so you can avoid using 
  reserved names with new projects.  Finding a way to avoid that so you 
 can 
  use 'page' negates the purpose. 
  Thanks for your effort to release this work and it will be very nice 
 to 
  see it in action! 
  Best wishes,  D 
  
  
  On Thursday, 27 February 2014 20:07:21 UTC, Rene Dohmen wrote: 
  
  This was solved a while ago :) 
  
  On Friday, December 20, 2013 9:34:21 AM UTC+1, Ruud Schroen wrote: 
  
  We are still working on a plugin. 
  But we are facing a problem regarding reserved keywords which 
 prevents 
  us from creating a plugin. 
  
  db = 
 DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all']) 
  check_reserved=['all'] needs to be removed in order for it to work 
  right now, the problem is you can't overrule it somewhere. 
  If anyone knows a solution that will be greatly appreciated, and we 
 can 
  finally make a plugin for 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+un...@googlegroups.com javascript:. 
  For more options, visit https://groups.google.com/d/optout. 


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


Re: [web2py] Re: Reload page on component form submit

2014-05-08 Thread Carlos Cesar Caballero Díaz

Anthony, thanks for your answer.

Of course, the form is submitted to the parent page... I think that I 
should rest a litle and continue tomorrow...


Thanks again for your answer


El 08/05/14 10:10, Anthony escribió:
You should not set ajax_trap=False, as that will cause the form to be 
submitted to the action of the parent page rather than the action of 
the component. Instead, in your form processing code, if the form is 
accepted, you can do a redirect to the parent page URL, which will 
cause that URL to reload.


Anthony

On Thursday, May 8, 2014 9:50:08 AM UTC-4, Carlos Cesar Caballero Díaz 
wrote:


I need to reload a page when a component form is submitted, the
book says that |ajax_trap=False| indicates that forms must be
submitted normally, thus reloading the entire page. Using
|ajax_trap=False |the page is reloaded, but the form action is
not executed (there is no new entry in the db table). There is my
code:

db.py:
...
db.define_table('mytable',Field('myfield','string'))


default.py:
...
def test_component():
form = crud.create(db.mytable)
return dict(form=form)
...


default/test_component.load:
{{=form}}

default/index.php:
{{
=LOAD('default','test_component.load',ajax_trap=False)
}}


||

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




--

Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

--
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: Uforum - a forum web2py application

2014-05-08 Thread Rene Dohmen
+1

2014-05-08 12:26 GMT+02:00 Stefaan Himpe stefaan.hi...@gmail.com:


  I have created a web2py forum software, now currently only in the Dutch
  but wil be ported to english.

 Ziet er goed uit!


 --
 http://technogems.blogspot.com
 http://a-touch-of-music.blogspot.com
 http://youtube.com/stefaanhimpe


 --
 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: How would you design a recipe app?

2014-05-08 Thread Willoughby
https://github.com/mdipierro/web2py-appliances/tree/master/CookbookExample

On Thursday, May 8, 2014 10:48:39 AM UTC-4, csavorgn wrote:

 Thanks Stifan, but in the link you sent I couldn't find the implementation 
 of the the cookbook
 Carlo


 On Thursday, May 8, 2014 2:51:47 PM UTC+2, 黄祥 wrote:

 please take a look at cookbook web2py appliances.

 ref:
 http://www.web2py.com/appliances

 best regards,
 stifan



-- 
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] Mozilla Web App Security recommendations

2014-05-08 Thread Joe Barnhart
Anyone see this?

https://wiki.mozilla.org/WebAppSec/Secure_Coding_Guidelines

From my quick reading, web2py does pretty well according to the 
recommendations here...

-- Joe

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


[web2py] Re: Mozilla Web App Security recommendations

2014-05-08 Thread Massimo Di Pierro
Once we were audited for security. Yet the page with results is gone and 
all that I could find is this blog post:
http://pythonsecurity.tumblr.com/post/807089821/web2py-a-framework-that-cares-about-security

On Thursday, 8 May 2014 14:14:27 UTC-5, Joe Barnhart wrote:

 Anyone see this?

 https://wiki.mozilla.org/WebAppSec/Secure_Coding_Guidelines

 From my quick reading, web2py does pretty well according to the 
 recommendations here...

 -- Joe



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


[web2py] is it allowed/possible to replace the database within a controler ?

2014-05-08 Thread Stef Mientki

hello,

I've a web2py site, which should run, more or less synchronized, (with 
the same data)  on 2 different servers.


The first one is filling the database.

The second one should copy the db from the first one if the database was 
refreshed more than 24 hours ago.


So the solution I've in mind is the following:
- on the second system I keep the last refresh of the database in some 
extra table of this database (I can't find another global storage)
- when a specific controler is requested on this second system, it 
checks if the database needs to be refreshed, downloads the database 
from the first server and copies this over it's own database.


Is replacing the database allowed in a controler ?
Are there better solutions ?

thanks,
Stef

--
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: Mozilla Web App Security recommendations

2014-05-08 Thread Joe Barnhart
Sadly the links in the article no longer point to any information about 
web2py.  Looks like the python security project got rid of its wiki and all 
of the information it had (like web2py's score) is now lost.

-- Joe

On Thursday, May 8, 2014 1:25:11 PM UTC-7, Massimo Di Pierro wrote:

 Once we were audited for security. Yet the page with results is gone and 
 all that I could find is this blog post:

 http://pythonsecurity.tumblr.com/post/807089821/web2py-a-framework-that-cares-about-security

 On Thursday, 8 May 2014 14:14:27 UTC-5, Joe Barnhart wrote:

 Anyone see this?

 https://wiki.mozilla.org/WebAppSec/Secure_Coding_Guidelines

 From my quick reading, web2py does pretty well according to the 
 recommendations here...

 -- Joe



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


[web2py] Re: is it allowed/possible to replace the database within a controler ?

2014-05-08 Thread Anthony
You probably don't want a web request to potentially have to wait for a 
database copy over the network before returning a result. It would probably 
make more sense to set up a scheduled task to replicate the database once a 
day. Or better yet, look into the replication options offered by your RDBMS 
(e.g., http://www.postgresql.org/docs/9.3/static/high-availability.html).

Anthony

On Thursday, May 8, 2014 4:30:03 PM UTC-4, aapaap wrote:

 hello, 

 I've a web2py site, which should run, more or less synchronized, (with 
 the same data)  on 2 different servers. 

 The first one is filling the database. 

 The second one should copy the db from the first one if the database was 
 refreshed more than 24 hours ago. 

 So the solution I've in mind is the following: 
 - on the second system I keep the last refresh of the database in some 
 extra table of this database (I can't find another global storage) 
 - when a specific controler is requested on this second system, it 
 checks if the database needs to be refreshed, downloads the database 
 from the first server and copies this over it's own database. 

 Is replacing the database allowed in a controler ? 
 Are there better solutions ? 

 thanks, 
 Stef 


-- 
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] Do we need a response.files for footer as well as header?

2014-05-08 Thread Joe Barnhart
Some folks recommend javascript files be placed at the end of the page to 
facilitate fast loading. We have the response.files idiom that makes it 
easy to compress and serve the static files, but it with 
response.include_files() to append the files to the header.  It can't serve 
both header and footer at present.

Is there a need to have a new variable which does the same thing, but is 
defined to be used for scripts in the footer area?  Or is it not really 
important to load static script files with the end of the page instead of 
the header?

-- Joe 

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


[web2py] Re: Do we need a response.files for footer as well as header?

2014-05-08 Thread Anthony
I suppose you could edit web2py_ajax.html to include only CSS files, and 
then do {{=response.include_files(extenstions=['js'])}} at the bottom of 
the layout.

Anthony

On Thursday, May 8, 2014 6:46:13 PM UTC-4, Joe Barnhart wrote:

 Some folks recommend javascript files be placed at the end of the page to 
 facilitate fast loading. We have the response.files idiom that makes it 
 easy to compress and serve the static files, but it with 
 response.include_files() to append the files to the header.  It can't serve 
 both header and footer at present.

 Is there a need to have a new variable which does the same thing, but is 
 defined to be used for scripts in the footer area?  Or is it not really 
 important to load static script files with the end of the page instead of 
 the header?

 -- Joe 


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


Re: [web2py] Re: Reload page on component form submit

2014-05-08 Thread LaDarrius Stewart
---controller--
@auth.requires_login()
def test():
a=request.args(0)
form=SQLFORM(db.Notes).process()
form.vars.TestID = a
comments=db(db.Test.TestID==a).select()
if form.process(formname=somename).accepted:
form.vars.TestID = a
redirect(URL('default','test', args=[request.args(0)]))
return dict(form=form, comments=comments)
---test.load 
file---
button id=button3 class=btn btn-danger data-toggle=collapse 
data-target=#cd type=button Add note!/button
div class=collapse id=cd
  h4Add a Note/h4
{{=form}}
 /div
br

  h4Current Comments: /h4

  {{for item2 in reversed(comments):}}lib/b
  iPosted on: {{=item2.created_on}} By: 
{{=item2.created_by.first_name}} {{=item2.created_by.last_name}}/i
  br
  {{=item2.NoteSummary}} br/li{{pass}}
-FOR VIEW--
 {{=LOAD('default','notestest.load',ajax=False, ajax_trap=True, 
args=[request.args(0)])}}

On Thursday, May 8, 2014 11:05:37 AM UTC-5, Carlos Cesar Caballero Díaz 
wrote:

  Anthony, thanks for your answer.

 Of course, the form is submitted to the parent page... I think that I 
 should rest a litle and continue tomorrow...

 Thanks again for your answer
  

 El 08/05/14 10:10, Anthony escribió:
  
 You should not set ajax_trap=False, as that will cause the form to be 
 submitted to the action of the parent page rather than the action of the 
 component. Instead, in your form processing code, if the form is accepted, 
 you can do a redirect to the parent page URL, which will cause that URL to 
 reload.

 Anthony

 On Thursday, May 8, 2014 9:50:08 AM UTC-4, Carlos Cesar Caballero Díaz 
 wrote: 

  I need to reload a page when a component form is submitted, the book 
 says that ajax_trap=False indicates that forms must be submitted 
 normally, thus reloading the entire page. Using ajax_trap=False the 
 page is reloaded, but the form action is not executed (there is no new 
 entry in the db table). There is my code:

 db.py:
 ...
 db.define_table('mytable',Field('myfield','string'))


 default.py:
 ...
 def test_component():
 form = crud.create(db.mytable)
 return dict(form=form)
 ...


 default/test_component.load:
 {{=form}}

 default/index.php:
 {{
 =LOAD('default','test_component.load',ajax_trap=False)
 }}


   -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to web2py+un...@googlegroups.com javascript:.
 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.