Re: [web2py] Re: Represent, list:reference, upload-field

2014-05-27 Thread Mandar Vaze
A Million Thanks for Johann (for asking the question) and Massimo (for 
providing the answer).
Following is useful even after more than 3 years !!!

Web2py rocks, and web2py community makes it even better :)

-Mandar

On Friday, October 14, 2011 6:56:07 PM UTC+5:30, Johann Spies wrote:



 On 14 October 2011 14:49, Massimo Di Pierro 
 massimo@gmail.comjavascript:
  wrote:

 My bad. Try this:

 def render_docs(ids,row):
  span = SPAN()
  for id in ids:
 doc = db.wbdocuments(id)
 if doc:
 span.append(A(doc.name,_href=URL('download',args=doc.file)))
  return span

 db.wbmaster.documents.represent = render_docs

 Fantastic.  Thanks 

 Johann

 -- 
 Because experiencing your loyal love is better than life itself, 
 my lips will praise you.  (Psalm 63:3)



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


Re: [web2py] Internal error - after setting up the existing application on new web2py system

2014-05-27 Thread Johann Spies
On 24 May 2014 08:36, Nishmita Singhla nishmita.sing...@gmail.com wrote:

Hey Fellow programmers,

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


 If you read the information on the line above you will see

Can't connect to MySQL server on '127.0.0.1


Apparently either you don't have a MySQL server running on your computer or
you have not setup the web2py application to communicate correctly with the
MySQL server.

Have a look in the 'models' directory in the db.py (or maybe 0.py if there
is one) and edit the lines that define the database connection according to
what you have seen in the Web2py book.

Regards
Johann

 --
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

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


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

2014-05-27 Thread Johann Spies
On 26 May 2014 23:26, chuan137 chuan...@gmail.com wrote:

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.

 You can use SQLFORM.factory and after the submission of the form, apply
those changes to the fields where it is needed and then submit them.

Regards
Johann


-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

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


[web2py] Re: Verify password does not fit formstyle

2014-05-27 Thread Annet
Hi Jaime,

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

 

This is my bootstrap3 function. 


 def bootstrap3(form, fields):
parent = FIELDSET()
for id, label, controls, help in fields:
if not help:
_help = ''
else:
# wrappers
_help = SPAN(help, _class='help-block')
# embed _help into _controls
if isinstance(controls, basestring) or isinstance(controls, int):
_controls = DIV(P(controls, _help, 
_class='form-control-static'))
elif isinstance(controls, TEXTAREA):
_controls = DIV(controls, _help)
else:
_controls = DIV(controls, _help)
# submit unflag by default
_submit = False

if isinstance(controls, INPUT):
if controls['_type'] not in ['file', 'checkbox', 'radio']:
controls.add_class('form-control')
if controls['_type'] == 'submit':
# flag submit button
_submit = True
controls['_class'] = 'btn btn-primary'

# 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')

elif isinstance(controls, SELECT):
controls.add_class('form-control')

elif isinstance(controls, TEXTAREA):
controls.add_class('form-control')

if _submit:
# submit button has unwrapped label and controls, different 
class
parent.append(DIV(label, controls, _id=id))
# unflag submit (possible side effect)
_submit = False
else:
# unwrapped label
parent.append(DIV(label, _controls, _class='form-group', 
_id=id))
return parent


To style the radio buttons and check boxes I use the following functions.


def bs3radiowidget(field, value, **attributes):

if isinstance(value, (list,tuple)):
value = str(value[0])
else:
value = str(value)

attr = OptionsWidget._attributes(field, {}, **attributes)
attr['_class'] = attr.get('_class', 'web2py_radiowidget')

requires = field.requires
if not isinstance(requires, (list, tuple)):
requires = [requires]
if requires:
if hasattr(requires[0], 'options'):
options = requires[0].options()
else:
raise SyntaxError('widget cannot determine options of %s'
  % field)
options = [(k, v) for k, v in options if str(v)]
opts = []

for k, v in options:
checked = {'_checked': 'checked'} if k == value else {}
opts.append(DIV(LABEL(v, INPUT(_type='radio',
   _id='%s%s' % (field.name, k),
   _name=field.name,
   requires=attr.get('requires', None),
   hideerror=True, _value=k,
   value=value,
   **checked),
 _for='%s%s' % (field.name, k)), _class='radio'))

return TAG[''](*opts, **attr)


def bs3checkboxeswidget(field, value, **attributes):

if isinstance(value, (list, tuple)):
values = [str(v) for v in value]
else:
values = [str(value)]

attr = OptionsWidget._attributes(field, {}, **attributes)
attr['_class'] = attr.get('_class', 'web2py_checkboxeswidget')

requires = field.requires
if not isinstance(requires, (list, tuple)):
requires = [requires]
if requires and hasattr(requires[0], 'options'):
options = requires[0].options()
else:
raise SyntaxError('widget cannot determine options of %s'
  % field)

options = [(k, v) for k, v in options if k != '']
opts = []

for k, v in options:
if k in values:
r_value = k
else:
r_value = []
opts.append(DIV(LABEL(v, INPUT(_type='checkbox',
   _id='%s%s' % (field.name, k),
   _name=field.name,
   requires=attr.get('requires', None),
   hideerror=True, _value=k,
   value=r_value),
 _for='%s%s' % (field.name, k)), _class=checkbox))

if opts:
opts.append(
INPUT(requires=attr.get('requires', None),
  _style=display:none;,
  _disabled=disabled,
  _name=field.name,
  hideerror=False))
opts=DIV(opts)
return TAG[''](*opts, **attr)


Hope this helps you solve the issue.

Kind 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 

[web2py] json query

2014-05-27 Thread Manuele Pesenti
Hi!
Looking in the code[1] I noticed that it's possible to serialize Query
object into json string... how can I rebuild the query object server side?

Thank you very mutch

M.

[1] https://github.com/web2py/web2py/blob/master/gluon/dal.py#L10430

-- 
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: There were changes in MS SQLServer driver?

2014-05-27 Thread Nguyen Minh Tuan
Thanks Derek!


On 24 May 2014 00:55, Derek sp1d...@gmail.com wrote:

 if you read the whole thing, he changed the way it works.

 db = DAL('mssql://dsn=192.168.0.52;user=usr1;password=pwd1;')

 hint: You have to use DBAPI 2.0 connection strings.

 http://legacy.python.org/dev/peps/pep-0249/#footnotes

 On Tuesday, May 20, 2014 10:17:09 PM UTC-7, Nguyen Minh Tuan wrote:

 Hi Jose,

 I'm now have the same error with you.
 and cannot connect to MSSQL server, I've read your self answer but can
 not understand.
 Can you help me?

 db = DAL('mssql://usr1:pwd1@192.168.0.52/database_1')

 environment :
 - CentOS 6.4, Nginx, uWSGI
 - Python 2.7.6
 - Web2py 2.9.5

 Thanks,
 Tuan.

 On Saturday, October 20, 2012 3:26:03 AM UTC+7, Jose wrote:



 El viernes, 19 de octubre de 2012 15:48:26 UTC-3, Massimo Di Pierro
 escribió:

 So, is the issue closed?


 Yes.

 Jose

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

2014-05-27 Thread Maurice Waka
Thanks. I got the solution...as you said. it should be :
 test.test()


What I did, in the controller:
from  applications.x.x import test
def display_test();
result = test.test()
return locals

HTML view
{{extend 'layout.html'}}
{{=result}}


On Mon, May 26, 2014 at 4:47 PM, Anthony abasta...@gmail.com wrote:

 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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/heu-tVM0ifU/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.




-- 
Dr Maurice Waka, MBCHB.
Nairobi

-- 
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] contact importer

2014-05-27 Thread Leonel Câmara
I'm in the process of implementing invite contacts functionality for one 
of my projects. I'm wondering if anyone has integrated something like:

https://github.com/mengu/contact_importer

with web2py. I'm also interested in whatever solutions you guys are using 
as I'm not keen on reinventing the wheel on this one.

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


[web2py] Re: json query

2014-05-27 Thread Anthony
I'm not sure if the DAL includes any code to de-code JSON queries, but I 
found this web2py slice written around the same time that Query.as_json was 
added to the DAL: 
http://www.web2pyslices.com/slice/show/1593/class-for-building-db-queries-from-python-dictionaries

Anthony

On Tuesday, May 27, 2014 4:50:01 AM UTC-4, Manuele wrote:

 Hi! 
 Looking in the code[1] I noticed that it's possible to serialize Query 
 object into json string... how can I rebuild the query object server side? 

 Thank you very mutch 

 M. 

 [1] https://github.com/web2py/web2py/blob/master/gluon/dal.py#L10430 


-- 
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-27 Thread Diogo Munaro
Thx massimo... I will plain a deploy structure and then I'll post here.

Perhaps web2py migration just need read database structure and view diff
between database structure and model structure. Have you thought about that?
It sound great for deploy! Couldn't be?


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

 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/2
 012/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 

[web2py] Re: global name 'db' is not defined

2014-05-27 Thread Henrik Holm
Anthony,

Not sure really - I was wondering if there might be a way to specify the 
order of which the files would be executed.

Henrik


On Thursday, May 22, 2014 8:50:39 PM UTC-4, Anthony wrote:

 For now I have renamed the file to x_application.py, but this seems like 
 kind of a kludge. Is there a way to work around the alphabetical order 
 restriction?  


 What kind of workaround do you envision?

 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] 2.9.5 crashes @ startup

2014-05-27 Thread Dick Schrauwen
OS: win vista
web2py 295
Starting up by double-click: won't run
From commandline gives:

C:\PROJ-new\web2py295cd web2py

C:\PROJ-new\web2py295\web2pyweb2py.exe
Traceback (most recent call last):
  File string, line 6, in module
  File __main__.py, line 128, in module
  File __main__web2py__.py, line 18, in module
  File /home/mdipierro/make_web2py/web2py/gluon/__init__.py, line 15, in 
modu
le
  File /home/mdipierro/make_web2py/web2py/gluon/globals.py, line 19, in 
modul
e
  File /home/mdipierro/make_web2py/web2py/gluon/xmlrpc.py, line 10, in 
module

  File SimpleXMLRPCServer.pyc, line 102, in module
  File xmlrpclib.pyc, line 144, in module
  File httplib.pyc, line 78, in module
  File mimetools.pyc, line 6, in module
  File tempfile.pyc, line 34, in module
  File random.pyc, line 873, in module
  File random.pyc, line 96, in __init__
  File random.pyc, line 110, in seed
WindowsError: [Error -2146893795] Het provider DLL-bestand is niet juist 
ge´niti
aliseerd

C:\PROJ-new\web2py295\web2py





-- 
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: global name 'db' is not defined

2014-05-27 Thread Henrik Holm
On Thursday, May 22, 2014 8:41:16 PM UTC-4, Dave S wrote:

 On Thursday, May 22, 2014 12:53:34 PM UTC-7, Derek wrote:

 rename db.py to 0.py. it doesn't have to be named db.py.


 Isn't that the same sort of kludge as  application.py --- 
 x_application.py?


Somehow this feels less kludgey - to have the main db file always be 
executed first so that others could rely on it.  The downside, of course, 
is that it goes against my attempt to modify as little as possible of the 
'welcome' application.

But to answer Henrik ... no, there's no workaround other than observing the 
 naming conventions.  I believe this was a design decision, although 
 well before my time here.


Thanks for the clarification!

Henrik



 On Wednesday, May 21, 2014 9:20:16 AM UTC-7, Henrik Holm wrote:

 I have a model file 'application.py' wherein I define some tables, and 
 it is executed before the db.py file.  Thus I get the name 'db' is not 
 defined error.

 For now I have renamed the file to x_application.py, but this seems like 
 kind of a kludge. Is there a way to work around the alphabetical order 
 restriction?  

 (Sorry to respond to an old message; I didn't find any newer references 
 to this particular problem.)


 Henrik



 On Monday, September 24, 2012 1:51:21 PM UTC-4, Massimo Di Pierro wrote:

 db should be defined in your models/db.py

 db= DAL()

 Models are executed in alphabetical order. It will not be there for you 
 if you deleted db.py or name your model so that it is executed before 
 db.py.

 Massimo

 On Monday, 24 September 2012 05:26:26 UTC-5, Роман Акимов wrote:

 Hello all!
 Please help me.
 I'm write:

 model
 db.define_table(
 'document_body',
 Field('name'),
 Field('number'),
 Field('created', 'datetime', default=request.now),
 Field('start_date', 'date'),
 Field('end_date', 'date'),
 Field('activity', 'boolean', default=True),
 )

 controller
 def index():
 form = SQLFORM(db.document_body)
 if form.process().accepted:
 response.flash = 'document uploaded'
 return dict(form = form)

 And i have error in default.py:
 type 'exceptions.NameError' global name 'db' is not defined



-- 
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] problrm in smart sql grid

2014-05-27 Thread Raj
Hi Web2py User

i am using smart sql grid. i am trying to take value from drop down. 
according to that i am fetching data in grid. my grid is working fine but 
when ever i click on edit view buttons. i will not work as it should to be 
bork. it refress the same page.

plese my code below
view part 


{{left_sidebar_enabled,right_sidebar_enabled=True,('message' in globals())}}
{{extend 'layout.html'}}
div id=select_option
   form name=cnf 
action={{=URL('default','service_search')}} method=post 
onsubmit=return showcnf() 
View By:select name=cars
option value=Select View/option
option value=AllAll/option
option value=Due This MonthDue This Month/option
option value=Due TodayDue Today/option
option value=DueTomorrowDueTomorrow/option

   /select
   input type=submit value=GO 
style=height:25px;padding :2px;
   /form
   /div
 
div style=float left  
{{=form}}
/div  


controler part


def a_search():
subject=request.vars.cars
d_today = datetime.date.today()
if subject == 'Due Today':
query = ((db.mytable.due_date == d_today)  ( 
db.mytable.Compliance_Area == 'st'))
session.grid = 
SQLFORM.smartgrid(db.mytable,linked_tables=['submit_detail'], csv=False , 
constraints = dict(mytable = query), paginate=15 , 
sorter_icons=(XML('#x2191;'), XML('#x2193;')) , deletable=False, 
create=False,showbuttontext=False)
response.flash = T( Due Today) 
elif subject == 'DueTomorrow':
t_day = datetime.date.today() + datetime.timedelta(days=1)
query = ((db.mytable.due_date == t_day)  ( 
db.mytable.Compliance_Area == 'st'))
session.grid = 
SQLFORM.smartgrid(db.mytable,linked_tables=['submit_detail'], csv=False , 
constraints = dict(mytable = query), paginate=15 , 
sorter_icons=(XML('#x2191;'), XML('#x2193;')) , deletable=False, 
create=False,showbuttontext=False)
response.flash = T( Due Tomorrow)
elif subject == 'Due This Month':
date = datetime.date.today()
start_date = datetime.datetime(date.year, date.month, 1)
end_date = datetime.datetime(date.year, date.month, 
calendar.mdays[date.month])
query = (((db.mytable.due_date = start_date) | 
(db.mytable.due_date = end_date))  ( db.mytable.Compliance_Area == 'st'))
session.grid = 
SQLFORM.smartgrid(db.mytable,linked_tables=['submit_detail'], csv=False, 
constraints = dict(mytable = query), paginate=15 , 
sorter_icons=(XML('#x2191;'), XML('#x2193;')) , deletable=False, 
create=False,showbuttontext=False)
response.flash = T( Due This Month)
elif subject == 'All':

query = (( db.mytable.Compliance_Area == 'st'))
session.grid = 
SQLFORM.smartgrid(db.mytable,linked_tables=['submit_detail'], csv=False , 
constraints = dict(mytable = query), paginate=15 , 
sorter_icons=(XML('#x2191;'), XML('#x2193;')) , deletable=False)
response.flash = T( All)
return dict(form = session.grid)

can any one help me to sole that issues

-- 
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: global name 'db' is not defined

2014-05-27 Thread Anthony
On Tuesday, May 27, 2014 8:09:43 AM UTC-4, Henrik Holm wrote:

 Anthony,

 Not sure really - I was wondering if there might be a way to specify the 
 order of which the files would be executed.


I suppose we could add a setting that allows you to specify model order, 
though for backward compatibility, the initial model file (i.e., the one 
where you make that setting) would have to be first alphabetically. We 
already have response.models_to_run to specify *which* models to run, but 
it doesn't allow you to change the order.

Anthony

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


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

2014-05-27 Thread Anthony
You could modify request.post_vars before creating the form, or create a 
custom validator for the relevant field(s). No need to use SQLFORM.factory.

Anthony

On Monday, May 26, 2014 5:26:15 PM UTC-4, chuan137 wrote:

 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.


Re: [web2py] Why won't my bootstrap modal form close?

2014-05-27 Thread Richard Vézina
I think you just need : $(#contact-dialog).modal(hide);

Instead of :

(function() {$(#contact-dialog).modal(hide);})();

Since you don't need to check if document is ready...

But if you want to keep it I guess you miss a $

*$*(function() {$(#contact-dialog).modal(hide);});

Not sure about the (); at the end...

Richard



On Mon, May 26, 2014 at 11:22 PM, weheh richard_gor...@verizon.net wrote:

 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.


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

2014-05-27 Thread Richard Vézina
This may help also :
http://linuxapuntes.blogspot.com.ar/2013/03/plugin-modal-bootstrap-web2py.html


On Tue, May 27, 2014 at 9:56 AM, Richard Vézina ml.richard.vez...@gmail.com
 wrote:

 I think you just need : $(#contact-dialog).modal(hide);

 Instead of :

 (function() {$(#contact-dialog).modal(hide);})();

 Since you don't need to check if document is ready...

 But if you want to keep it I guess you miss a $

 *$*(function() {$(#contact-dialog).modal(hide);});

 Not sure about the (); at the end...

 Richard



 On Mon, May 26, 2014 at 11:22 PM, weheh richard_gor...@verizon.netwrote:

 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.




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

2014-05-27 Thread weheh
Richard - Thanks, but that is exactly what I'm using:
response.js = $(#contact-dialog).modal(hide);
and it's not working. The function wrapper was an act of desperation but it 
doesn't work either.

On Tuesday, May 27, 2014 9:56:32 PM UTC+8, Richard wrote:

 I think you just need : $(#contact-dialog).modal(hide);

 Instead of :

 (function() {$(#contact-dialog).modal(hide);})();

 Since you don't need to check if document is ready...

 But if you want to keep it I guess you miss a $

 *$*(function() {$(#contact-dialog).modal(hide);});

 Not sure about the (); at the end...

 Richard



 On Mon, May 26, 2014 at 11:22 PM, weheh richard...@verizon.netjavascript:
  wrote:

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

2014-05-27 Thread Richard Vézina
You could try with plain HTML instead of using helper...

XML(PLAIN HTML MODAL)

Just to make sure that it works...

I suspect that the modal is not construct exactly as it should...

Richard


On Tue, May 27, 2014 at 10:27 AM, weheh richard_gor...@verizon.net wrote:

 Richard - Thanks, but that is exactly what I'm using:
 response.js = $(#contact-dialog).modal(hide);
 and it's not working. The function wrapper was an act of desperation but
 it doesn't work either.


 On Tuesday, May 27, 2014 9:56:32 PM UTC+8, Richard wrote:

 I think you just need : $(#contact-dialog).modal(hide);

 Instead of :

 (function() {$(#contact-dialog).modal(hide);})();

 Since you don't need to check if document is ready...

 But if you want to keep it I guess you miss a $

 *$*(function() {$(#contact-dialog).modal(hide);});

 Not sure about the (); at the end...

 Richard



 On Mon, May 26, 2014 at 11:22 PM, weheh richard...@verizon.net wrote:

 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+un...@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.


-- 
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] Redirect to grid page

2014-05-27 Thread Tom Russell
I have a simple form where I have a submit button that runs some code. 
After the code runs and the data is inserted into my table I do a simple 
redirect like so:

redirect(URL('voltrin_data'))

That just goes to a page I have set up with a grid. I notice if I am 
editing a record and press submit the next page that gets redirected to is 
the last record in the grid.

What I want to do is redirect to my grid but go to the page with the l;ast 
entry and not the first page.

How would I do that? I looked in the book but could not see how I would do 
this.

Thanks,

Tom

-- 
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] Database help

2014-05-27 Thread jimbo
Newbie stuff. A few months ago I asked about using web2py to run a simple 
internal database, with contact details such as tel number address etc.  
Anthony came up with a brilliant solution using just a few lines of code, 
this has worked very well.

Now the database has grown, that is it/they have more columns to fit 
comfortably across a page. I have read up a bit and reckon I need to either 
have a number of tables which need to be joined or linked then I can 
create  separate form grids for each. Or, I suppose I could keep one table 
and then split the forms for filling in the records, that doesn't seem easy 
with SQLFORM?

My knowledge of SQL and databases remains low despite a lot of hours on 
Google! Grateful for any suggestions.

I hope that makes sense, the database remains simple, just need to find a 
way of entering and retrieving the records as the original suggestion from 
Anthony.




https://groups.google.com/forum/#!searchin/web2py/access/web2py/eSSEh_Em4Mw/7UBXaS8TpI4J

-- 
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] Database help

2014-05-27 Thread Richard Vézina
Would help to know what you want to stored (the other columns) and what you
model so far...

Richard


On Tue, May 27, 2014 at 11:42 AM, jimbo ont...@gmail.com wrote:

 Newbie stuff. A few months ago I asked about using web2py to run a simple
 internal database, with contact details such as tel number address etc.
 Anthony came up with a brilliant solution using just a few lines of code,
 this has worked very well.

 Now the database has grown, that is it/they have more columns to fit
 comfortably across a page. I have read up a bit and reckon I need to either
 have a number of tables which need to be joined or linked then I can
 create  separate form grids for each. Or, I suppose I could keep one table
 and then split the forms for filling in the records, that doesn't seem easy
 with SQLFORM?

 My knowledge of SQL and databases remains low despite a lot of hours on
 Google! Grateful for any suggestions.

 I hope that makes sense, the database remains simple, just need to find a
 way of entering and retrieving the records as the original suggestion from
 Anthony.





 https://groups.google.com/forum/#!searchin/web2py/access/web2py/eSSEh_Em4Mw/7UBXaS8TpI4J

 --
 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] call java jar from web2py

2014-05-27 Thread António Ramos
hello is there an easy way to have my web2py app call a class from a jar
file?

Regards
António

-- 
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: Redirect to grid page

2014-05-27 Thread Jim S
When you say that you want to go to the 'grid' page, do you mean a page 
with a SQLFORM.grid on it and you want to go into 'edit' mode on a specific 
record on the grid?

-Jim


On Tuesday, May 27, 2014 10:42:31 AM UTC-5, Tom Russell wrote:

 I have a simple form where I have a submit button that runs some code. 
 After the code runs and the data is inserted into my table I do a simple 
 redirect like so:

 redirect(URL('voltrin_data'))

 That just goes to a page I have set up with a grid. I notice if I am 
 editing a record and press submit the next page that gets redirected to is 
 the last record in the grid.

 What I want to do is redirect to my grid but go to the page with the l;ast 
 entry and not the first page.

 How would I do that? I looked in the book but could not see how I would do 
 this.

 Thanks,

 Tom


-- 
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: call java jar from web2py

2014-05-27 Thread Leonel Câmara
I guess you can try running web2py on jython (there was a new release 
recently) and then, if it works, it should be easy.  
  
You can also try jpype http://jpype.sourceforge.net/index.html

What I would probably do is run a java application server and just have the 
java application communicating with web2py by REST or some kind of RPC.

The best option, of course, depends on what the hell you're doing which I 
don't know.

-- 
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: Redirect to grid page

2014-05-27 Thread Tom Russell
Jim,

Yes I have a grid page in place which is where I go now. The grid though 
has a lot of records and I just want to go to that last record in that 
grid. Since its pagination thats what I am looking for, is how to go to the 
last page in the grid.

On Tuesday, May 27, 2014 12:17:02 PM UTC-4, Jim S wrote:

 When you say that you want to go to the 'grid' page, do you mean a page 
 with a SQLFORM.grid on it and you want to go into 'edit' mode on a specific 
 record on the grid?

 -Jim


 On Tuesday, May 27, 2014 10:42:31 AM UTC-5, Tom Russell wrote:

 I have a simple form where I have a submit button that runs some code. 
 After the code runs and the data is inserted into my table I do a simple 
 redirect like so:

 redirect(URL('voltrin_data'))

 That just goes to a page I have set up with a grid. I notice if I am 
 editing a record and press submit the next page that gets redirected to is 
 the last record in the grid.

 What I want to do is redirect to my grid but go to the page with the 
 l;ast entry and not the first page.

 How would I do that? I looked in the book but could not see how I would 
 do this.

 Thanks,

 Tom



-- 
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] How to migrate to UUID references in db without messing up reference fields

2014-05-27 Thread Philip Kilner
Hi Ian,

I've spent some time looking at available options, and I think I can
solve my own issues without using UUIDs at all.

I really wanted to continue to use integer IDs, partly because in some
cases these fields are exposed to my users as order/document/transaction
IDs. I also wanted to stay as close to web2py's default way of working,
and use the database platform's own continuous replication, rather than
doing it in a batch.

Using Postgres, the ID fields are are populated by a generator, and
changing the generator DDL to prevent clashing IDs should work for me,
as there will only ever be a small number of instances of the database.

It's actually very easy to do - you can interleave the values, so if you
had two instances of the database, you could have one issue odd nos. and
the other even: -

Instance 1: -

START WITH 1 INCREMENT BY 2

Instance 3: -

START WITH 2 INCREMENT BY 2

Alternatively, you could assign a range to each instance: -

Instance 1: -

START WITH 1 INCREMENT BY 1
MAXVALUE 

Instance 2

START WITH 1 INCREMENT BY 1
MAXVALUE 1

I don't know how useful this will be to you if you are using SQLite, but
you may find that Postgres is a more robust platform for replication, so
it could worth looking into in any event.


-- 

Regards,

PhilK


'a bell is a cup...until it is struck'

-- 
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: Redirect to grid page

2014-05-27 Thread Jim S
I would try something like this:

rows_per_page = 20 # this should be set to whatever the 'paginate' parm 
is set to on your call to SQLFORM.grid - default is 20
page_number = int(query).count() / rows_per_page ) + 1#  'query' should 
be the same query that you pass to SQLFORM.grid

redirect(URL('voltrin_data',vars={'page':page_number),user_signature=True)

NOT TESTED!!

Let me know if this doesn't work and I'll code up a test of my own to see 
what happens.

Anyone have a more efficient way of doing this?

-Jim



On Tuesday, May 27, 2014 11:32:28 AM UTC-5, Tom Russell wrote:

 Jim,

 Yes I have a grid page in place which is where I go now. The grid though 
 has a lot of records and I just want to go to that last record in that 
 grid. Since its pagination thats what I am looking for, is how to go to the 
 last page in the grid.

 On Tuesday, May 27, 2014 12:17:02 PM UTC-4, Jim S wrote:

 When you say that you want to go to the 'grid' page, do you mean a page 
 with a SQLFORM.grid on it and you want to go into 'edit' mode on a specific 
 record on the grid?

 -Jim


 On Tuesday, May 27, 2014 10:42:31 AM UTC-5, Tom Russell wrote:

 I have a simple form where I have a submit button that runs some code. 
 After the code runs and the data is inserted into my table I do a simple 
 redirect like so:

 redirect(URL('voltrin_data'))

 That just goes to a page I have set up with a grid. I notice if I am 
 editing a record and press submit the next page that gets redirected to is 
 the last record in the grid.

 What I want to do is redirect to my grid but go to the page with the 
 l;ast entry and not the first page.

 How would I do that? I looked in the book but could not see how I would 
 do this.

 Thanks,

 Tom



-- 
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: Redirect to grid page

2014-05-27 Thread Tom Russell
Works great Jim, Thank you very much.

On Tuesday, May 27, 2014 12:52:33 PM UTC-4, Jim S wrote:

 I would try something like this:

 rows_per_page = 20 # this should be set to whatever the 'paginate' 
 parm is set to on your call to SQLFORM.grid - default is 20
 page_number = int(query).count() / rows_per_page ) + 1#  'query' 
 should be the same query that you pass to SQLFORM.grid

 redirect(URL('voltrin_data',vars={'page':page_number),user_signature=True)

 NOT TESTED!!

 Let me know if this doesn't work and I'll code up a test of my own to see 
 what happens.

 Anyone have a more efficient way of doing this?

 -Jim



 On Tuesday, May 27, 2014 11:32:28 AM UTC-5, Tom Russell wrote:

 Jim,

 Yes I have a grid page in place which is where I go now. The grid though 
 has a lot of records and I just want to go to that last record in that 
 grid. Since its pagination thats what I am looking for, is how to go to the 
 last page in the grid.

 On Tuesday, May 27, 2014 12:17:02 PM UTC-4, Jim S wrote:

 When you say that you want to go to the 'grid' page, do you mean a page 
 with a SQLFORM.grid on it and you want to go into 'edit' mode on a specific 
 record on the grid?

 -Jim


 On Tuesday, May 27, 2014 10:42:31 AM UTC-5, Tom Russell wrote:

 I have a simple form where I have a submit button that runs some code. 
 After the code runs and the data is inserted into my table I do a simple 
 redirect like so:

 redirect(URL('voltrin_data'))

 That just goes to a page I have set up with a grid. I notice if I am 
 editing a record and press submit the next page that gets redirected to is 
 the last record in the grid.

 What I want to do is redirect to my grid but go to the page with the 
 l;ast entry and not the first page.

 How would I do that? I looked in the book but could not see how I would 
 do this.

 Thanks,

 Tom



-- 
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] Database help

2014-05-27 Thread Carlos Correia
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Em 27-05-2014 16:42, jimbo escreveu:
 Newbie stuff. A few months ago I asked about using web2py to run a simple
 internal database, with contact details such as tel number address etc.  
 Anthony
 came up with a brilliant solution using just a few lines of code, this has
 worked very well.
 
 Now the database has grown, that is it/they have more columns to fit 
 comfortably
 across a page. I have read up a bit and reckon I need to either have a number 
 of
 tables which need to be joined or linked then I can create  separate form 
 grids
 for each. Or, I suppose I could keep one table and then split the forms for
 filling in the records, that doesn't seem easy with SQLFORM?
 
 My knowledge of SQL and databases remains low despite a lot of hours on 
 Google!
 Grateful for any suggestions.
 

My 2 cents (3 tutorials for beginners about PostgreSQL):

http://postgresguide.com/
http://www.tutorialspoint.com/postgresql/
http://www.postgresqltutorial.com/

Plus the official documentation:

http://www.postgresql.org/docs/

 I hope that makes sense, the database remains simple, just need to find a way 
 of
 entering and retrieving the records as the original suggestion from Anthony.
 
 
 
 
 https://groups.google.com/forum/#!searchin/web2py/access/web2py/eSSEh_Em4Mw/7UBXaS8TpI4J
 
 -- 
 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.


- -- 
Com os melhores cumprimentos,

Carlos Correia
=
MEMÓRIA PERSISTENTE
Tel.: 219 291 591 - GSM:  917 157 146 / 967 511 762
e-mail: ge...@memoriapersistente.pt - URL: http://www.memoriapersistente.pt
Jabber: m...@jabber.org
GnuPG: wwwkeys.eu.pgp.net
URL Suporte: https://t5.m16e.com/gps
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlOEzPgACgkQ90uzwjA1SJUSzwCcDgknUd+g3yCY2u2XMXwHznO3
WWkAoMQfcRgwsyAB4I8ObWUMrzagF20U
=aRbF
-END PGP SIGNATURE-

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

2014-05-27 Thread weheh
I forgot to mention that I also tried 

response.js = XML('$(#contact-dialog).modal(hide);')


and this threw an internal server error, which surprised me a bit, since 
I've wrapped response.js statements with the XML helper before without 
incident. Here's the traceback:

Traceback

1.
2.
3.
4.
5.

Traceback (most recent call last):
  File I:\web2py\gluon\main.py, line 489, in wsgibase
urllib2.quote(response.js.replace('\n',''))
AttributeError: 'XML' object has no attribute 'replace'


-- 
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: Post Request Timeout

2014-05-27 Thread Dave S


On Thursday, May 22, 2014 1:44:52 PM UTC-7, Cory wrote:

 Hi,
 I have a url that is supposed to receive a post request that contains xml. 
 This post request is a callback from an api. 
 For some reason the post request cannot connect to the url I have 
 specified. The view that is supposed to 


 Controller, perhaps?
 

 receive the request only contains 

 fieldKeys = []
 if request.post_vars:
 for value in request.post_vars:
 fieldKeys.append(value)
 if fieldKeys[0]:
 db.test_post.insert(field1 = fieldKeys[0])

 I just do this for testing purposes to see if I receive the post at all. 
 when I make a post request to myself I end up getting the 
 post variables fine.

 Does anyone know any possible reasons on why a post 
 request from a 3rd party would not connect to a valid
 url with the above code?


Does the post show up in the httpserver.log file?  If not, inspect your 
routing routines.  If yes, then try some print/log statements in your code, 
or set a breakpoint with the debugger, to confirm that the post is reaching 
the controller.

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

2014-05-27 Thread Richard Vézina
when you modal is loaded in html do CTRL+U and copy/paste the source here...

You don't need XML() for response.js

Do you really test you modal as a component?

response.js is only working in context of a component.

Richard


On Tue, May 27, 2014 at 2:09 PM, weheh richard_gor...@verizon.net wrote:

 I forgot to mention that I also tried

 response.js = XML('$(#contact-dialog).modal(hide);')


 and this threw an internal server error, which surprised me a bit, since
 I've wrapped response.js statements with the XML helper before without
 incident. Here's the traceback:

 Traceback

 1.
 2.
 3.
 4.
 5.

 Traceback (most recent call last):
   File I:\web2py\gluon\main.py, line 489, in wsgibase
 urllib2.quote(response.js.replace('\n',''))
 AttributeError: 'XML' object has no attribute 'replace'


  --
 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 to make session variables persist even after logout ?

2014-05-27 Thread Derek
Yes, as Massimo and I have suggested, you should store them in 
extra_fields. That way they will be associated with the users. Another 
alternative is to use an extra cookie, but that seems like a waste of 
bandwidth.

On Friday, May 23, 2014 9:06:12 PM UTC-7, Mandar Vaze wrote:

 Derek,

 May be I misrepresented my scenario - These aren't exactly preferences.
 In both the applications - user sees SQLFORM.grid with large number of 
 records. User will use filter to reduce the count.
 Depending on the user - user is likely to use same filters for quite some 
 time - across logins/logouts
 So these aren't exactly preferences.

 I understand that using sessions across login/logout isn't the right thing 
 to do - but since I got that behaviour in 2.3.2 - I want it in current 
 version as well :)
 Also - the kind of information I'm storing shouldn't lead to security 
 issue AFAIK

 What Anthony suggested is helpful.
  

 If you are storing preferences in user accounts then you should store 
 them with the user accounts


 Can you provide additional details ? Do you mean auth.settings.extra_fields 
 ?

 -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 the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: 2.9.5 crashes @ startup

2014-05-27 Thread Derek
Well, you are getting a write fault.

-2146893795 Error_Write_Fault

Do you have it in a read-only folder?


On Tuesday, May 27, 2014 5:12:13 AM UTC-7, Dick Schrauwen wrote:

 OS: win vista
 web2py 295
 Starting up by double-click: won't run
 From commandline gives:

 C:\PROJ-new\web2py295cd web2py

 C:\PROJ-new\web2py295\web2pyweb2py.exe
 Traceback (most recent call last):
   File string, line 6, in module
   File __main__.py, line 128, in module
   File __main__web2py__.py, line 18, in module
   File /home/mdipierro/make_web2py/web2py/gluon/__init__.py, line 15, in 
 modu
 le
   File /home/mdipierro/make_web2py/web2py/gluon/globals.py, line 19, in 
 modul
 e
   File /home/mdipierro/make_web2py/web2py/gluon/xmlrpc.py, line 10, in 
 module
 
   File SimpleXMLRPCServer.pyc, line 102, in module
   File xmlrpclib.pyc, line 144, in module
   File httplib.pyc, line 78, in module
   File mimetools.pyc, line 6, in module
   File tempfile.pyc, line 34, in module
   File random.pyc, line 873, in module
   File random.pyc, line 96, in __init__
   File random.pyc, line 110, in seed
 WindowsError: [Error -2146893795] Het provider DLL-bestand is niet juist 
 ge´niti
 aliseerd

 C:\PROJ-new\web2py295\web2py







-- 
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: json query

2014-05-27 Thread Manuele Pesenti
Il 27/05/14 13:56, Anthony ha scritto:
 I'm not sure if the DAL includes any code to de-code JSON queries, but
 I found this web2py slice written around the same time that
 Query.as_json was added to the DAL:
 http://www.web2pyslices.com/slice/show/1593/class-for-building-db-queries-from-python-dictionaries
Thanks Anthony :)
exactly what I need if it works

M.

-- 
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: global name 'db' is not defined

2014-05-27 Thread Anthony
Also, note that you can move your model definitions to modules and then 
import and run them in any order you want.

Anthony

On Tuesday, May 27, 2014 8:46:19 AM UTC-4, Anthony wrote:

 On Tuesday, May 27, 2014 8:09:43 AM UTC-4, Henrik Holm wrote:

 Anthony,

 Not sure really - I was wondering if there might be a way to specify the 
 order of which the files would be executed.


 I suppose we could add a setting that allows you to specify model order, 
 though for backward compatibility, the initial model file (i.e., the one 
 where you make that setting) would have to be first alphabetically. We 
 already have response.models_to_run to specify *which* models to run, but 
 it doesn't allow you to change the order.

 Anthony


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


[web2py] Re: Verify password does not fit formstyle

2014-05-27 Thread Anthony
Please submit a Google Code issue about this. We need a way for Auth forms 
to work with custom formstyles.

On Sunday, May 25, 2014 10:50:15 AM UTC-4, Jaime Sempere wrote:

 Hi,

 I am having the same issue pointed here by Ricardo Pedroso:


 https://groups.google.com/forum/#!searchin/web2py/verify$20password$20style/web2py/ZzRYjegMHw8/8iHikvlR23sJ


 See, I use this:

 auth.settings.formstyle='bootstrap3'

 for making the register form in bootstrap style but verify password field 
 is not styled by bootstrap, which leaves the form awful. Is there any quick 
 fix to this other than hack js or custom css?

 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] Re: Post Request Timeout

2014-05-27 Thread Anthony
Hard to say what's going on without knowing more. This may not be related 
to your problem, but when you iterate over request.post_vars (or any 
dictionary-like object), you are iterating over the keys, not the values. 
Also, there is no guarantee regarding the order of the keys, so 
fieldKeys[0] could be any of the keys.

Anthony

On Thursday, May 22, 2014 4:44:52 PM UTC-4, Cory wrote:

 Hi,
 I have a url that is supposed to receive a post request that contains xml. 
 This post request is a callback from an api. 
 For some reason the post request cannot connect to the url I have 
 specified. The view that is supposed to 
 receive the request only contains 

 fieldKeys = []
 if request.post_vars:
 for value in request.post_vars:
 fieldKeys.append(value)
 if fieldKeys[0]:
 db.test_post.insert(field1 = fieldKeys[0])

 I just do this for testing purposes to see if I receive the post at all. 
 when I make a post request to myself I end up getting the 
 post variables fine.

 Does anyone know any possible reasons on why a post 
 request from a 3rd party would not connect to a valid
 url with the above code?

 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] DAL Referencing By Name Not By ID Possible?

2014-05-27 Thread 'Michael Gheith' via web2py-users
I have two pretty basic tables:

db.define_table('tiers',
Field('name', 'string'),
Field('created_on', 'datetime', default=request.now),
format = '%(name)s')

db.define_table('metrics',
Field('tier_id', 'reference tiers'),
Field('total_count', 'integer'),
Field('total_size', 'bigint'),
Field('created_on', 'datetime', default=request.now))

I pre populated my tiers table with data.  When I store data in my metrics 
table, I don't know off hand the tier_id.  I know the tier name though.  Is 
there a way I can use the tier name instead of the tier_id in this 
reference?

-- 
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] I am using Haystack module created by Massimo, does it support insertorupdate?

2014-05-27 Thread Kenneth
I see that it updates indexes when it updates,deletes or insert.
Does it refresh indexes when I use insertorupdate on DAL?

Thank you!

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

2014-05-27 Thread weheh
Richard - this modal is a component. I'm rapidly coming to the conclusion 
that there's some jQuery variable scope issue at play. I just haven't found 
it, yet. Very frustrating.

-- 
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] Custom Auth

2014-05-27 Thread Brian M
Greg, I know this is an old thread, but did you ever come up with a 
solution? I've got an asp.Net app that I'd be nice to be able to 
authenticate against.

Thanks
Brian

On Wednesday, October 9, 2013 9:22:07 PM UTC-5, GregD wrote:

 We have to use tables from sql server (aspnet_user and aspnet_membership) 
 for our authentication.

 So we've extended Auth like this

 from gluon.tools import Auth
 def MyNewAuth 
   ...
   # we copied the Login method from Auth to here
  ...
  # use the following code to decipher the password from aspnet_membership
  # rowa and rowb was used earlier to get username and password from 
 aspnet_users, etc...
   b64salt = str(rowa.PasswordSalt)

b64hash = str(rowa.Password)

binsalt = b64decode(b64salt)

password_string = str(form.vars.pswd).encode(utf16)

password_string = utf16tobin(password_string)

m1 = hashlib.sha1()

m1.update(binsalt + password_string)

if b64encode(m1.digest()) == b64hash:
...
 Now how do we continue using extended Auth class so that we can use 
 authentication throughout app?

 I hope this makes sense. If not, I can elaborate further. Just let me know.

 On Tuesday, October 8, 2013 4:08:25 PM UTC-5, viniciusban wrote:

 Web2py Auth is a class. 

 You should extend it and in models/db.py you should have something like: 
 auth = MyExtendedAuth() 


 On Tue, Oct 8, 2013 at 2:54 PM, GregD gregor...@gadgroup.com wrote: 
  We created a form in the index controller to authenticate users to a 
  database that utilize asp.net membership for authentication.  However, 
 we 
  need to turn on Authentication for all forms now, but can't seem to do 
 it 
  since we didn't use the web2py built-in authentication mechanism. 
  
  Is it possible to move the code we created in the controller to the 
 model so 
  that we can simply add authentication to all forms/pages?  If so, how? 
  Is 
  there another way to accomplish 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+un...@googlegroups.com. 
  For more options, visit https://groups.google.com/groups/opt_out. 



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

2014-05-27 Thread chuan137
anyone kowns what it is?

On Monday, May 26, 2014 2:08:24 PM UTC+2, chuan137 wrote:

 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] how to modify form input before validation and insert into database?

2014-05-27 Thread chuan137
Thank you.

On Tuesday, May 27, 2014 9:14:07 AM UTC+2, Johann Spies wrote:

 On 26 May 2014 23:26, chuan137 chua...@gmail.com javascript: wrote:

 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.

 You can use SQLFORM.factory and after the submission of the form, apply 
 those changes to the fields where it is needed and then submit them.

 Regards
 Johann 


 -- 
 Because experiencing your loyal love is better than life itself, 
 my lips will praise you.  (Psalm 63:3)
  

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


[web2py] Not able to access scheduler_task table getting error DAL object has no attribute scheduler_task

2014-05-27 Thread Keerti Agrawal
I am trying to write a callback function on scheduler_task table but its 
giving rror DAL object has no attribute scheduler_task.
when i see attributes of SAL object using dir(db) it is not having 
scheduler_task table or any table which is maintained by scheuler.
Please help me how can i write callback function on scheduler_task table.

i am witing it as
db.scheduler_task._after_update = [.callback functn..]

-- 
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: global name 'db' is not defined

2014-05-27 Thread Henrik Holm
On Tuesday, May 27, 2014 8:46:19 AM UTC-4, Anthony wrote:
 

 I suppose we could add a setting that allows you to specify model order, 
 though for backward compatibility, the initial model file (i.e., the one 
 where you make that setting) would have to be first alphabetically.


Would it make sense to have the first model file be named something like 
0_db.py - so that it is always run first?
 

 We already have response.models_to_run to specify *which* models to run, 
 but it doesn't allow you to change the order.


It's not a biggie - what I'll do (for now and in the future) is to name my 
model file with a prefix.  I could even have a numbered prefix, like in 
Ubuntu /etc/ directories, in case I have more than one model file and they 
need to be executed in a certain order.

By the way: Am I doing the right thing here, by not modifying the db.py 
file and instead adding my own file to specify the database schema?

Henrik.

-- 
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] not able to include jqueryui in web2py

2014-05-27 Thread sarfaraz ahmed
Hello All,

I am trying to override the web2py default theme and use customized 
jqueryui theme. Hence I downloaded the customized jqueryui js files and css 
files. Copied them to static folder of my test project. I created the 
jqueryui folder under static folder. I created the layout1.html file which 
I am using as extended layout. Mentioned below is first code in layout1.html
*Part1 : *
 
response.files.insert(0,URL('static','jqueryui/css/excite-bike/jquery-ui-1.10.4.custom.css'))
  response.files.insert(1,URL('static','jqueryui/js/jquery-1.10.2.js'))
  
response.files.insert(2,URL('static','jqueryui/js/jquery-ui-1.10.4.custom.js'))
  response.files.insert(3,URL('static','css/web2py.css'))
  response.files.insert(4,URL('static','css/bootstrap.min.css'))
  response.files.insert(5,URL('static','css/bootstrap-responsive.min.css'))
  response.files.insert(6,URL('static','css/web2py_bootstrap.css'))

  }}
 
  {{include 'web2py_ajax.html'}}
script
$(function() {
 $( #accordion ).accordion();
$( #button ).button();
)};
  /script


under default.index.html i wrote 
{{extend 'layout1.html'}}
div id=accordion
h1
a href=#Par1/a
/h1
p
This is new para
/p
h1
a href=#Par1/a
/h1
p
This is new para
/p

/div
Now when I press F12 to check html page source I see all the files are 
properly included (I mean js and css files) However, I don't see accordion 
or button from jqueryui theme.

I read the one article posted by rami. I am newbie and fail to reach 
solution from that thread. Please post step by step help.
Regards,
Sarfaraz Ahmed

-- 
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] I posted one question to web2py-user group not able to find it

2014-05-27 Thread sarfaraz ahmed
The question was regarding using jqueryui in web2py.

-- 
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: global name 'db' is not defined

2014-05-27 Thread Jonathan Lundell
On 27 May 2014, at 6:21 AM, Henrik Holm hh...@3vdc.com wrote:
 On Tuesday, May 27, 2014 8:46:19 AM UTC-4, Anthony wrote:
  
 I suppose we could add a setting that allows you to specify model order, 
 though for backward compatibility, the initial model file (i.e., the one 
 where you make that setting) would have to be first alphabetically.
 
 Would it make sense to have the first model file be named something like 
 0_db.py - so that it is always run first?
  
 We already have response.models_to_run to specify which models to run, but it 
 doesn't allow you to change the order.
 
 It's not a biggie - what I'll do (for now and in the future) is to name my 
 model file with a prefix.  I could even have a numbered prefix, like in 
 Ubuntu /etc/ directories, in case I have more than one model file and they 
 need to be executed in a certain order.
 
 By the way: Am I doing the right thing here, by not modifying the db.py file 
 and instead adding my own file to specify the database schema?

There's nothing magic about the name db.py. Go ahead and rename it.

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