[web2py] forms and bootstrap modals

2014-05-26 Thread weheh
Bootstrap modals have header, body and footer sections. I haven't figured 
this out, yet, but is there a way to get formstyle='bootstrap' to send the 
submit button to the footer, the form contents to the body and maybe a 
title to the header sections? Obviously, this can be done with custom 
forms, but it seems like the bootstrap form is already pretty good, just 
needs the above tweak to make it perfect for my app.

-- 
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: Verify password does not fit formstyle

2014-05-26 Thread Annet
Hi,

I added the following lines of code to the formstyle definition:

# For password fields, which are wrapped in a CAT object.
if isinstance(controls, CAT) and isinstance(controls[0], INPUT):
controls[0].add_class('form-control')


In my case that solved the issue.

Regards,

Annet

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


[web2py] Re: How to improve performance for db queries

2014-05-26 Thread Sarbjit
Hi Anthony,

Problem of drop down's not working can be seen with the code/data posted in 
the original slice can be seen with the following changes.

*Controller :*

def index():
grid = {}
if request.vars.maker_name:
query = (db.Product.Maker_ID==request.vars.maker_name)
grid = 
SQLFORM.grid(query=query,csv=False,create=False,deletable=False,)
lists = 
db(db.Product.Maker_ID==request.vars.maker_name).select(db.Product.ALL)
themakers = 
db(db.Maker.id==request.vars.maker_name).select(db.Maker.ALL)  
else:
lists = db(db.Product.Maker_ID==1).select(db.Product.ALL)
themakers = db(db.Maker.id==1).select(db.Maker.ALL)
categories = db().select(db.Category.ALL)
if request.vars.category_name:
makers = 
db(db.Maker.Category_ID==request.vars.category_name).select(db.Maker.ALL)
else:
makers = db(db.Maker.Category_ID==1).select(db.Maker.ALL)
return dict(lists=lists, categories=categories, makers=makers, 
themakers=themakers, grid=grid)


*Views:*

{{extend 'layout.html'}}
 
form enctype=multipart/form-data action={{URL()}} method=post
select name='category_name'
onchange=jQuery('#maker_name').empty();
ajax('maker', ['category_name'], 'maker_name');
{{for category in categories:}}
option value={{=category.id}}
{{= selected='selected' if 
str(category.id)==request.vars.category_name else }}
{{=category.Name}}
/option
{{pass}}
/select
 
select id='maker_name' name='maker_name' 
{{for maker in makers:}}
option value={{=maker.id}}
{{=XML( selected='selected') if 
str(maker.id)==request.vars.maker_name else }}
{{=maker.Name}}/option
{{pass}}
/select
input type=submit value='Submit'
/form
 
{{=grid}}


Now when the results are displayed in the grid, on selecting the view 
option (you may have to click on submit again to view the results). After 
view grid record option is used, changes made in drop down's are not 
reflected upon submit i.e if the product name is changed from the drop 
down, new grid results are not seen.


-- 
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] URL() for app home page

2014-05-26 Thread Quint
Hi,
 
Is it possible to generate an URL for an applications home/index page 
without knowing what the default controler or function is?
It's for a plugin so I do not know what the required controller and 
function are.
 
I other words, how do I find out what the default controller and function 
is?
 
Thanks!
 
Quint

-- 
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: D3.js calling Json in View

2014-05-26 Thread thehuman trashcan
Ah right - that makes sense.

Thanks again ;-)

On Saturday, 24 May 2014 03:55:39 UTC+1, Andrew W wrote:

 good work.  data just refers to the dictionary.  When you open up your 
 json file you just see a dictionary with one key that points to an array.
 By saying data.dashboard_data you are then directly referencing the value 
 of the key, ie. the array in the dictionary.  

 There are several ways to do this which I must post to web2pyslices soon, 
 but yours is one of them, and it works !

 web2py with d3 is a good combo.   I plan to do a lot more with the two 
 combined.



 On Friday, May 23, 2014 10:04:17 PM UTC+10, thehuman trashcan wrote:

 In my impatience I just quickly edited the file.  data.dashboard_data is 
 all that was needed.

 I have managed to leave Scheme=true.

 I don't fully understand how data.dashboard_data converts my dictionary 
 to an array, but I will be looking into this to understand.

 In any case, thank you ever so much!


 On Friday, 23 May 2014 05:41:16 UTC+1, Andrew W wrote:

 Also, try scheme='https' in your case. See Core chapter of book.



-- 
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: URL() for app home page

2014-05-26 Thread Niphlod
defaults are default and index but if a user chooses instead foo and 
bar for his app you'll never know.
It should be a configurable parameter in your plugin.

On Monday, May 26, 2014 11:11:43 AM UTC+2, Quint wrote:

 Hi,
  
 Is it possible to generate an URL for an applications home/index page 
 without knowing what the default controler or function is?
 It's for a plugin so I do not know what the required controller and 
 function are.
  
 I other words, how do I find out what the default controller and function 
 is?
  
 Thanks!
  
 Quint


-- 
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] bootstrap html attributes with web2py helpers

2014-05-26 Thread Santiago Avendaño
2014-05-21 1:41 GMT-03:00 weheh richard_gor...@verizon.net:

 Bootstrap uses some html attributes that won't work with web2py html
 helpers. Is there a way to get web2py helpers to work with these attributes
 or must we resort to raw html?

 For example, from the bootstrap doc:

 button type=button class=btn btn-primary data-toggle=buttonSingle 
 toggle/button


 Obviously TAG.BUTTON('Single toggle', _type='button', class='btn 
 btn-primary', data-toggle='button') will fail miserably because of the 
 data-toggle attribute.

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


You can read an explanation for this topic at the end of chapter HTML
Helpers (http://web2py.com/books/default/chapter/29/5#HTML-helpers):

I think in your case you can use:

TAG.BUTTON('Single toggle', _type='button', class='btn btn-primary',
**{'_data-toggle': 'button'} )


or

TAG.BUTTON('Single toggle', _type='button', class='btn btn-primary',
data={'_data-toggle': 'button'} )


Santiago Avendaño
http://about.me/santiavenda2

-- 
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] Error message: function not callable.

2014-05-26 Thread Maurice Waka
 

My code in HTML view is like this:

{{import test}}
{{while True:}}
{{test()}}
{{pass}}

But I get this error that: function test is not callable. What can I do to 
correct this?

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


Re: [web2py] Re: URL() for app home page

2014-05-26 Thread Quint van den Muijsenberg
Thanks.

Sent from my HTC
On May 26, 2014 1:28 PM, Niphlod niph...@gmail.com wrote:

 defaults are default and index but if a user chooses instead foo and
 bar for his app you'll never know.
 It should be a configurable parameter in your plugin.

 On Monday, May 26, 2014 11:11:43 AM UTC+2, Quint wrote:

 Hi,

 Is it possible to generate an URL for an applications home/index page
 without knowing what the default controler or function is?
 It's for a plugin so I do not know what the required controller and
 function are.

 I other words, how do I find out what the default controller and function
 is?

 Thanks!

 Quint

  --
 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/vTqs_6oZL2Q/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: Error message: function not callable.

2014-05-26 Thread Anthony
test is a module, not a function. If there is a function named test 
inside the test module, then you would call it via test.test(). Or you 
could do from test import test.

Anthony

On Monday, May 26, 2014 8:51:46 AM UTC-4, Maurice Waka wrote:

 My code in HTML view is like this:

 {{import test}}
 {{while True:}}
 {{test()}}
 {{pass}}

 But I get this error that: function test is not callable. What can I do to 
 correct this?


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


Re: [web2py] bootstrap html attributes with web2py helpers

2014-05-26 Thread Anthony


 TAG.BUTTON('Single toggle', _type='button', class='btn btn-primary', 
 data={'_data-toggle': 'button'} )


Note, the above would be data={'toggle': 'button'} or 
data=dict(toggle='button'). When using the data argument, you do not 
include the data- part of the attribute in the dict key (it is 
automatically prepended).

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] what is loader.js for?

2014-05-26 Thread chuan137
looking at my simple example from chrome developer's tool, I noticed 
loader.js doing something in the background.
seems related with statistics or ads.

can someone explain it to me? is it possible to disable it, because I want 
to do some performance measurements?

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.


Re: [web2py] Re: AWS Elastic Beanstalk installation Recipe

2014-05-26 Thread kato
I do not know would be helpful, but there is recipe for Beanstalk. 
Please use the Google translater, because it is Japanese.

http://docs1.erp2py.com/web2py_deploy/aws_beanstalk/aws_beanstalk.html#id4



2014年5月24日土曜日 12時47分38秒 UTC-3 Diogo Munaro:

 But how could I manage migrates? How could I make migrates on deploy?
 Em 24/05/2014 04:02, Massimo Di Pierro massimo@gmail.comjavascript: 
 escreveu:

 There is nothing equivalent to this in web2py. You just remove that line.

 On Thursday, 22 May 2014 12:43:59 UTC-5, Diogo Munaro wrote:


 Hey Massimo, and how could I replace 


  command: django-admin.py syncdb --noinput

 ?

 I need migrate=False because I have a loadbalancer with elastic beanstalk


 Em quinta-feira, 25 de julho de 2013 11h45min05s UTC-3, Aladdin Teng 
 escreveu:

 Thank you very much.

 On Thursday, July 25, 2013 8:53:33 PM UTC+8, Massimo Di Pierro wrote:

 The instructions should be almost identical except that:

 1) you do not pip install Django
 2) you do not ever call django-admin
 3) instead you download and unzip web2py. The web2py folder plays the 
 role of the mysite folder in the example
 4) you do not edit any django config file (there is no django!)
 5) instead you edit db.py and you replace db= DAL(...) with

import os
uri = “mysql://%(RDS_USERNAME)s:%(RDS_PASSWORD)s@%(RDS_HOSTNAME)
 s:%(RDS_PORT)s/%(RDS_DB_NAME)s” % os.environ
db = DAL(uri, pool_size=10)
session.connect(request, response db=db) # sessions in DB!

 6) before you commit and push you must create a file 
 web2py/application.py which contains
 FILE web2py/application.py
 import sys
 import os
 path = os.path.dirname(os.path.abspath(__file__))
 os.chdir(path)
 sys.path = [path] + [p for p in sys.path if not p == path]
 sys.stdout = sys.stderr
 import gluon.main
 application = gluon.main.wsgibase
 FILE

 This should work. If you try it please post your findings. 

 Caveat 1. You must get web2py from web2py_src.zip from the web site 
 and not from the Git report else the web2py git repo will conflict with 
 the 
 git repo you are supposed to create according to this tutorial.

 Caveat 2. From:http://blog.uptill3.com/2012/08/25/python-on-elastic-
 beanstalk.html
 It's critical to understand that the Elastic Beanstalk images are all 
 ephemeral, in the 'old' style of AWS AMIs. This means that nothing on an 
 instances filesystem will survive through a deployment, redeployment, or 
 stoppage of the environment/instance.  This means that 
 session/tickets/uploads must all go to the file system. web2py admin will 
 be useful. You also needs to setup sticky sessions and I am not sure 
 whether AWS does it automatically or not.


 On Wednesday, 17 July 2013 11:14:20 UTC-5, Aladdin Teng wrote:

 Hi!

 Is there an update on this demo?
 I am looking into AWS deployment too.

 Thanks.

 On Saturday, October 13, 2012 9:52:03 AM UTC+8, Massimo Di Pierro 
 wrote:

 I will try a demo asap but I do not have an account so it will take 
 a tille time. In principle everything in eb is not django specific and 
 should work with web2py almost out of them box.

 On Tuesday, 9 October 2012 11:42:35 UTC-5, CST International Mike 
 wrote:

 Hi 

 I trying to find an AWS Elastic Beanstalk Web2py installation 
 recipe.

 Amazon have a Django version http://docs.amazonwebservices.
 com/elasticbeanstalk/latest/dg/create_deploy_Python_django.html

 My Linux\web2py skill are a little weak and rusty. ( over a year 
 now)

 Regards Michael





  -- 
 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/qR6tx0Sa6i0/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] Issue when mixing links and editable/create/details whith join

2014-05-26 Thread Frederic F. MONFILS
Hello,

Can you please help me with the following. I work with web2py for a few 
days. I have a table of products (name, description, unit_price) and orders 
(product, quantity).
I want to show the orders in a grid with an additionnal column Total 
which is order.quantity * product.unit_price.
I use then a query that makes a join between the tables order and product, 
and use the links argument to add the Total column.

In the model:
pre
db.define_table('t_product',
Field('f_name', type='string',
  label=T('Name'), required=True),
Field('f_description', type='text',
  label=T('Description')),
Field('f_unit_price', type='double',
  label=T('Price'), required=True)
)

db.define_table('t_order',
Field('f_product_id', type='reference t_product',
  label=T('Product')),
Field('f_quantity', type='integer',
  label=T('Quantity'))
)
/pre

In the controller:
pre
query = ((db.t_order.modified_by==auth.user_id)  
(db.t_order.f_product_id==db.t_product.id))
fields = (db.t_product.f_name, db.t_product.f_unit_price, 
db.t_order.f_quantity)
links = [dict(header=T(Total price), body=lambda row: 
row.t_order.f_quantity*row.t_product.f_unit_price)]
grid = SQLFORM.grid(query=query, args=request.args[:1],
fields=fields, headers=headers,
orderby=default_sort_order, links=links,
create=True, deletable=True, editable=True,
csv=False, searchable=False, details=True,
maxtextlength=64, paginate=25, showbuttontext=False)
/pre

The first display of the grid is OK: I can see the additionnal column.
However I have the following issue when clicking on the details, edit 
or delete button:
preAttributeError: 'Row' object has no attribute 't_order'/pre

The current workaround is to test in the lambda code if the Row object has 
a t_order attribute thus:
prelambda row: (row.t_item.f_quantity*row.t_product.f_unit_price) if 
hasattr(row, t_item) else /pre
I have to return an empty string because this is what is shown in the 
detail/edit form

It seems that when clicking on the detail/edit/delete button, the row 
passed to the lambda function is no more a row in the resulting join, hence 
we can no more access a field with row.table.fieldname but with 
row.fieldname

In my opinion my first implementation is logic and should be the way to do 
it.

Am I missing something?

Thanks.

Kind regards,

Frederic F. MONFILS

-- 
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] Requiring IS_LENGTH for fields that only show depending on jQuery hide/show

2014-05-26 Thread Kyle Vasconcellos
Hello,

I've been searching through this group and was unable to find an answer to 
this, sorry if it has been answered before.

I have a web page that has several forms that allow a user to enter contact 
information if they have any of the types of contacts(each form inserts 
data into a different table for its respective contact type). Initially, 
the user will see several check boxes, which when checked, will display the 
appropriate form with jQuery.
These contacts each have a name,phone,and email field that jQuery will show 
below them. I want to make the phone number field require a length of 
exactly 10 digits, but am having trouble getting this to happen for 
conditional fields.
I can't simply set a require=IS_LENGTH(10,10) in my db model because this 
will not allow the user to submit the form even if they don't need to add 
contact information (the hidden field will still expect 10 characters even 
though the user won't see it).

Any advice on how to do this would be appreciated.

Thanks,

Kyle

-- 
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] Internal error - after setting up the existing application on new web2py system

2014-05-26 Thread Nishmita Singhla


Hey Fellow programmers,

My friend shared a web2py application with me and I am new to it. I 
recently downloaded web2py and installed on my system.

However he was working on this project since few months now. I just wanted 
to learn from the application on howto use web2py and want to understand 
the system.

My web2py is installed in *M:\web2py\*

After copying and pasting his project into application folder it is 
available to be seen in admin panel. However when I am opening the 
application it gives me internal error like this:

Ticket issued: 
taxi_project/127.0.0.1.2014-05-24.11-24-31.e7ecce1d-a357-4b8f-b912-1eb609468d81

And when I click on the project, it says the following:

Error ticket for taxi_project

*Ticket ID*

127.0.0.1.2014-05-24.11-24-31.e7ecce1d-a357-4b8f-b912-1eb609468d81type 
'exceptions.RuntimeError' Failure to connect, tried 5 times: Traceback (most 
recent call last): File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 
7845, in __init__ File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 
688, in __call__ File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 
2728, in __init__ File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 
648, in reconnect File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 
2726, in connector File 
/home/mdipierro/make_web2py/web2py/gluon/contrib/pymysql/__init__.py, line 
93, in Connect File 
/home/mdipierro/make_web2py/web2py/gluon/contrib/pymysql/connections.py, line 
575, in __init__ File 
/home/mdipierro/make_web2py/web2py/gluon/contrib/pymysql/connections.py, line 
743, in _connect OperationalError: (2003, Can't connect to MySQL server on 
'127.0.0.1' (10061))

*Version*

web2py™ Version 2.9.5-stable+timestamp.2014.03.20.22.57.13TracebackTraceback 
(most recent call last):
  File /home/mdipierro/make_web2py/web2py/gluon/restricted.py, line 220, in 
restricted
  File 
M:/web2py/applications/taxi_project\compiled\controllers.default.index.py, 
line 12, in module
  File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 7867, in 
__init__RuntimeError: Failure to connect, tried 5 times:Traceback (most recent 
call last):
  File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 7845, in __init__
  File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 688, in __call__
  File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 2728, in __init__
  File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 648, in reconnect
  File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 2726, in 
connector
  File /home/mdipierro/make_web2py/web2py/gluon/contrib/pymysql/__init__.py, 
line 93, in Connect
  File 
/home/mdipierro/make_web2py/web2py/gluon/contrib/pymysql/connections.py, line 
575, in __init__
  File 
/home/mdipierro/make_web2py/web2py/gluon/contrib/pymysql/connections.py, line 
743, in _connectOperationalError: (2003, Can't connect to MySQL server on 
'127.0.0.1' (10061))

*In file: 
M:\web2py\applications\taxi_project\compiled\controllers.default.index.pyc*

1.  code object module at 078966E0, file 
M:/web2py/applications/taxi_project\compiled\controllers.default.index.py, 
line 12

Kindly help me setting it up. I will really appreciate.

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


[web2py] How to select a column of numbers into a list so that I can manipulate the list

2014-05-26 Thread Syd Stewart
Hi

What is the simplest way please to select a column of figures (floats and 
int) into a list, so I can manipulate the list e.g randomise the order 

 nums3 = db(db.Measures).select( db.Measures.measure_value, 
orderby=db.Measures.measure_date_time)

 meannums= sum(nums3)/float(len(nums3))

This calculation of the mean keeps giving me an error

  File /home/sydstewart/web2py/applications/SydOwn/controllers/test.py 
https://sydstewart.pythonanywhere.com/admin/default/edit/SydOwn/controllers/test.py,
 line 92, in cusum
qnum[i][k] = (nums3[k]) - (meannums)
TypeError: unsupported operand type(s) for -: 'Row' and 'int'


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.


Re: [web2py] Re: AWS Elastic Beanstalk installation Recipe

2014-05-26 Thread Massimo Di Pierro
They are automatic in web2py. They only problem you may incur in is that if 
you have multiple web2py instances accessing the server, multiple instances 
may initiate the migrations concurrently. Normally you handle this at the 
application level. You set migrate_enabled=False and when you deploy a new 
version of the app you first disable the app (so users cannot access it 
during migration) then set migrate_enabled=True and after the migration is 
completed you restore migrate_enabled=False and  and enable the app again 
to users.

http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=migrate_enabled%3DFalse


On Saturday, 24 May 2014 10:47:38 UTC-5, Diogo Munaro wrote:

 But how could I manage migrates? How could I make migrates on deploy?
 Em 24/05/2014 04:02, Massimo Di Pierro massimo.dipie...@gmail.com 
 escreveu:

 There is nothing equivalent to this in web2py. You just remove that line.

 On Thursday, 22 May 2014 12:43:59 UTC-5, Diogo Munaro wrote:


 Hey Massimo, and how could I replace 


  command: django-admin.py syncdb --noinput

 ?

 I need migrate=False because I have a loadbalancer with elastic beanstalk


 Em quinta-feira, 25 de julho de 2013 11h45min05s UTC-3, Aladdin Teng 
 escreveu:

 Thank you very much.

 On Thursday, July 25, 2013 8:53:33 PM UTC+8, Massimo Di Pierro wrote:

 The instructions should be almost identical except that:

 1) you do not pip install Django
 2) you do not ever call django-admin
 3) instead you download and unzip web2py. The web2py folder plays the 
 role of the mysite folder in the example
 4) you do not edit any django config file (there is no django!)
 5) instead you edit db.py and you replace db= DAL(...) with

import os
uri = “mysql://%(RDS_USERNAME)s:%(RDS_PASSWORD)s@%(RDS_HOSTNAME)
 s:%(RDS_PORT)s/%(RDS_DB_NAME)s” % os.environ
db = DAL(uri, pool_size=10)
session.connect(request, response db=db) # sessions in DB!

 6) before you commit and push you must create a file 
 web2py/application.py which contains
 FILE web2py/application.py
 import sys
 import os
 path = os.path.dirname(os.path.abspath(__file__))
 os.chdir(path)
 sys.path = [path] + [p for p in sys.path if not p == path]
 sys.stdout = sys.stderr
 import gluon.main
 application = gluon.main.wsgibase
 FILE

 This should work. If you try it please post your findings. 

 Caveat 1. You must get web2py from web2py_src.zip from the web site 
 and not from the Git report else the web2py git repo will conflict with 
 the 
 git repo you are supposed to create according to this tutorial.

 Caveat 2. From:http://blog.uptill3.com/2012/08/25/python-on-elastic-
 beanstalk.html
 It's critical to understand that the Elastic Beanstalk images are all 
 ephemeral, in the 'old' style of AWS AMIs. This means that nothing on an 
 instances filesystem will survive through a deployment, redeployment, or 
 stoppage of the environment/instance.  This means that 
 session/tickets/uploads must all go to the file system. web2py admin will 
 be useful. You also needs to setup sticky sessions and I am not sure 
 whether AWS does it automatically or not.


 On Wednesday, 17 July 2013 11:14:20 UTC-5, Aladdin Teng wrote:

 Hi!

 Is there an update on this demo?
 I am looking into AWS deployment too.

 Thanks.

 On Saturday, October 13, 2012 9:52:03 AM UTC+8, Massimo Di Pierro 
 wrote:

 I will try a demo asap but I do not have an account so it will take 
 a tille time. In principle everything in eb is not django specific and 
 should work with web2py almost out of them box.

 On Tuesday, 9 October 2012 11:42:35 UTC-5, CST International Mike 
 wrote:

 Hi 

 I trying to find an AWS Elastic Beanstalk Web2py installation 
 recipe.

 Amazon have a Django version http://docs.amazonwebservices.
 com/elasticbeanstalk/latest/dg/create_deploy_Python_django.html

 My Linux\web2py skill are a little weak and rusty. ( over a year 
 now)

 Regards Michael





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

Re: [web2py] How to select a column of numbers into a list so that I can manipulate the list

2014-05-26 Thread Carlos Costa
Try:

 nums3 = db(db.Measures).select( db.Measures.measure_value,
orderby=db.Measures.measure_date_time).as_list()


2014-05-26 7:20 GMT-03:00 Syd Stewart sydney.w.stew...@gmail.com:

 Hi

 What is the simplest way please to select a column of figures (floats and
 int) into a list, so I can manipulate the list e.g randomise the order

  nums3 = db(db.Measures).select( db.Measures.measure_value,
 orderby=db.Measures.measure_date_time)

  meannums= sum(nums3)/float(len(nums3))

 This calculation of the mean keeps giving me an error

   File /home/sydstewart/web2py/applications/SydOwn/controllers/test.py 
 https://sydstewart.pythonanywhere.com/admin/default/edit/SydOwn/controllers/test.py,
  line 92, in cusum
 qnum[i][k] = (nums3[k]) - (meannums)
 TypeError: unsupported operand type(s) for -: 'Row' and 'int'


 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.




-- 
Att.

Carlos J. Costa
Cientista da Computação
Esp. Gestão em Telecom

EL MELECH NEEMAN!
אָמֵן

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


[web2py] Re: How to migrate to UUID references in db without messing up reference fields

2014-05-26 Thread Massimo Di Pierro
I now understand your problem better.

Have you looked into?

db.export_to_csv_file(file)
db.import_from_csv_file(file,id_map={})

https://groups.google.com/forum/#!msg/web2py/P_lBv8JKiiQ/LESBbSGikw8J
When importing from the file the id_map will recognize records from the 
uuid (assuming they have it) and fix the references accordingly. So the 
references in the imported records will be different but will point to the 
right record. This may fail if there are circular references because it 
would be unable to built the references. Moreover it requires comparing the 
entire db and cannot be used on one single table.

I agree a better solution would be desirable.

Massimo 




On Saturday, 24 May 2014 10:58:39 UTC-5, Ian W. Scott wrote:

 Thanks Massimo. I explained my problem a bit better (I hope) in my reply 
 to Philip below. There are a couple of reasons why the approach you suggest 
 isn't ideal, from my point of view:

1. I'm working with existing database instances (sqlite). So if I 
change all of the reference fields to use uuid connections as you suggest, 
I will have to perform a large-scale migration with a custom script. I'm 
nervous about the potential for error here.
2. This approach would prevent my use of some great web2py dal 
features (reference fields, list-reference fields, recursive selects, 
cascading deletes, etc.) I'd really rather not have to sacrifice so much 
web2py functionality just to synchronize two db instances.

 I wonder whether this doesn't point to a potential area for improvement in 
 web2py. It seems like a framework like this would benefit from having an 
 easier, built-in solution for synchronizing db instances without breaking 
 dal features. So if you can think of a way to facilitate synchronization 
 that's more elegant, I'd be happy to contribute back any code I write to 
 implement it.
 Thanks again,

 Ian
 On Saturday, May 24, 2014 3:08:58 AM UTC-4, Massimo Di Pierro wrote:

 Hello Ian, Sorry we overlooked your email.

 You can easily add a UUID field

 from gluon.util import web2py_uuid

 db.define_table('person',Field('name'),Field('uuid',compute=lambda:web2py_uuid()))

 You can also create table that reference that field:


 db.define_table('thing',Field('name'),Field('owner',requires=IS_IN_DB(db,'person.uuid','name'))

 Except the reference will not be enforced at the DB level, only at the 
 web2py level.

 Massimo



 On Friday, 23 May 2014 23:04:10 UTC-5, Ian W. Scott wrote:

 After 10 days I've received no help on this. Is there something about 
 the question that is inappropriate? Is my question unclear?

 On Wednesday, May 14, 2014 11:44:43 AM UTC-4, Ian W. Scott wrote:

 I need to take an existing db and implement a UUID referencing system 
 so that I can sync local db's with a central remote version. But I'm 
 concerned that this will break reference fields that refer to the newly 
 synced rows.

 My understanding is that the UUID field is necessary because a csv 
 import will assign different row ids to the new entries in the target db 
 than the ones they had in the source db (especially if new records have 
 been added to the target db in the meantime). The UUID is supposed to 
 overcome this, by allowing the db to recognize that rows are equivalent 
 even if they have different ids. But in that case, won't reference fields 
 in other tables often be pointing to the wrong ID number in the target db? 
 (i.e., they'll keep the row ID of the db version in which they were 
 created, and if this ID changes in the target db they will then be 
 referencing a different record.)

 Sorry if this explanation is overly complicated. I'm just trying to get 
 things clear in my own mind.

 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.


Re: [web2py] Re: AWS Elastic Beanstalk installation Recipe

2014-05-26 Thread Diogo Munaro
Thx Massimo, but I need other .tables inside deploy version?
i.e: I have my production version with x db structure, but my new
production version have x+1 db structure. I need x .tables inside my deploy?

Could I make migrate without access page? Could I use any command line
tools?


2014-05-26 12:40 GMT-03:00 Massimo Di Pierro massimo.dipie...@gmail.com:

 They are automatic in web2py. They only problem you may incur in is that
 if you have multiple web2py instances accessing the server, multiple
 instances may initiate the migrations concurrently. Normally you handle
 this at the application level. You set migrate_enabled=False and when you
 deploy a new version of the app you first disable the app (so users cannot
 access it during migration) then set migrate_enabled=True and after the
 migration is completed you restore migrate_enabled=False and  and enable
 the app again to users.


 http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=migrate_enabled%3DFalse


 On Saturday, 24 May 2014 10:47:38 UTC-5, Diogo Munaro wrote:

 But how could I manage migrates? How could I make migrates on deploy?
 Em 24/05/2014 04:02, Massimo Di Pierro massimo.dipie...@gmail.com
 escreveu:

 There is nothing equivalent to this in web2py. You just remove that line.

 On Thursday, 22 May 2014 12:43:59 UTC-5, Diogo Munaro wrote:


 Hey Massimo, and how could I replace


  command: django-admin.py syncdb --noinput

 ?

 I need migrate=False because I have a loadbalancer with elastic beanstalk


 Em quinta-feira, 25 de julho de 2013 11h45min05s UTC-3, Aladdin Teng
 escreveu:

 Thank you very much.

 On Thursday, July 25, 2013 8:53:33 PM UTC+8, Massimo Di Pierro wrote:

 The instructions should be almost identical except that:

 1) you do not pip install Django
 2) you do not ever call django-admin
 3) instead you download and unzip web2py. The web2py folder plays the
 role of the mysite folder in the example
 4) you do not edit any django config file (there is no django!)
 5) instead you edit db.py and you replace db= DAL(...) with

import os
uri = “mysql://%(RDS_USERNAME)s:%(RDS_PASSWORD)s@%(RDS_HOSTNAME)s:
 %(RDS_PORT)s/%(RDS_DB_NAME)s” % os.environ
db = DAL(uri, pool_size=10)
session.connect(request, response db=db) # sessions in DB!

 6) before you commit and push you must create a file
 web2py/application.py which contains
 FILE web2py/application.py
 import sys
 import os
 path = os.path.dirname(os.path.abspath(__file__))
 os.chdir(path)
 sys.path = [path] + [p for p in sys.path if not p == path]
 sys.stdout = sys.stderr
 import gluon.main
 application = gluon.main.wsgibase
 FILE

 This should work. If you try it please post your findings.

 Caveat 1. You must get web2py from web2py_src.zip from the web site
 and not from the Git report else the web2py git repo will conflict with 
 the
 git repo you are supposed to create according to this tutorial.

 Caveat 2. From:http://blog.uptill3.com/2012/08/25/python-on-elastic-
 beanstalk.html
  It's critical to understand that the Elastic Beanstalk images are
 all ephemeral, in the 'old' style of AWS AMIs. This means that nothing on
 an instances filesystem will survive through a deployment, redeployment, 
 or
 stoppage of the environment/instance.  This means that
 session/tickets/uploads must all go to the file system. web2py admin will
 be useful. You also needs to setup sticky sessions and I am not sure
 whether AWS does it automatically or not.


 On Wednesday, 17 July 2013 11:14:20 UTC-5, Aladdin Teng wrote:

 Hi!

 Is there an update on this demo?
 I am looking into AWS deployment too.

 Thanks.

 On Saturday, October 13, 2012 9:52:03 AM UTC+8, Massimo Di Pierro
 wrote:

 I will try a demo asap but I do not have an account so it will take
 a tille time. In principle everything in eb is not django specific and
 should work with web2py almost out of them box.

 On Tuesday, 9 October 2012 11:42:35 UTC-5, CST International Mike
 wrote:

 Hi

 I trying to find an AWS Elastic Beanstalk Web2py installation
 recipe.

 Amazon have a Django version http://docs.amazonwebservices.
 com/elasticbeanstalk/latest/dg/create_deploy_Python_django.html

 My Linux\web2py skill are a little weak and rusty. ( over a year
 now)

 Regards Michael





  --
 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/qR6tx0Sa6i0/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)
 

[web2py] Re: How to select a column of numbers into a list so that I can manipulate the list

2014-05-26 Thread Anthony
You can do:

nums3 = [r.measure_value for r in db().select(db.Measures.measure_value)]

The .select() returns a Rows object, which acts like a list of Row objects 
-- if you want to extract just a single value from each Row object, you 
have to iterate through the Rows object and pull each value out.

Note, depending on what you are doing, you can instead operate on the Rows 
object itself (rather than generating a list and then operating on the 
list). For example, to randomize the order:

import random
random_rows = db(db.Measures).select().sort(lambda r: random.random())

Anthony

On Monday, May 26, 2014 6:20:07 AM UTC-4, Syd Stewart wrote:

 Hi

 What is the simplest way please to select a column of figures (floats and 
 int) into a list, so I can manipulate the list e.g randomise the order 

  nums3 = db(db.Measures).select( db.Measures.measure_value, 
 orderby=db.Measures.measure_date_time)

  meannums= sum(nums3)/float(len(nums3))

 This calculation of the mean keeps giving me an error

   File /home/sydstewart/web2py/applications/SydOwn/controllers/test.py 
 https://sydstewart.pythonanywhere.com/admin/default/edit/SydOwn/controllers/test.py,
  line 92, in cusum
 qnum[i][k] = (nums3[k]) - (meannums)
 TypeError: unsupported operand type(s) for -: 'Row' and 'int'


 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: Verify password does not fit formstyle

2014-05-26 Thread Jaime Sempere


 Hi Annet, 


that looks very nice, but doesn't change anything in my case (same html).

Could you copy and past all your definition of def bootstrap3(form, fields) 
?

The problem is that verify passwords fields (label  input) are not wrapped 
with div class=form-group like other input fields, leaving him outside 
of the patter style.

Thanks in advance!

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


[web2py] routes.py confusion

2014-05-26 Thread Jesse Ferguson
I deployed my app using the nginx script and created a routes.py file like 
so:

# -*- coding: utf-8 -*-


 routers = dict(

 BASE = dict(

 default_application='myapp', )

 )



However when i go to mywebsite.com  i get 
invalid request 

but mywebsite.com/myapp  loads the application... how can i change this 
behavior so the application is at the domains root ie: mywebsite.com?



-- 
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: routes.py confusion

2014-05-26 Thread Jaime Sempere

Theorically that should do the trick, and mywebsite.com should load your 
index page. Just silly question, do you have index.html and def index():

Btw, maybe you are checking in it in no-local server (i mean 'live' server, 
internet server, or whatever is called), and you are using the general 
template layout (which is not allowed in no-local server)... check if it 
works local, and if it works local and not in your 'live' server 99% is due 
to you are using the general template layout. Just create a index.html




El martes, 27 de mayo de 2014 00:08:20 UTC+2, Jesse Ferguson escribió:

 I deployed my app using the nginx script and created a routes.py file like 
 so:

 # -*- coding: utf-8 -*-


 routers = dict(

 BASE = dict(

 default_application='myapp', )

 )



 However when i go to mywebsite.com  i get 
 invalid request 

 but mywebsite.com/myapp  loads the application... how can i change this 
 behavior so the application is at the domains root ie: mywebsite.com?





-- 
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] Why won't my bootstrap modal form close?

2014-05-26 Thread weheh
My bootstrap modal won't close when the user clicks the submit button. 
Console says, Uncaught TypeError: undefined is not a function

Here's what I'm doing.

# view does a load of a skeleton
{{= LOAD('contact', 'dialog.load', ajax=True)}}

# contact controller looks like this
def dialog():
return dict(html=DIV(
DIV(
DIV(
_class='modal-content',
),
_class='modal-dialog',
),
_class='modal autoModal fade',
_id='contact-dialog',
_role='dialog',
aria=dict(labelledby='contact-title', hidden='true'),
)
)

# document ready initializes modal
$(document).ready(function() {
$(#contact-dialog).modal({
show: false,
backdrop: false,
keyboard: true
});
});

# elsewhere in view, link is created that launches modal
A(current.T('Contact'), _href='#',
_title=current.T('For a good time, call ...'),
_onclick=web2py_component(%s,contact-dialog .modal-content
);
$(#contact-dialog).modal(show); % URL('contact', 
'form.load'),
),

Custom form is loaded AOK. All form functionality works hunky-dory (which 
means AOK for you non-native-English speakers). Errors caught perfectly by 
web2py. And then, for the coupé de gras:

if contact_form.process(formname='contact_form').accepted:
send_email(contact_form)
response.flash = SPAN(T('Message sent'), _class='success')
response.js = '$(#contact-dialog).modal(hide);'  #  THIS IS 
WHERE THE TROUBLE IS!!

response.js gets executed. That's where I get the Uncaught TypeError: 
undefined is not a function message. I interpret this to mean that 
response.js is being treated like a function but there's no function.

Out of desperation, I went so far as to wrap a function around response.js 
like this:
response.js = '(function() 
{$(#contact-dialog).modal(hide);})();'

but that was utterly futile. OK web2py community, what gives? I used to do 
this all the time with jquery ui and had no trouble. But with bootstrap, 
it's a problem.

-- 
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: routes.py confusion

2014-05-26 Thread Jesse Ferguson
It seems to be working now... I guess it just takes a while to kick in??

-- 
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: routes.py confusion

2014-05-26 Thread Jaime Sempere

I guess you did not reload routes.py... from the admin panel there is a 
botton that says reload routes.py... other option (I guess you did this) 
is restart web2py server

El martes, 27 de mayo de 2014 05:23:46 UTC+2, Jesse Ferguson escribió:

 It seems to be working now... I guess it just takes a while to kick in??


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

2014-05-26 Thread Carlos Cesar Caballero Díaz
Derek thanks for your answer, the character coding is set, the problem 
is when the data go from web2py to the whoosh database.


El 23/05/14 13:47, Derek escribió:
I've seen this before when the layout.html didn't include the 
character coding portion.


On Friday, May 23, 2014 7:49:39 AM UTC-7, Carlos Cesar Caballero Díaz 
wrote:


Hi, I'm using web2py and whoosh in an application that stores
documents
and makes google-like searches, using
https://github.com/mdipierro/web2py-haystack
https://github.com/mdipierro/web2py-haystack as starting point,
but I'm
having problems with the character encoding when Latin letters (á é í
etc ...) appears. Someone has faced this before or have any
suggestions
for solving this?

-- 


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


[web2py] Re: web2py and whoosh

2014-05-26 Thread weheh
I know nothing of whoosh and It's hard to tell without seeing any code. Are 
you decoding from a web2py record and then encoding when going into whoosh? 
Where are the data coming from originally. Are the documents being uploaded 
to web2py then written to the server's file system or written to a web2py 
db via the DAL?

On Friday, May 23, 2014 10:49:39 PM UTC+8, Carlos Cesar Caballero Díaz 
wrote:

 Hi, I'm using web2py and whoosh in an application that stores documents 
 and makes google-like searches, using 
 https://github.com/mdipierro/web2py-haystack as starting point, but I'm 
 having problems with the character encoding when Latin letters (á é í 
 etc ...) appears. Someone has faced this before or have any suggestions 
 for solving this? 

 -- 

 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: AWS Elastic Beanstalk installation Recipe

2014-05-26 Thread Massimo Di Pierro
If migrate_enabled=False then .table files are ignored.

You can use command line tools.
If you create a applications/yourapp/DISABLED file, your app is temporarily 
disabled.
If you run

python web2py.py -S web2py -M -R anyscript.py

your script anyscript.py will run as if it were a controller. 




On Monday, 26 May 2014 10:54:38 UTC-5, Diogo Munaro wrote:

 Thx Massimo, but I need other .tables inside deploy version?
 i.e: I have my production version with x db structure, but my new 
 production version have x+1 db structure. I need x .tables inside my deploy?

 Could I make migrate without access page? Could I use any command line 
 tools?


 2014-05-26 12:40 GMT-03:00 Massimo Di Pierro massimo.dipie...@gmail.com:

 They are automatic in web2py. They only problem you may incur in is that 
 if you have multiple web2py instances accessing the server, multiple 
 instances may initiate the migrations concurrently. Normally you handle 
 this at the application level. You set migrate_enabled=False and when you 
 deploy a new version of the app you first disable the app (so users cannot 
 access it during migration) then set migrate_enabled=True and after the 
 migration is completed you restore migrate_enabled=False and  and enable 
 the app again to users.


 http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=migrate_enabled%3DFalse


 On Saturday, 24 May 2014 10:47:38 UTC-5, Diogo Munaro wrote:

 But how could I manage migrates? How could I make migrates on deploy?
 Em 24/05/2014 04:02, Massimo Di Pierro massimo.dipie...@gmail.com 
 escreveu:

 There is nothing equivalent to this in web2py. You just remove that 
 line.

 On Thursday, 22 May 2014 12:43:59 UTC-5, Diogo Munaro wrote:


 Hey Massimo, and how could I replace 


  command: django-admin.py syncdb --noinput

 ?

 I need migrate=False because I have a loadbalancer with elastic beanstalk


 Em quinta-feira, 25 de julho de 2013 11h45min05s UTC-3, Aladdin Teng 
 escreveu:

 Thank you very much.

 On Thursday, July 25, 2013 8:53:33 PM UTC+8, Massimo Di Pierro wrote:

 The instructions should be almost identical except that:

 1) you do not pip install Django
 2) you do not ever call django-admin
 3) instead you download and unzip web2py. The web2py folder plays 
 the role of the mysite folder in the example
 4) you do not edit any django config file (there is no django!)
 5) instead you edit db.py and you replace db= DAL(...) with

import os
uri = “mysql://%(RDS_USERNAME)s:%(RDS_PASSWORD)s@%(RDS_HOSTNAME)
 s:%(RDS_PORT)s/%(RDS_DB_NAME)s” % os.environ
db = DAL(uri, pool_size=10)
session.connect(request, response db=db) # sessions in DB!

 6) before you commit and push you must create a file 
 web2py/application.py which contains
 FILE web2py/application.py
 import sys
 import os
 path = os.path.dirname(os.path.abspath(__file__))
 os.chdir(path)
 sys.path = [path] + [p for p in sys.path if not p == path]
 sys.stdout = sys.stderr
 import gluon.main
 application = gluon.main.wsgibase
 FILE

 This should work. If you try it please post your findings. 

 Caveat 1. You must get web2py from web2py_src.zip from the web site 
 and not from the Git report else the web2py git repo will conflict with 
 the 
 git repo you are supposed to create according to this tutorial.

 Caveat 2. From:http://blog.uptill3.com/2012/08/25/python-on-elastic-
 beanstalk.html
  It's critical to understand that the Elastic Beanstalk images are 
 all ephemeral, in the 'old' style of AWS AMIs. This means that nothing 
 on 
 an instances filesystem will survive through a deployment, 
 redeployment, or 
 stoppage of the environment/instance.  This means that 
 session/tickets/uploads must all go to the file system. web2py admin 
 will 
 be useful. You also needs to setup sticky sessions and I am not sure 
 whether AWS does it automatically or not.


 On Wednesday, 17 July 2013 11:14:20 UTC-5, Aladdin Teng wrote:

 Hi!

 Is there an update on this demo?
 I am looking into AWS deployment too.

 Thanks.

 On Saturday, October 13, 2012 9:52:03 AM UTC+8, Massimo Di Pierro 
 wrote:

 I will try a demo asap but I do not have an account so it will 
 take a tille time. In principle everything in eb is not django 
 specific and 
 should work with web2py almost out of them box.

 On Tuesday, 9 October 2012 11:42:35 UTC-5, CST International Mike 
 wrote:

 Hi 

 I trying to find an AWS Elastic Beanstalk Web2py installation 
 recipe.

 Amazon have a Django version http://docs.amazonwebservices.
 com/elasticbeanstalk/latest/dg/create_deploy_Python_django.html

 My Linux\web2py skill are a little weak and rusty. ( over a year 
 now)

 Regards Michael





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

[web2py] how to modify form input before validation and insert into database?

2014-05-26 Thread chuan137
I want to replace white spaces with underscore and capitialize each word 
before insert them into database. I am using SQLFORM(...) and I find 
onvalidation is used after validation.

but I want to use this field as a unique keyword, which used in query 
conditions. what I want is to use a function to do the job before 
validation.

plz bear with my english and thanks in advance.

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