[web2py] Again: virtual field requires type-attribute

2013-02-25 Thread Martin Weissenboeck
I have tried another model: db.define_table('test', Field('t1'), Field('t2'), ) db.test.c12 = Field.Virtual (lambda r: r.t1+r.t2) And i get: 'FieldVirtual' object has no attribute 'type' Version web2py™(2, 4, 1, 'alpha.2', datetime.datetime(2013, 2, 17, 11, 27, 22)) PythonPython

[web2py] multiple events on single button

2013-02-25 Thread waqasiqbal . knysys
Hi, I have a question regarding multiple events on single click of button , i want to submit my form and also popup the fancybox by clicking a simple button , here i have my code *MY Button in HTML* Select Default Group* * *MY JS* script type="text/javascript"> $(document).ready(function(){ f

Re: [web2py] Re: Smartgrid: How to display value from foreign table in a table when only foreign key is in table

2013-02-25 Thread Alex Glaros
thanks, the install worked, and thanks Kyle, the word "medical" appeared correctly. I don't know which line drives that, but will re-read the code. much appreciated, Alex On Monday, February 25, 2013 10:27:43 PM UTC-8, 黄祥 wrote: > > please fill with whatever name you want > Application name:

Re: [web2py] Re: Smartgrid: How to display value from foreign table in a table when only foreign key is in table

2013-02-25 Thread steve van christie
please fill with whatever name you want Application name: testdict Upload a package: (path where you downloaded from dropbox file : web2py.app.TechDictionary.w2p) click install -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe

[web2py] Re: Smartgrid: How to display value from foreign table in a table when only foreign key is in table

2013-02-25 Thread Alex Glaros
Kyle, How do I install your packed up? I downloaded it and selected it from my download directory in the below GUI, and also tried getting the URL location, but both said "Invalid application name" error thanks, Alex Upload and install packed application Application name: Invalid application

[web2py] Re: web2py under GAE: disabling indexes

2013-02-25 Thread howesc
it looks like you have a typo "custom_qualifer" vs "custom_qualifier" On Monday, February 25, 2013 6:44:14 PM UTC-8, Scott Hunter wrote: > > I applied the patch, and added custom_qualifiers like so: > > Field('f_name', type='string',custom_qualifer={'indexed':False}, > label=T('N

RE: [web2py] Re: Many to many relationships

2013-02-25 Thread Toby Wilson
Thanks Massimo. Is the second point regarding the shell I raise a known issue as well? From: web2py@googlegroups.com [mailto:web2py@googlegroups.com] On Behalf Of Massimo Di Pierro Sent: Tuesday, 26 February 2013 4:36 PM To: web2py@googlegroups.com Subject: [web2py] Re: Many to man

[web2py] Re: Many to many relationships

2013-02-25 Thread Massimo Di Pierro
we need to che change the book. "owner" is a keyword in postgresql. When we wrote the 4th edition of the book, web2py was not checking by default. recent versions of web2py are checking. On Monday, 25 February 2013 17:02:09 UTC-6, Toby Wilson wrote: > > Thanks Cliff and Niphlod... appreciate yo

Re: [web2py] Re: Error db._adapter

2013-02-25 Thread Massimo Di Pierro
Try: import MySQLdb conn.MySQLdb.connect(db=db, user=user, passwd=passwd, host=host, port=port, charset=charset) curr = conn.cursor() curr.execute('CALL sp_recursive_start

[web2py] Re: possible bad security hole with auth.has_membership() in v 2.2.1

2013-02-25 Thread Massimo Di Pierro
fixed in trunk. Thanks for reporting this. On Monday, 25 February 2013 13:23:52 UTC-6, Cliff Kachinske wrote: > > auth.has_membership returns true when passed a non_existent group role. > > This code snippet: > > q = db.auth_group.role.contains('fubar') > print len(db(q).select()) > > print auth.h

[web2py] Re: Smartgrid: How to display value from foreign table in a table when only foreign key is in table

2013-02-25 Thread Kyle Flanagan
Those were the only changes that I remember. I've packed up the changes I made to your app and attached them, just in case there's something I don't remember changing. I've also attached a screenshot of where I see "Medical" to make sure we're on the same page about what you're trying to accompl

[web2py] Setting Up Basic Authentication between 2 Web2Py Apps

2013-02-25 Thread Subhamoy Sengupta
I have 2 Web2Py apps, *Provider* and *Accessor*. One allows basic authentication and the other one uses it for logging in. I have turned on username based login instead of e-mail based like this in the db.py of both apps: auth.define_tables(username=True, signature=False, migrate=True) auth_tab

[web2py] Scheduler and legacy databases

2013-02-25 Thread Massimiliano
Hi, I'm working on a legacy database where all boolean are mapped to 0, -1. In my application I redefine adapter TRUE/FALSE as saw in this group. In db.py: db = DAL('postgres://postgres@127.0.0.1/logistica') import copy db._adapter.types = copy.copy(db._adapter.types) db._adapter.types['boolea

[web2py] Automatically updating a db table from a CSV file

2013-02-25 Thread cmzobrist
I am looking to up date a database table from a CSV file automatically when a CSV file is sent via FTP to my web2py application. Any ideas? -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiv

[web2py] Re: web2py under GAE: disabling indexes

2013-02-25 Thread Scott Hunter
I applied the patch, and added custom_qualifiers like so: Field('f_name', type='string',custom_qualifer={'indexed':False}, label=T('Name')), and this is the error I got: In FILE: /base/data/home/apps/s~sbhweb2py/1.365567821359373728/applications/ ppt_demo/models/db_wizard.py Tr

[web2py] Re: Query Not Supported: (1054, "Unknown column 'daily_counts.add_date' in 'order clause'") No records f

2013-02-25 Thread Dan Kozlowski
*Massimo, When I removed the orderby clause it solved problem with the error message. but I still need to sort the grid in desc order. * def dailycounts(): grid=SQLFORM.smartgrid(db.daily_counts, user_signature=False,create=False,editable=False,deletable=False,* orderby=~db.daily_counts

[web2py] Re: double entry in sqlform

2013-02-25 Thread 黄祥
a, i c, thank you so much for your hints, nihplod, actually, i'm still learning from the book too, on part : http://web2py.com/books/default/chapter/29/07#SQLFORM-in-HTML, so that when i test it, i found the problem. -- --- You received this message because you are subscribed to the Google G

[web2py] Re: Relocating auth/user & Login component

2013-02-25 Thread Vixus
Yes, sorry. It's just: {{=form}} On Monday, February 25, 2013 2:15:43 AM UTC, LightDot wrote: > > Does the user/handle.load view exist? > > > On Monday, February 25, 2013 12:52:05 AM UTC+1, Vixus wrote: >> >> By default auth seems to assume everything is under: >> default/user/[login,register,

[web2py] Re: Relocating auth/user & Login component

2013-02-25 Thread Vixus
Ok, I understand. But what if I want the auth stuff in a controller called user, and not default? How do I prevent the redirections taking place above? Shouldn't it have redirected to *user*/handle/login instead of * default*/handle/login? On Monday, February 25, 2013 12:17:04 AM UTC, Niphlod wr

[web2py] Re: db admin interface while deployed

2013-02-25 Thread howesc
Hello, good thing you mentioned GAE in your post - it makes a large difference in this case! ;) I wrote a bit of code that i put at the bottom of /models/db.py that checked for an admin user, and if it did not exist created it. Then after running once removed it from db.py. as for my table m

[web2py] Re: Many to many relationships

2013-02-25 Thread Toby Wilson
Thanks Cliff and Niphlod... appreciate your assistance. I'll go through the book a little slower and get clear on this. In the book it shows an example using the word "owner". When I copy and paste this in, I can't access the database administration option as I get an internal error with the me

[web2py] How to properly handle dynamic urls?

2013-02-25 Thread Anthony
Everything after the function name in the URL can be found in request.args. -- --- 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

[web2py] Re: routing problem using two routes.py

2013-02-25 Thread greaneym
I've discovered this is a problem related to the browser I am using. The identical site displays correctly in Chrome but not Safari. I have the latest version of safari loaded. I don't think it is a problem with routes or web2py but a browser issue, but I don't know how to fix it. On Friday,

[web2py] Re: lock icon and https

2013-02-25 Thread greaneym
I've just discovered that the identical sites behave differently on chrome and safari. That is not surprising as browsers are not ever consistent in what they display. But I don't know how to fix it so the browser knows how to load my app the way Chrome does. Chrome loads https, with the lock i

Re: [web2py] Re: Smartgrid: How to display value from foreign table in a table when only foreign key is in table

2013-02-25 Thread Alex Glaros
It worked! thanks Mark and everyone that looked at this. Alex Glaros On Monday, February 25, 2013 1:30:21 PM UTC-8, Mark wrote: > > The grandparent, parent, child relationships maybe too complex for > smartgrid, or maybe a bug in smartgrid? Try to use the IF statement to > differentiate the re

Re: [web2py] Re: Scheduler: help us test it while learning

2013-02-25 Thread Yarin Kessler
Sweet- looking forward to using the API. Schema changes a pain but done for right reasons. Can you give more explanation of the immediate=True param? As for patterns- a basic event calendar would be good demo Thanks for the great work Niphlod On Sat, Feb 23, 2013 at 1:21 PM, Niphlod wrote: > r

[web2py] How to properly handle dynamic urls?

2013-02-25 Thread bracquet
I don't quite understand how web2py url routing does its magic. For something like this: localhost:8000/welcome/default/products/* where '*' can be some something which uniquely identifies a product in a database, such as the primary integer id or a slug. The identifier will then need to be pa

Re: [web2py] Re: Smartgrid: How to display value from foreign table in a table when only foreign key is in table

2013-02-25 Thread Mark
The grandparent, parent, child relationships maybe too complex for smartgrid, or maybe a bug in smartgrid? Try to use the IF statement to differentiate the relationships: if 'DictionaryType.languageID' in request.args: db.Word.dictionaryTypeID.represent = lambda id: db.DictionaryType(id).di

[web2py] Re: lock icon and https

2013-02-25 Thread greaneym
thanks niphlod, I am not being very clear I guess. On the openshift server, I do have access to the shared ssl, and when some apps are defined in the routes.py as the default application, I can view the lock icon when https is invoked, or when it is called if defined in a model file. But with

Re: [web2py] Re: Error db._adapter

2013-02-25 Thread __pyslan__ - Ayslan Jenken
Well, I downloaded mysql.connector from the link. I put it in the folder gluon.contrib. I put the code below in file dal.py: try: try: import contrib.mysql_connector as mysqlconn except ImportError: import mysql.connector DRIVERS.append('MySQL(

[web2py] Re: The Great Web Framework Shootout

2013-02-25 Thread OJ
Uh, beginners mistake... default.py had that same thing when learning by examples. After this fix - comment out that troubling @auth.requires_signature() I ran into more problems. Now it has db = sqlite3.connect(os.path.join(request.folder,'databases','hello.db')) NameError: global name 'os'

[web2py] possible bad security hole with auth.has_membership() in v 2.2.1

2013-02-25 Thread Cliff Kachinske
auth.has_membership returns true when passed a non_existent group role. This code snippet: q = db.auth_group.role.contains('fubar') print len(db(q).select()) print auth.has_membership('fubar') Returns this in the console: 0 True -- --- You received this message because you are subscribed

Re: [web2py] Re: Error db._adapter

2013-02-25 Thread __pyslan__ - Ayslan Jenken
I have not the faintest idea how to do that, and this feature is essential for the project. I can not build a recursive function due to performance. With great respect I ask, should I give up web2py in this case? On Mon, Feb 25, 2013 at 2:28 PM, Niphlod wrote: > well, I doubt that workbench u

[web2py] Re: double entry in sqlform

2013-02-25 Thread Niphlod
process() does the insert for you (that's the whole point of having a *SQL*FORM). If you need to manage the insert/delete/update in your own way, you need to http://web2py.com/books/default/chapter/29/07#SQLFORM-without-database-IO PS: you said over and over to be a newbie and to have looked

Re: [web2py] Re: Error db._adapter

2013-02-25 Thread Niphlod
well, I doubt that workbench uses a python dbapi. >From where I stand, you should try to make that work on the adapter (i.e. without web2py) and see if there it works in my pov, mysql returns different resultsets for that kind of stored proc: one is the result of the line inserted in a loop

[web2py] double entry in sqlform

2013-02-25 Thread 黄祥
hi, i found a problem during entry in sqlform, the data that i've submit is double entry to database : for example: *###default.py* def sale(): rows=db((db.product.quantity>0)).select(orderby=db.product.id, cache=(cache.ram, 10)) form = SQLFORM(db.sale) *if form.process(session=None

[web2py] Re: Smartgrid: How to display value from foreign table in a table when only foreign key is in table

2013-02-25 Thread Alex Glaros
thanks for working through this Kyle I made the changes but I don't see what would make "Medical" instead of "1" appear without the "represent" clause. It now runs without errors but displays "1" instead of "Medical" Did any lines besides the added "format" lines change, and the deleted #16 an

[web2py] Re: I need a double entry accounting software ....

2013-02-25 Thread Michael Herman
interesting project. as a former accountant, being able to pull/push data to QB is a must. unfortunately, the QB web api is terribly documented. i have updated docs on how to use it to pull data (let me know if you're interested). this would definitely be something i'd keep in the back of your

[web2py] add a virtual field to auth_user: 'FieldMethod' object has no attribute 'type'

2013-02-25 Thread Martin Weissenboeck
I have tried to add a virtual field to auth_user and I got: 'FieldMethod' object has no attribute 'type' *The Code:* db.auth_user.emails = Field.Virtual(lambda r: r.last_name) Version web2py™ (2, 4, 1, 'alpha.2', datetime.datetime(2013, 2, 17, 11, 27, 22)) Python Python 2.7.3: D:\Python27\pyt

Re: [web2py] Re: Scheduler: new plugin cs_plugin_monitor

2013-02-25 Thread Paolo valleri
Really nice job, +1 for shipping this with web2py. paolo On Sunday, February 24, 2013 3:34:03 PM UTC+1, Massimo Di Pierro wrote: > > I think this plugin should ship with web2py. ;-) > > On Sunday, 24 February 2013 07:28:11 UTC-6, Niphlod wrote: >> >> spoilers here >> https://www.dropbox.com/sh/gyn

[web2py] Re: Smartgrid: How to display value from foreign table in a table when only foreign key is in table

2013-02-25 Thread Kyle Flanagan
Alex, I downloaded your app and ran it. If I understand you correctly, you're trying to get "Medical" to show up instead of "1" when you navigate to Humanlanguages -> English -> Dictionarytypes -> Words? I achieved this by editing your db.py to the following: ##... ## Dictionary type means wha

[web2py] Re: gae + wsgi testing with lettuce and webtest

2013-02-25 Thread Joe Gillon
I'm simply trying to run lettuce against a web2py model domain. Well, actually, because of the DAL I'm running it against models in the modules folder. Problem is, this is just Python with no web2py running so Lettuce can't find things like gluon.dal. I used abspath to get to the web2py modules

Re: [web2py] Re: Error db._adapter

2013-02-25 Thread Massimo Di Pierro
The code below is equivalent to: sql> CALL sp_recursive_start(1); sql> ROLLBACK; web2py is not adding anything to it. This demonstrates that the problem is completely with the code in "sp_recursive_start". You are getting an OperationError from the database on rollback. My guess is that there

[web2py] Re: Query Not Supported: (1054, "Unknown column 'daily_counts.add_date' in 'order clause'") No records f

2013-02-25 Thread Massimo Di Pierro
1) drop or delete the database 2) delete all the .table files in applications/yourapp/databases On Monday, 25 February 2013 08:31:45 UTC-6, Dan Kozlowski wrote: > > I will try the latest build later today. I was also thinking to drop the > schema and have DAL build it again. What is the best way

[web2py] db admin interface while deployed

2013-02-25 Thread jjg0
Quick background, I'm still very new to web2py and learning so be prepared for newbie questions from me! When working locally I've been using the admin interface to manage my tables. If I deploy a site, I no longer have access to this. (or maybe i do but I'm doing something wrong with gae). T

[web2py] Re: Exposing `gluon.http.HTTP` as JSON?

2013-02-25 Thread Niphlod
not tested: inspecting request.extension ? On Monday, February 25, 2013 4:29:29 PM UTC+1, Alec Taylor wrote: > > One solution I can hack together is: > > @service.json > def index(): > raise HTTP(404, json.dumps({"Hello":'bar', "Foo": 'tar'})) > > However when I access it without '.json'

[web2py] Exposing `gluon.http.HTTP` as JSON?

2013-02-25 Thread Alec Taylor
One solution I can hack together is: @service.json def index(): raise HTTP(404, json.dumps({"Hello":'bar', "Foo": 'tar'})) However when I access it without '.json' I would still get the error response in JSON. How can I make it so that JSON errors are only shown for '.json'; and normal text

[web2py] Re: The Great Web Framework Shootout

2013-02-25 Thread OJ
Yeah, Your example has a bug in it. I get: " name 'auth' is not defined Traceback (most recent call last): File "/Users/xxx/web2py/gluon/restricted.py", line 212, in restricted exec ccode in environment File "/Users/xxx/web2py/applications/benchmark/controllers/default.py"

Re: [web2py] Re: Returns a list of all exposed methods

2013-02-25 Thread Anthony
It should list decorated functions, but it won't be limited to decorated functions. If you only want to list service decorated functions, you'll need your own custom regex: import re regex_expose = re.compile('^@service\.[a-z]+\ndef\s+(?P_?[a-zA-Z0-9]\w*)\( *\)\s*:', flags=re.M) Another optio

Re: [web2py] Re: Error db._adapter

2013-02-25 Thread __pyslan__ - Ayslan Jenken
I got it: In [1]: fields = [db.auth_user.generation, db.auth_user.id, db.auth_user.first_name] In [2]: raw_rows = db.executesql('CALL sp_recursive_start(1);', fields=fields) In [3]: db.rollback() --- ProgrammingError

[web2py] Re: Query Not Supported: (1054, "Unknown column 'daily_counts.add_date' in 'order clause'") No records f

2013-02-25 Thread Dan Kozlowski
I will try the latest build later today. I was also thinking to drop the schema and have DAL build it again. What is the best way to drop a schema and have Web2py build it new ? -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubs

Re: [web2py] Re: Error db._adapter

2013-02-25 Thread Massimo Di Pierro
This is a database issue more than a web2py issue but I am interested to get to the bottom of it. Can you ty open a web2py shell $ python web2py.py -S yourapp -M >>> fields = [db.auth_user.generation, db.auth_user.id, db.auth_user. first_name] >>> raw_rows = db.executesql('CALL sp_recursive_sta

[web2py] Re: Query Not Supported: (1054, "Unknown column 'daily_counts.add_date' in 'order clause'") No records f

2013-02-25 Thread Massimo Di Pierro
Can you check the latest version (nightly)? It would help isolate the problem. On Monday, 25 February 2013 04:53:28 UTC-6, Dan Kozlowski wrote: > > I am running 2.3.2 on Linux with MySQL > > > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" gro

Re: [web2py] Re: Returns a list of all exposed methods

2013-02-25 Thread farzad faramarzi
Thanks Anthony It works for methods which not exposed as service but not method like this @service.json > def echo(data): > return data /F 2013/2/25 Anthony > Here's how the admin app does it: > > import os > from gluon.myregex import regex_expose > mycontroller = open(os.path.join(reque

[web2py] Re: Returns a list of all exposed methods

2013-02-25 Thread Anthony
Here's how the admin app does it: import os from gluon.myregex import regex_expose mycontroller = open(os.path.join(request.folder, 'controllers', 'mycontroller.py'), 'rb').read() exposed_functions = regex_expose.findall(mycontroller) Anthony On Monday, February 25, 2013 4:40:01 AM UTC-5, frass

Re: [web2py] Re: Error db._adapter

2013-02-25 Thread __pyslan__ - Ayslan Jenken
No, Massimo, is not ... With or without the try... except... the error is the same ... I've tried this several times. The code of gist: https://gist.github.com/pyslan/5007364 (without try... except...) print it on the terminal server: ERROR:web2py:Traceback (most recent call last): File "/hom

[web2py] Re: Many to many relationships

2013-02-25 Thread Cliff Kachinske
Toby, The online Web2py manual explains how to set up many-to-many relationships. If this is new to you, start reading about one-to-many relationships and continue from there. http://web2py.com/books/default/chapter/29/06#One-to-many-relation On Monday, February 25, 2013 2:24:48 AM UTC-5, T

[web2py] Re: Many to many relationships

2013-02-25 Thread Niphlod
On Monday, February 25, 2013 8:24:48 AM UTC+1, Toby Wilson wrote: > > > Hi all, > > New to web development and web2py. Know a bit of Python. > > As a learning experience I’ve written a food tracking program that works > really well in Python and it just runs on my local PC. It just reads and >

Re: [web2py] Performance issues while opening webpage with more than 1 lakh records.....

2013-02-25 Thread neha srivastava
Hi All , Thakyou for the reply..actually the real problem was,after the grid was created,we were using a query to fetch the latest record from the database.That query was again traversing 1 lakh records and therefore it was taking time.After replacing the query with latest_record=db.table1.

[web2py] Many to many relationships

2013-02-25 Thread Toby Wilson
Hi all, New to web development and web2py. Know a bit of Python. As a learning experience I’ve written a food tracking program that works really well in Python and it just runs on my local PC. It just reads and writes values into text files. Now I’m trying to transfer that into web2py as a n

[web2py] Re: In search of CAS 2 provider and consumer example

2013-02-25 Thread CrC Nommack
Hi I have the same problem, please help. I'm also in SSL Regards On Friday, February 22, 2013 7:59:11 PM UTC+1, rh wrote: > > On Thu, 21 Feb 2013 11:37:05 -0800 (PST) > Massimo Di Pierro > > wrote: > > > Not sure what example to write. > > > > Make two copies of the welcome app. Call one app

[web2py] Re: Query Not Supported: (1054, "Unknown column 'daily_counts.add_date' in 'order clause'") No records f

2013-02-25 Thread Dan Kozlowski
I am running 2.3.2 on Linux with MySQL -- --- 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:

[web2py] Re: using web2py without session

2013-02-25 Thread Niphlod
sessions are not saved if they don't change. However, session.forget(response) is what you're looking for. BTW, I'd like to see your performance tests to know how much do you think you can achieve disabling sessions On Monday, February 25, 2013 10:30:17 AM UTC+1, guruyaya wrote: > > I need to c

[web2py] Returns a list of all exposed methods

2013-02-25 Thread frasse
Hi I like to have a method to returns a list of all exposed methods in a controller so it can be use in a view. I want to build a information webpage for service consumers (xmlRpc , Json .) that can be updated when I add /update/ remove new service to my application API. Can web2py do it f

[web2py] using web2py without session

2013-02-25 Thread guruyaya
I need to create a performance sensative application. For this reason, I want to skip creating sessions. Just simple request and reply. Is there a way to do that, or web2py just comes with sessions, and I cannot skip it? Thanks in advance Yair -- --- You received this message because you are

[web2py] Re: translation in grid/smartgrid

2013-02-25 Thread Niphlod
Yes, the strings are stored as T() so they are available in the languages (you can find them in appadmin) On Monday, February 25, 2013 5:17:26 AM UTC+1, 黄祥 wrote: > > hi, > > is it possible to translate the grid/smartgrid (button, field view, form, > etc)? > if possible how to do this? > > thank

[web2py] DAL : Compute Fields and validate_and_insert ?

2013-02-25 Thread Sebastien Stormacq
Hello, I am using compute fields on a table. The data are inserted with validate_and_insert method from args received in the URL. None of my compute fields are added to the DB. Question : is the validate_and_insert method supposed to trigger compute fields ? Thanks Seb -- --- You receive