[web2py] Re: Is anyone using MongoDB with web2py?

2010-05-08 Thread David Marko
Thank you for your response. I still have the problem with the connection object to MongoDB as stated in my first post. Where to put the lines establishing the connection? - If I put the code below into db.py, each request causes the new connection opened to MongoDB what mean that after 50

Re: [web2py] Re: Why not session['key'] ?

2010-05-08 Thread Thadeus Burgess
The reason is session.button1 returns None if the key is not found whereas session['button1'] raises an exception when the key is not found. This is typically python behavior. -- Thadeus On Sat, May 8, 2010 at 11:44 PM, ionel wrote: > I think I found a bug. > > Traceback (most recent c

[web2py] Re: Why not session['key'] ?

2010-05-08 Thread ionel
I think I found a bug. Traceback (most recent call last): File "G:\dev\proj\python\web2py\gluon\restricted.py", line 178, in restricted exec ccode in environment File "G:\dev\proj\python\web2py\applications\myapp/views\default/ index.html", line 97, in KeyError: 'button1' If you don't

[web2py] Re: Why not session['key'] ?

2010-05-08 Thread ionel
Mea culpa! Yes, they are equivalent. My key was empty... sorry. I think I'm tired... Thank you very much. ionel On May 8, 11:27 pm, mdipierro wrote: > They should be equivalent. Can you show the traceback? > > On May 8, 9:54 pm, ionel wrote: > > > But I allready did that... and its working..

[web2py] Re: Calculation error

2010-05-08 Thread greenpoise
Ok, Will try. Thanks On May 8, 11:39 pm, mdipierro wrote: > P.S. perhaps this should be changed. Decimal is not used very much and > not supported well on sqlite at all. I would use float. > > On May 8, 10:38 pm, mdipierro wrote: > > > There are two problems: > > 1)  order is reserved keyword.

[web2py] Re: Is anyone using MongoDB with web2py?

2010-05-08 Thread Yarko Tymciurak
On May 8, 12:40 pm, David Marko wrote: > Yes, I know, but you should be able to use it without DAL using > pymongo as a primary MongoDB python driver. And thats where my > question goes. If you want to experiement, and get a start, I suggest you write your scaffolding app without / with minimal d

[web2py] Re: Calculation error

2010-05-08 Thread mdipierro
P.S. perhaps this should be changed. Decimal is not used very much and not supported well on sqlite at all. I would use float. On May 8, 10:38 pm, mdipierro wrote: > There are two problems: > 1)  order is reserved keyword. > 2) decimal types are treated as string internally and there for > comput

[web2py] Re: Calculation error

2010-05-08 Thread mdipierro
There are two problems: 1) order is reserved keyword. 2) decimal types are treated as string internally and there for compute should be db.order.tipgranted.compute=lambda r: float(r['totalsale'])*float(r['tipvalue']) or better db.order.tipgranted.compute=lambda r: decimal.Decimal(r['totalsale']

[web2py] Re: Calculation error

2010-05-08 Thread Iceberg
Is that possibly because the default value of tipvalue is a string '0.15'? Try use float 0.15 instead. -- Iceberg On May9, 11:00am, greenpoise wrote: > Model: > > db.define_table('order', >     Field('employee',db.person), >     Field('tablenumber'), >     Field('ordernumber'), >     Field('orde

[web2py] Re: Why not session['key'] ?

2010-05-08 Thread mdipierro
They should be equivalent. Can you show the traceback? On May 8, 9:54 pm, ionel wrote: > But I allready did that... and its working... > > Something like that: > > if not session.c: >     c = MyClass() >     session.c = c > else: >     c = session.c > > But my question was why I cannot use sessio

[web2py] Re: Calculation error

2010-05-08 Thread greenpoise
Model: db.define_table('order', Field('employee',db.person), Field('tablenumber'), Field('ordernumber'), Field('orderdate','date'), Field('totalsale', 'decimal(10,2)'), Field('tipgranted', 'decimal(10,2)',default=None, update=None, readable=False), Field('tipvalue','dec

[web2py] Re: Calculation error

2010-05-08 Thread mdipierro
Can you show us the model and the action that triggers this? On May 8, 9:49 pm, greenpoise wrote: > Can someone help me. I am trying to do a simple calculation of fields. > Fields are defined as decimal in db.py and here is the calculation: > >     db.order.tipgranted.compute=lambda r: r['totalsa

[web2py] Re: Why not session['key'] ?

2010-05-08 Thread ionel
But I allready did that... and its working... Something like that: if not session.c: c = MyClass() session.c = c else: c = session.c But my question was why I cannot use session['c'] instead of session.c Thank you! i On May 8, 9:31 pm, mdipierro wrote: > You cannot store your own

[web2py] Calculation error

2010-05-08 Thread greenpoise
Can someone help me. I am trying to do a simple calculation of fields. Fields are defined as decimal in db.py and here is the calculation: db.order.tipgranted.compute=lambda r: r['totalsale']*r['tipvalue'] error: TypeError: can't multiply sequence by non-int of type 'float'

Re: [web2py] Re: New to web app development -- is web2py a good choice

2010-05-08 Thread Miguel Lopes
Yeah! shows how conservative I am :-) On Fri, May 7, 2010 at 10:10 PM, mdipierro wrote: > > Massimo already answered this. But I've been using web2py from the > > beginning, have a site running on it with absolutely no problems. > Upgrading > > to a new release is as simple as (well just import

[web2py] Re: Why not session['key'] ?

2010-05-08 Thread mdipierro
You cannot store your own classes in the session because the session is retrieved before your own classes are defined. You can only store in session primitive types. You can serialize your objects yourself. On May 8, 7:30 pm, ionel wrote: > Hello, > > I'd like to have something like that: > > cla

[web2py] Re: how to use easy_install

2010-05-08 Thread mdipierro
If you are running web2py binary (web2py.exe) you cannot use easy_insall. to use easy_install you need to 1) download and install python 2.5 or 2.6 2) download and distutil for python 2.5 or 2.6 (this gives you easy_install) 3) download are run web2py source (web2py.py) 4) download any other packag

[web2py] Why not session['key'] ?

2010-05-08 Thread ionel
Hello, I'd like to have something like that: class MyClass(): def __init__(self, id) self.id = id c = MyClass('some_id') session[c.id] = c I do not see a solution for this. Can somebody help me? Thanks. i.

[web2py] how to use easy_install

2010-05-08 Thread jayveesea
hello. i just downloaded web2py (for windows) unzipped it and launched web2py in console like this... web2py.exe -S welcome now i am trying to add a module. and i try this command... "easy_install ipython" or "easy_install numpy" ...but it does not like it and i get the following... File "

Re: [web2py] is row.update(name='someone') really works??

2010-05-08 Thread Vasile Ermicioi
web2py is always backward compatible, you can use either row.update or row.update_record but if you use db(db.cdsdata.id>0).select('extracted') you can't use update_record because your rows didn't received an id from db so you ca use any of this rows=db(db.cdsdata.id>0).select() rows=db(db.cdsdata

[web2py] Re: Routes.py not working when deployed to GAE

2010-05-08 Thread Dane
Looks like the error is being raised in this block of rewrite.py.. is this due to an attempt to interact with the file system? def load(routes='routes.py'): symbols = {} if not os.path.exists(routes): return try: routesfp = open(routes, 'r') exec routesfp.read()

[web2py] Re: New to web app development -- is web2py a good choice

2010-05-08 Thread weheh
Interesting observation, Thadeus. Who knows how accurate, but it resonates with me. According to one of the Django developers, Django was designed with the notion that designers and engineers don't mix, so the templating language and syntax are different from the server- side db interface and busin

[web2py] Re: Fullcalendar with JSON

2010-05-08 Thread Francisco Costa
Thank you for your answer Thadeus. I was able to understand the issue of the problem. On May 8, 5:27 pm, Thadeus Burgess wrote: > That is incorrect, and only if you want to run that example.. I use > fullcalendar and I have it at /init/people/calendar.html and I have > the json at /init/ajax_lib

Re: [web2py] is row.update(name='someone') really works??

2010-05-08 Thread Thadeus Burgess
Looks like you are not running the latest version of web2py . -- Thadeus On Sat, May 8, 2010 at 4:34 PM, Eldr3D wrote: > Hello all > > i just back to web2py a few weeks ago and i am still learning all the > new changes reading online official web2py book. > > currently i am using web2py DALs

Re: [web2py] migratin apps

2010-05-08 Thread Thadeus Burgess
Your tables already exist in the database. However you must have deleted your /app/databases/*.table files, so as far as web2py is concerned it is a blank database. To remedy the solution, add this to each of your define table statements db.define_table('.', fake_migrate=True) Run your code

[web2py] migratin apps

2010-05-08 Thread Tomas Pelka
Hi all, is there any advice how to migrate my web2py application. I have shared postgress db. When I start up new instance (simple copied) of my app, I always get following traceback: Traceback (most recent call last): File "/home/tom/web2py/gluon/restricted.py", line 178, in restricted

[web2py] is row.update(name='someone') really works??

2010-05-08 Thread Eldr3D
Hello all i just back to web2py a few weeks ago and i am still learning all the new changes reading online official web2py book. currently i am using web2py DALs in a non web-application , so to parse and import data from text files into database (to update records). here is the example of what

[web2py] Re: post via mail

2010-05-08 Thread Pepe
good! anew: i will try :) thanks Massimo! On May 7, 5:17 pm, mdipierro wrote: > Yes but in a different way. Your VPS.net server probably can already > receive emails (assuming there is account with the name of the > receiver). > You just need a script that uses pop to fetch emails from the inbo

[web2py] Re: Routes.py not working when deployed to GAE

2010-05-08 Thread Dane
I tried this. It works locally, but still having problems when deployed. Now I'm getting a 500. Here's the traceback: : invalid syntax (, line 1) Traceback (most recent call last): File "/base/data/home/apps/tthultimate/1.341813257625966505/ gaehandler.py", line 42, in import gluon.main

[web2py] Re: Routes.py not working when deployed to GAE

2010-05-08 Thread mdipierro
Can you try? routes_in = ((/crossdomain.xml', '/init/static/crossdomain.xml'),) On May 8, 11:58 am, Dane wrote: > Hello, > > In my routes.py file, I have this line: > > routes_in = (('.*:/crossdomain.xml', '/init/static/crossdomain.xml'),) > > Working locally, if I go tohttp://localhost:8080/cro

[web2py] Re: WebGrid for Web2py and Keyerror

2010-05-08 Thread mr.freeze
Did you delete the default DAL declaration at the top of db.py? Your code works for me. On May 8, 2:04 pm, winti wrote: > i changed it to myid and i get a error on: > KeyError: 'myid' > > Stefan > > On May 8, 8:51 pm, "mr.freeze" wrote: > > > 'identity' is probably a reserved word in sqlite. Try

[web2py] Re: How to set multiple primary key?

2010-05-08 Thread Iceberg
I am not dealing with legacy tables, I am just starting a new db and wondering whether I can set multiple primary key, in order to eliminate the chance of duplicated data. For example. db = DAL('sqlite://storage.sqlite') db.define_table('account', Field('given_name'),

[web2py] Re: How to set multiple primary key?

2010-05-08 Thread DenesL
Multiple primary keys should work if you are defining legacy tables in one of the supported DB engines. Are you using MS SQL, DB2, Ingres or Informix? Can we see the model? On May 8, 5:57 am, Iceberg wrote: > Hi there, > > I am fiddling multiple primary keys. Somehow I managed to find > followi

[web2py] Re: WebGrid for Web2py and Keyerror

2010-05-08 Thread winti
i changed it to myid and i get a error on: KeyError: 'myid' Stefan On May 8, 8:51 pm, "mr.freeze" wrote: > 'identity' is probably a reserved word in sqlite. Try changing it to > something else. > > On May 8, 1:36 pm, winti wrote: > > > > > Hello, > > in a controller i define a temp db and want

[web2py] Re: WebGrid for Web2py and Keyerror

2010-05-08 Thread mr.freeze
'identity' is probably a reserved word in sqlite. Try changing it to something else. On May 8, 1:36 pm, winti wrote: > Hello, > in a controller i define a temp db and want to return the results with > webgrid to a view. > I get a Keyerror on 'identity'. > > Traceback (most recent call last): >  

[web2py] WebGrid for Web2py and Keyerror

2010-05-08 Thread winti
Hello, in a controller i define a temp db and want to return the results with webgrid to a view. I get a Keyerror on 'identity'. Traceback (most recent call last): File "/data/projects/frameworks/web2py/applications/gluon/ restricted.py", line 178, in restricted exec ccode in environment F

[web2py] Re: Is anyone using MongoDB with web2py?

2010-05-08 Thread David Marko
Yes, I know, but you should be able to use it without DAL using pymongo as a primary MongoDB python driver. And thats where my question goes. David On 8 kvě, 19:22, Pystar wrote: > For now, Web2py's DAL doesnt support NoSQL databases. I think Massimo > can tell us more on the status of the DAL r

[web2py] Re: Is anyone using MongoDB with web2py?

2010-05-08 Thread Pystar
For now, Web2py's DAL doesnt support NoSQL databases. I think Massimo can tell us more on the status of the DAL rewrite and when it would be possible. On May 8, 5:59 pm, David Marko wrote: > Is anyone using MongoDB with web2py? How do you 'share' connection > object in your app when using pymongo

[web2py] Is anyone using MongoDB with web2py?

2010-05-08 Thread David Marko
Is anyone using MongoDB with web2py? How do you 'share' connection object in your app when using pymongo? If I put the code below into db.py, each request causes the new connection opened to MongoDB what mean that after 500 requests to my app, there are 500 separate connections I can see on MongoD

[web2py] Routes.py not working when deployed to GAE

2010-05-08 Thread Dane
Hello, In my routes.py file, I have this line: routes_in = (('.*:/crossdomain.xml', '/init/static/crossdomain.xml'),) Working locally, if I go to http://localhost:8080/crossdomain.xml , the file is there. However, when I upload to google app engine, http://www.mydomain.appspot.com/crossdomain.

Re: [web2py] New to web app development -- is web2py a good choice

2010-05-08 Thread Jason Brower
Yup... the software I create with web2py is stricty internal anyway. They honestly would fire me if it looked too good. I would be wasting there money. :P Best Regards, Jason On Sat, 2010-05-08 at 11:30 -0500, Thadeus Burgess wrote: > One thing I have noticed is django and RoR is for the most pa

Re: [web2py] New to web app development -- is web2py a good choice

2010-05-08 Thread Thadeus Burgess
One thing I have noticed is django and RoR is for the most part, a designer oriented community. IE: Lots of designers, few real programmers/engineers, this is why you see design-oriented keywords floating around in those frameworks. Most of us here in the web2py community are programmers/engineers/

Re: [web2py] Fullcalendar with JSON

2010-05-08 Thread Thadeus Burgess
That is incorrect, and only if you want to run that example.. I use fullcalendar and I have it at /init/people/calendar.html and I have the json at /init/ajax_lib/events.json. You just need to make sure to return the correct JSON structure that fullcalendar understands. You will need a custom json

[web2py] Re: question about webfactional

2010-05-08 Thread Pai
that works! Thanks annet! On May 8, 1:52 am, annet wrote: > Pai, > > The solution to your problem is described in this thread: > > http://groups.google.com/group/web2py/browse_thread/thread/504dd2deff... > > Basically you have to log on to webfaction via terminal/ssh and > manually create a di

Re: [web2py] Re: Bug and fix about IS_DATE_IN_RANGE()

2010-05-08 Thread Jonathan Lundell
On May 8, 2010, at 12:52 AM, Iceberg wrote: > Thanks for the quick response and fix. But one more comment when > talking about doctest. You current doctest cases does not qualified to > catch the bug. You need to design cases for critical point. Besides, > you need not use "print" in doctest. Rig

Re: [web2py] New to web app development -- is web2py a good choice

2010-05-08 Thread Alexei Vinidiktov
On Thu, May 6, 2010 at 12:37 PM, Anthony wrote: [...] > From what I've read, web2py sounds like a great framework -- > comprehensive, well-integrated, easy to set up, learn, and deploy, > etc. However, although it sounds good on paper, I haven't yet found a > single site built with web2py that lo

[web2py] Re: ToscaWidgets

2010-05-08 Thread lannick
Hi, Nobody know Toscawidgets and have try it with web2py ? Regards, Lannick On 26 avr, 13:14, lannick wrote: > Hi, > > Does anyone know and have used ToscaWidgets with web2py ? (http:// > toscawidgets.org/ ) > > Regards, > Lannick > > -- > Subscription settings:http://groups.google.com/group/w

[web2py] Re: Reverse Search with .like

2010-05-08 Thread AsmanCom
Hey Guys, that helped a lot! with a lil correction it works very nice. Thanks for the Support. On 8 Mai, 04:18, Russell wrote: > You might want to try something like this:. > >     from gluon.sql import Expression >     db(table1.field1.like(Expression("('%' || table2.field2 || > '%')".selec

[web2py] How to set multiple primary key?

2010-05-08 Thread Iceberg
Hi there, I am fiddling multiple primary keys. Somehow I managed to find following example inside gluon/sql.py db.define_table('account', Field('accnum','integer'), Field('acctype'), Field('accdesc'), primarykey=['accnum','acctype']) But running th

[web2py] Re: jquery click function problem

2010-05-08 Thread salbefe
Thank you Massimo !! Regards On 7 mayo, 23:22, mdipierro wrote: > Because s are not executed in ajax loaded content. It is a > browser thing. It is not in the specs. You can do > >
Hello div> >
World

[web2py] _onclick to close window

2010-05-08 Thread annet
In custom_ajax.html I defined the following function: function closeWin() { window.close(); return false; } I a function I added a cancel button to a form: This one works: form[0][-1] [1].append(INPUT(_type='button',_value='Cancel',_onclick='javascript:history.go(-1)')) This one doesn't:

[web2py] Fullcalendar with JSON

2010-05-08 Thread Francisco Costa
Hello, I'm trying to use Fullcalendar in my app, and I would like to call events from a JSON external file like this example: http://arshaw.com/js/fullcalendar/examples/json.html The problem is that I must have the JSOn file in the same directory as the .html How can I do this in web2py?

[web2py] Re: Bug and fix about IS_DATE_IN_RANGE()

2010-05-08 Thread Iceberg
Thanks for the quick response and fix. But one more comment when talking about doctest. You current doctest cases does not qualified to catch the bug. You need to design cases for critical point. Besides, you need not use "print" in doctest. For example, the current trunk: >>> v = IS_DATE

[web2py] Re: Data table

2010-05-08 Thread annet
Hi Sverre, Here's an example of how you would make the id a link: company id company name {{for company in rows:}} {{=A(company.id,_onmouseover="this.style.cursor='pointer';", \ _onclick="javascript:clublocatordetails('%s')"%URL(r=re