[web2py] Re: a few questions

2011-03-23 Thread niknok
Thanks for asking the right question. When I saw "define", I took a look into the code and noticed that I left it undefined, even with a requires = ..., it's still defaulted to a string type. I just tryied the radioboxes but I'm getting an extra radio button displayed and some fluff. I edited out

[web2py] Re: [tip] Head JS script loader

2011-03-23 Thread pbreit
I know there are a million of these but this one looked promising, too: http://yepnopejs.com/

[web2py] Re: Menu based on Boolean table fields.

2011-03-23 Thread annet
Hi Denes, Thanks for your reply and explanation, problem solved. In the controller I have: session.row=db(db.cardfunction.company_id==session.id).select(db.cardfunction.ALL).first() ... so in the view I needed: {{if session.row[_name.lower()]:}} Kind regards, Annet.

[web2py] Re: a few questions

2011-03-23 Thread DenesL
On Mar 23, 3:35 am, niknok wrote: > Thanks for asking the right question. When I saw "define", I took a > look into the code and noticed that I left it undefined, even with a > requires = ..., it's still defaulted to a string type. > > I just tryied the radioboxes but I'm getting an extra radio

[web2py] Display image from db

2011-03-23 Thread Vincent Davis
I have used the wizard to start working on an app. one of the tabled upload an file (image). How should I modify the view/control to display the image? The view and control and db are those created by the wizard but I have pasted them below. What is the recommended way to require the uploaded file

[web2py] Re: File Upload and save to DB

2011-03-23 Thread villas
Hi Ialejandro Take a look at Massimo's csvStudio. There is also a video on vimeo. I remember that you can make models from the CSV data and manipulate the data with simple methods. -D On Mar 23, 1:39 am, Ialejandro wrote: > HI everyone!! this time I have a new question... > > I'm developing

[web2py] Re: can web2py "internal webserver" handle serveral requests in parallel?

2011-03-23 Thread olivier
Thanks for the clarification on session behavior. I tried to unlock the session (or to forget it) in the controller but it seems requests from the same user are still handled sequentially. Is it possible to have the same user request two pages at the same time or am I missing something? On Mar 22

Re: [web2py] Display image from db

2011-03-23 Thread Kenneth Lundström
In your controller/default.py you probably have function defined as: def download(): return response.download(request,db) To view a picture do something like this in your controller: record = db(db.t_student.id == 2).select() if len(record): record = record[0] return dict(record=record) In

Re: [web2py] Display image from db

2011-03-23 Thread Kenneth Lundström
To answer your second question: there is a validator named IS_IMAGE so in your model you could write something like: Field('f_image', type='upload', represent=lambda x: x and A('download',_href=URL('download',args=x)) or '', label=T('Image') requires = IS_EMPTY_OR(IS_IMAGE('j

[web2py] OpenERP like widgets

2011-03-23 Thread Indra Gunawan
Hi, any idea how to create application (I mean the view, javascript/ajax widget etc) like this http://demo.openerp.com/ ? Using Web2Py off course. OpenERP also build from python: 1. Server (XML-RPC) -> Python 2. Web Client http://demo.openerp.com/ -> TurboGears (this presentation layer interest me

Re: [web2py] Display image from db

2011-03-23 Thread Anthony
Hi Kenneth, Just curious -- is there any reason why you use TAG.img instead of the built-in IMG helper? Thanks. Anthony On Wednesday, March 23, 2011 7:21:00 AM UTC-4, Kenneth wrote: > In your controller/default.py you probably have function defined as: > > def download(): return response.

[web2py] Re: new URL router use cases

2011-03-23 Thread Massimo Di Pierro
This is not an option in web2py because the controller is executed after the requests arrives not imported before (as in Flask). Anyway, that works better for simple apps but becomes a mess if you have many functions because the routing info is scattered all over the place. Moreover - when it comes

Re: [web2py] Display image from db

2011-03-23 Thread Kenneth Lundström
> Just curious -- is there any reason why you use TAG.img instead of the built-in IMG helper? No, I just took that example from a working page. I don´t know why TAG.img is used. Kenneth Thanks. Anthony On Wednesday, March 23, 2011 7:21:00 AM UTC-4, Kenneth wrote: In your controller/d

[web2py] Re: Rearrange FORM

2011-03-23 Thread Massimo Di Pierro
I suggest you do form=SQLFORM.factory(Field('hello')) and you have form.custom. On Mar 22, 11:31 pm, Ashwin Purohit wrote: > How do rearrange form fields like I want to in the view, if I don't have a > SQLFORM with a form.custom, but just a regular FORM: > > form=FORM(INPUT(_name='hello'), >  

[web2py] Re: another video: web2py components

2011-03-23 Thread Massimo Di Pierro
A component requires an action. A action can return multiple objects as long as you have a view to arrange them. perhaps something like this: from gluon.template import render def index(): """ {{=LOAD('default','combined',ajax=True)}} """ return render(content=index.__do

[web2py] Re: new URL router use cases

2011-03-23 Thread Anthony
Massimo, I think Tom was referring to Flask's ability to include an arg at an arbitrary place in the URL path (e.g., '//users'), not the ability to specify the routes via decorators. I think the former *can* be achieved in web2py using the pattern-based rewrite system, right? Anthony On Wedne

[web2py] Newbie Question: jqGrid fail on Firefox 4

2011-03-23 Thread Willoughby
I've inherited a web2py app running v1.61.1 and some form of jqGrid(?) for displays. Everything has been humming along but now discovered that the grids fail to display in Firefox 4. And yes, I know Firefox 4 is the ultimate culprit - but has anyone seen this issue yet? Thanks...

[web2py] onmouseover

2011-03-23 Thread Kenneth Lundström
Is it possible to use onmouseover when using helpers? I tried to use TD(_onmouseover="" but get an error ticket saying SyntaxError:invalid syntax Kenneth

[web2py] Re: new URL router use cases

2011-03-23 Thread Massimo Di Pierro
yes. For example: routes_in = [ ('/$yoursitename/users','/init/default/users/$yoursitename'), ] the optionally @request.restful() def users(): def GET(yoursitename): return dict(message='your site name is: '+yoursitename) return locals() On Mar 23, 2011, at 8:31 AM

[web2py] Re: onmouseover

2011-03-23 Thread Massimo Di Pierro
Yes. The error is probably in other order TD(_onmouseover="","content") WRONG TD("content",_onmouseover="") RIGHT On Mar 23, 8:38 am, Kenneth Lundström wrote: > Is it possible to use onmouseover when using helpers? > > I tried to use TD(_onmouseover="" but get an error ticket saying

[web2py] Re: another video: web2py components

2011-03-23 Thread mart
Nice! Thanks Massimo! That helps a lot! :) On Mar 23, 9:26 am, Massimo Di Pierro wrote: > A component requires an action. A action can return multiple objects > as long as you have a view to arrange them. perhaps something like > this: > > from gluon.template import render > > def index(): >    

[web2py] Re: Display image from db

2011-03-23 Thread Vincent Davis
On Mar 23, 5:21 am, Kenneth Lundström wrote: > In your controller/default.py you probably have function defined as: > > def download(): return response.download(request,db) > > To view a picture do something like this in your controller: > record = db(db.t_student.id == 2).select() > if len(reco

[web2py] compute field with list:reference

2011-03-23 Thread goutham v
Please look at the attachment. for DB screenshot in db.py contents of define_table Field('tags','list:reference tags'), Field('refval','string', compute=lambda r:r['tags']), Field('min_tag_id','integer', compute=lambda r:min(r['tags'])), Field('max_tag_id','integer', compute=lambd

[web2py] dal trunk has sapdb support (need tester)

2011-03-23 Thread Massimo Di Pierro
You need to install SAP MAXDB (free) and python-sapdb driver. connect with DAL('sapdb://user:password@host/database') If you test it please let me know. I did not have time to test it myself.

[web2py] Re: compute field with list:reference

2011-03-23 Thread Massimo Di Pierro
replace min(r['tags']) with min((int(x) for x in r['tags'])) looks like you have lists of strings instead of lists of integer references. Which web2py version are you using? Massimo On Mar 23, 9:29 am, goutham v wrote: > Please look at the attachment. for DB screenshot > > in db.py  contents of

[web2py] Re: can web2py "internal webserver" handle serveral requests in parallel?

2011-03-23 Thread Ross Peoples
Unless there is some unknown trick, I was unable to find a way to make this work, which is why I turned my script into a subclass of Process. Though I do know Rocket can handle multiple simultaneous downloads at once since it allows the browser to download multiple files from /static at the same

[web2py] Re: compute field with list:reference

2011-03-23 Thread goutham v
the fix worked thanks massimo. and I am using Version 1.93.2 (2011-03-04 23:48:59)

[web2py] Re: can web2py "internal webserver" handle serveral requests in parallel?

2011-03-23 Thread Massimo Di Pierro
There are two things that may lock: one is the user session (you can check it by opening two pages with two distinct browsers like firefox and chrome); the sqlite database (that is how sqlite works). We cannot tell what is wrong in your case without a code example and a workflow example. I am pret

[web2py] IS_INT_IN_RANGE Behavior in Database Example

2011-03-23 Thread Jaunx
In Example 29 of the "Database Examples" of the Quick Examples tutorial, the last line of the model definition file (db.py) puts the following constraint on the purchases.quantity field: db.purchases.quantity.requires=IS_INT_IN_RANGE(0,10) In Example 33, the controller for the purchase form (fo

Re: [web2py] IS_INT_IN_RANGE Behavior in Database Example

2011-03-23 Thread David J.
I suppose to override; The example you gave would be pointless to have both; Clearly if you define it once at the model; then again in the controller; shouldn't the one define in the controller take precedence; How else would you override? On 3/23/11 11:45 AM, Jaunx wrote: In Example 29 of

[web2py] Re: IS_INT_IN_RANGE Behavior in Database Example

2011-03-23 Thread Massimo Di Pierro
Thins constraint >   db.purchases.quantity.requires=IS_INT_IN_RANGE(0,10) is enforced in form=crud.create(db.purchases) form=crud.update(db.purchases,record) form=SQLFORM(db.purchases) form=SQLFORM.factory(...,db.purchases.quantity,...) It is not enforced in forms built manually, like HTML and

[web2py] Re: dal trunk has sapdb support (need tester)

2011-03-23 Thread Massimo Di Pierro
No particular reason. I saw SQLObjects had support for it and it took 5 minutes to add web2py support. Massimo On Mar 23, 11:30 am, mart wrote: > SAP?? as in webAS ? I spent years working on the SAP side of liveCycle > framework (there's that word again... I still like it;) ) Anyways, > just out

[web2py] Re: dal trunk has sapdb support (need tester)

2011-03-23 Thread mart
SAP?? as in webAS ? I spent years working on the SAP side of liveCycle framework (there's that word again... I still like it;) ) Anyways, just out of curiosity (and really, I am curious and surprised) why SAP? Is there popularity for this? (i don't just mean from a web2py perspective, I mean in gen

[web2py] Re: IS_INT_IN_RANGE Behavior in Database Example

2011-03-23 Thread villas
If I undertood correctly, you expect the model to have priority over any other validation constraints. This is not how it works in web2py. You may override validations at any point and my experience is that it is very useful to do so. If you wish to enforce a DB constraint which could not be ov

Re: [web2py] Re: Alternative for annoying default javascript integer/double/decimal validtors

2011-03-23 Thread mattynoce
it seems something has to be done about the internationalization, but i think this solution is definitely a step in the right direction. as i posted earlier (https://groups.google.com/d/topic/web2py/HTBuheF-xzs/discussion), this is a big problem in safari and chrome, and leads to a bad user exp

[web2py] postings from last 24 hours disappeared?

2011-03-23 Thread mart
I seem to have lost all posting since yesterday morning... is it just me? they were all there up until ~ 20 minutes ago... hum... this seemed to have happened the minute I replied to the SAP db posting... I guess they are that big ;)

[web2py] Re: postings from last 24 hours disappeared?

2011-03-23 Thread Anthony
On Wednesday, March 23, 2011 1:11:25 PM UTC-4, mart wrote: > > I seem to have lost all posting since yesterday morning... is it just > me? they were all there up until ~ 20 minutes ago... hum... > > this seemed to have happened the minute I replied to the SAP db > posting... I guess they are th

[web2py] Re: Alternative for annoying default javascript integer/double/decimal validtors

2011-03-23 Thread Massimo Di Pierro
actually the IS_INT_IN_RANGE(...) has a separator attribute. The only missing thing is a mechanism to tell JS about it. As a simple solution we could accept both (. and ,) and let the validator give the proper localized interpretation. On Mar 23, 12:24 am, Kenneth Lundström wrote: > It's the sa

[web2py] Re: postings from last 24 hours disappeared?

2011-03-23 Thread Mart
Just checked now, and now I see them again! :) went missing for about 30 minutes. That was just too strange! Thanks! Mart :) On 2011-03-23, at 1:47 PM, Anthony wrote: > On Wednesday, March 23, 2011 1:11:25 PM UTC-4, mart wrote: > I seem to have lost all posting since yesterday morning... is it

[web2py] Re: postings from last 24 hours disappeared?

2011-03-23 Thread Anthony
I've had that problem before too. On Wednesday, March 23, 2011 2:05:25 PM UTC-4, mart wrote: > Just checked now, and now I see them again! :) went missing for about 30 > minutes. That was just too strange! > > Thanks! > Mart :) > > On 2011-03-23, at 1:47 PM, Anthony wrote: > > On Wednesday, Ma

[web2py] Re: dal trunk has sapdb support (need tester)

2011-03-23 Thread mart
right... did you find a MACOS driver (maybe they are hiding their support for it? ;) ). If not I'll just boot up a linux box. Thanks, Mart :) On Mar 23, 12:35 pm, Massimo Di Pierro wrote: > No particular reason. I saw SQLObjects had support for it and it took > 5 minutes to add web2py support.

[web2py] Re: postings from last 24 hours disappeared?

2011-03-23 Thread pbreit
The new google groups still seems to be struggling occasionally.

[web2py] Re: postings from last 24 hours disappeared?

2011-03-23 Thread mart
this is good to know... was considering raising daily caffein intake. ;) On Mar 23, 2:23 pm, pbreit wrote: > The new google groups still seems to be struggling occasionally.

[web2py] Re: can web2py "internal webserver" handle serveral requests in parallel?

2011-03-23 Thread Anthony
Massimo, if one thread/request locks the session file, can a second request unlock the file, or does it have to be unlocked within the same request that locked it? For example, let's say a page includes two components (via LOAD) -- if the request for component1 locks the session, can the compone

Re: [web2py] Re: can web2py "internal webserver" handle serveral requests in parallel?

2011-03-23 Thread Jonathan Lundell
On Mar 23, 2011, at 11:36 AM, Anthony wrote: > Massimo, if one thread/request locks the session file, can a second request > unlock the file, or does it have to be unlocked within the same request that > locked it? For example, let's say a page includes two components (via LOAD) > -- if the requ

[web2py] Re: Runnning my new app

2011-03-23 Thread Hal Smith
I hate to seem like a weak sister, but I am having problems again. One page 88 of the manual, you said to modify the code in the views/default/index. There is already a lot of html in in this file, but it didn't seem to be in the order I expected. It doesn't start off with for example, it jus

[web2py] Generate response.menu from a model

2011-03-23 Thread Miguel
Hi, im trying to generate a response.menu with category similar to the one described here by mdipierro: http://groups.google.com/group/web2py/browse_thread/thread/73056f518dd8b554/02bc66127749782e?lnk=gst&q=menu+vertical#02bc66127749782e the problem im facing is that i have no idea on how to gen

[web2py] Re: Runnning my new app

2011-03-23 Thread pbreit
This is a concept that you have to get a firm grasp of. There is a file "layout.html" that contains all of the base HTML that you might want on every page in your site. It has a templating instruction {{include}} which is where each of your individual view files will get inserted. If you recal

[web2py] Re: Alternative for annoying default javascript integer/double/decimal validtors

2011-03-23 Thread Kevin Ivarsen
I was about to suggest the same thing as Massimo. It's a trivial change to the regex; I think the following works: if (! this.value.match(/^[+-]?[0-9]*[.,]?[0-9]*$/)) { I like the simplicity of this method, even if it doesn't provide perfect client-side validation. Getting data about arbitrary

[web2py] Re: can web2py "internal webserver" handle serveral requests in parallel?

2011-03-23 Thread Anthony
On Wednesday, March 23, 2011 7:15:59 AM UTC-4, olivier wrote: > > Thanks for the clarification on session behavior. > I tried to unlock the session (or to forget it) in the controller but > it seems requests from the same user are still handled sequentially. > Is it possible to have the same us

[web2py] Re: IS_INT_IN_RANGE Behavior in Database Example

2011-03-23 Thread Jaunx
Logically -- without much web2py familiarity -- I would think that the constraints specified in the model would be be applied absolutely anywhere the model is used. So when you have a constraint like in the example model: db.purchases.quantity.requires=IS_INT_IN_RANGE(0,10) The model would pre

[web2py] Re: Runnning my new app

2011-03-23 Thread Hal Smith
This is the kind of thing I have been wondering about: what is going on under the hood? I was simply doing what the manual told me to do - even if I wasn't sure what it wanted. The manual needs to be updated. From: pbreit To: web2py@googlegroups.com Cc: Hal

[web2py] Re: IS_INT_IN_RANGE Behavior in Database Example

2011-03-23 Thread Massimo Di Pierro
There are two reason it is done this way: 1) one reason is that if a check fails there must be a way to report to the users. Forms have a mechanism for this but db.table.insert does not, in general 2) if you want the check done in insert you can call db.table.validate_and_insert 3) there is no way

[web2py] Small typo in Example 18

2011-03-23 Thread Bruno da Silva Assis
Hi! I was looking thru the Examples page when I stumbled upon a small typo on Example 18: 5. {{number.capitalize()}} Note that the closing tag should be . I've noticed this because in Internet Explorer 8 it renders in a quite strange way. In Firefox (and probably WebKit) it renders OK, so you

[web2py] Re: Runnning my new app

2011-03-23 Thread Anthony
On Wednesday, March 23, 2011 4:58:45 PM UTC-4, Hal Smith wrote: > > This is the kind of thing I have been wondering about: what is going on > under the hood? > > I was simply doing what the manual told me to do - even if I wasn't sure > what it wanted. The manual needs to be updated. > Note,

[web2py] Re: IS_INT_IN_RANGE Behavior in Database Example

2011-03-23 Thread Anthony
On Wednesday, March 23, 2011 5:33:45 PM UTC-4, Massimo Di Pierro wrote: > > 2) if you want the check done in insert you can call > db.table.validate_and_insert How long has that been around? I don't think it's in the book, is it?

[web2py] Re: IS_INT_IN_RANGE Behavior in Database Example

2011-03-23 Thread niknok
re validate_insert I think it's a custom function. Read back the post made by Massimo about a week ago ... On Mar 24, 5:45 am, Anthony wrote: > On Wednesday, March 23, 2011 5:33:45 PM UTC-4, Massimo Di Pierro wrote: > > > 2) if you want the check done in insert you can call > > db.table.validate

[web2py] Re: another video: web2py components

2011-03-23 Thread selecta
> Because we do not use them enough and feel we have room for > improvement. ha what do you mean? components are my fav in web2py :D http://www.web2pyslices.com/main/slices/take_slice/74 http://pymantis.org/ -> plugin_restapidoc created it within a few hours with the heavy use of components ht

[web2py] Re: Runnning my new app

2011-03-23 Thread Anthony
Hmm, that is odd. Can you send the whole app? On the admin Site page, just click the "pack all" button for the app, and it will pack everything into a .w2p file. On Wednesday, March 23, 2011 6:15:18 PM UTC-4, Hal Smith wrote: > My controllers/default.py define index() has the return dic code.

Re: [web2py] another video: web2py components

2011-03-23 Thread Bruno Rocha
I like to use components, and I am using it heavily for every project. Look that: This componentes: http://serafimnatural.com.br/header http://serafimnatural.com.br/principala http://serafimnatural.com.br/principalb http://serafimnatural.com.br/principalc http://serafimnatural.com.br/principald h

[web2py] Re: another video: web2py components

2011-03-23 Thread Massimo Di Pierro
All of these should be listed in web2py.com/poweredby Really nice design On Mar 23, 7:29 pm, Bruno Rocha wrote: > I like to use components, and I am using it heavily for every project. > > Look that: > > This > componentes:http://serafimnatural.com.br/headerhttp://serafimnatural.com.br/princip

[web2py] Re: dal trunk has sapdb support (need tester)

2011-03-23 Thread mart
So... how long did it take you to get that email to finish registration? I've been waiting all day All I want is the driver :( but seems we have to install the bundle? Mart :) On Mar 23, 2:20 pm, mart wrote: > right...  did you find a MACOS driver (maybe they are hiding their > support for

Re: [web2py] Re: Proposals for New Tagline

2011-03-23 Thread G. Clifford Williams
Thank you Adam, I agree. *apologies for the late follow up* On Mon, Mar 21, 2011 at 06:23:37AM -0700, AdamF spake: > Hi, > > I've read all the discussion about the tagline... and unfortunately I cannot > agree with most of the votes. But maybe it's because I am coming from > enterprise world a

[web2py] Re: a few questions

2011-03-23 Thread niknok
Aha! I don't normally use 'zero=None'. Maybe I should. Thank you very much DenesL. On Mar 23, 6:23 pm, DenesL wrote: > On Mar 23, 3:35 am, niknok wrote: > > > Thanks for asking the right question. When I saw "define", I took a > > look into the code and noticed that I left it undefined, even w

[web2py] Re: another video: web2py components

2011-03-23 Thread Anthony
On Wednesday, March 23, 2011 9:11:08 PM UTC-4, Massimo Di Pierro wrote: > > All of these should be listed in web2py.com/poweredby > Really nice design serafimnatural.com.br, animalsystem.com.br, and semanticsbml.org are already there. I'll add pymantis.org. Anthony

[web2py] Re: dal trunk has sapdb support (need tester)

2011-03-23 Thread Massimo Di Pierro
I do not know. That is why I asked for help. :-( On Mar 23, 1:20 pm, mart wrote: > right...  did you find a MACOS driver (maybe they are hiding their > support for it? ;) ). If not I'll just boot up a linux box. > > Thanks, > Mart :) > > On Mar 23, 12:35 pm, Massimo Di Pierro > wrote: > > > > >

[web2py] Problems with Google App Engine

2011-03-23 Thread Web2py Newbie
Hi I have done a short app (actually just a couple of web pages strung together) that I wanted to load to the google app engine. When I try to hook up web2py: python2.5 dev_appserver.py web2py the app starts, but fails when I load the page in a browser: ERROR2011-03-23 23:00:16,549 dev_appse

[web2py] Re: dal trunk has sapdb support (need tester)

2011-03-23 Thread mart
LOL . k, here's the scoop (well my scoop ;) ) Got the email abut 20 mins ago, which os good :). Couldn't find anything for MACOS accept for python 2.6, not 2.7 (but may revert to 2.6 and try it that way). I had no luck yet with linux (I forgot that re-installed Ubuntu,) so, I missing all the pyth

Re: [web2py] Re: onmouseover

2011-03-23 Thread Kenneth Lundström
The problem was in missing , I took a working code from HTML and added _ to onmouseover and onmouseout and forgot about commas. Stupid mistake. Kenneth Yes. The error is probably in other order TD(_onmouseover="","content") WRONG TD("content",_onmouseover="") RIGHT On Mar 23, 8:38

[web2py] auth_user field default to other auth_user field?

2011-03-23 Thread pbreit
I can't seem to figure out a (good) way to have one of my auth_user fields default to another auth_user field. I only want the default to take place once so not "compute". I tried defaulting to a lambda but that doesn't work. db.define_table('auth_user', ... Field('email', length=128, r