[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 the nbsp but still getting the
extra radio button.

def radioboxes(field,value):

items=[SPAN(name,INPUT(_type='radio',_value=key,_name=field.name,value=value))
for key,name in field.requires.options()]
return DIV(*items)

The error I posted did not occur again. Probably related to the test
data I was making. After rebuilding the db, it didn't show itself
again. [crossing my fingers..]


On Mar 23, 10:28 am, DenesL  wrote:
> Hi,
>
> On Mar 22, 9:39 pm, niknok  wrote:
>
> > Hi everyone.
>
> > a few question about forms:
> > 1. why doesn't the datepicker appear when I use the sqlform.factory to
> > generate input fields?
>
> It works for me.
> How did you define the field?.
> Are you using the default layout?.
>
> > 2. Other than customizing a view, is there a way to display radiobox
> > options horizontally when using sqlform?
>
> Yes, with widgets, for example:
>
> def radioboxes(field,value):
>     nbsp = XML(' ')
>     items=[TAG['']
> (SPAN(name,INPUT(_type='radio',_value=key,_name=field.name,value=value)),
> nbsp, nbsp )
>            for key,name in field.requires.options()]
>     return DIV(*items)
>
> and in the field definition just add
>   widget=radioboxes
>
>
>
>
>
>
>
>
>
> > I'm stuck with this "internal error": ValueError: invalid literal for
> > int() with base 10: ''
>
> > Traceback (most recent call last):
> >   File "/home/rwn/Projects/web2py/gluon/restricted.py", line 188, in
> > restricted
> >     exec ccode in environment
> >   File "/home/rwn/Projects/web2py/applications/bbc_test/views/
> > appadmin.html", line 193, in 
> >     
> >   File "/home/rwn/Projects/web2py/gluon/sqlhtml.py", line 1356, in
> > __init__
> >     r = A(field.represent(r), _href=str(href))
> >   File "/home/rwn/Projects/web2py/gluon/dal.py", line 3322, in
> > repr_ref
> >     def repr_ref(id, r=referenced, f=ff): return f(r, id)
> >   File "/home/rwn/Projects/web2py/gluon/dal.py", line 3291, in ff
> >     row=r(id)
> >   File "/home/rwn/Projects/web2py/gluon/dal.py", line 4243, in
> > __call__
> >     record = self._db(self.id == key).select(limitby=(0,1)).first()
> >   File "/home/rwn/Projects/web2py/gluon/dal.py", line 5009, in select
> >     return self.db._adapter.select(self.query,fields,attributes)
> >   File "/home/rwn/Projects/web2py/gluon/dal.py", line 1070, in select
> >     return self.parse(rows,self._colnames)
> >   File "/home/rwn/Projects/web2py/gluon/dal.py", line 1263, in parse
> >     colset[fieldname] = rid = Reference(value)
> > ValueError: invalid literal for int() with base 10: ''
>
> Please post the code too, it is hard to follow with just the trace.
>
>
>
>
>
>
>
> > Am using version 1.94.5.


[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 button
> displayed and some fluff. I edited out the nbsp but still getting the
> extra radio button.

The nbsp are there just to create some spacing.
To remove the extra radio button you have to specify
  zero=None
when you define your options, e.g.
  requires=IS_IN_SET(['A','B','C'], zero=None)

> def radioboxes(field,value):
>
> items=[SPAN(name,INPUT(_type='radio',_value=key,_name=field.name,value=value))
>         for key,name in field.requires.options()]
>         return DIV(*items)
>
> The error I posted did not occur again. Probably related to the test
> data I was making. After rebuilding the db, it didn't show itself
> again. [crossing my fingers..]
>
> On Mar 23, 10:28 am, DenesL  wrote:
>
> > Hi,
>
> > On Mar 22, 9:39 pm, niknok  wrote:
>
> > > Hi everyone.
>
> > > a few question about forms:
> > > 1. why doesn't the datepicker appear when I use the sqlform.factory to
> > > generate input fields?
>
> > It works for me.
> > How did you define the field?.
> > Are you using the default layout?.
>
> > > 2. Other than customizing a view, is there a way to display radiobox
> > > options horizontally when using sqlform?
>
> > Yes, with widgets, for example:
>
> > def radioboxes(field,value):
> >     nbsp = XML(' ')
> >     items=[TAG['']
> > (SPAN(name,INPUT(_type='radio',_value=key,_name=field.name,value=value)),
> > nbsp, nbsp )
> >            for key,name in field.requires.options()]
> >     return DIV(*items)
>
> > and in the field definition just add
> >   widget=radioboxes
>
> > > I'm stuck with this "internal error": ValueError: invalid literal for
> > > int() with base 10: ''
>
> > > Traceback (most recent call last):
> > >   File "/home/rwn/Projects/web2py/gluon/restricted.py", line 188, in
> > > restricted
> > >     exec ccode in environment
> > >   File "/home/rwn/Projects/web2py/applications/bbc_test/views/
> > > appadmin.html", line 193, in 
> > >     
> > >   File "/home/rwn/Projects/web2py/gluon/sqlhtml.py", line 1356, in
> > > __init__
> > >     r = A(field.represent(r), _href=str(href))
> > >   File "/home/rwn/Projects/web2py/gluon/dal.py", line 3322, in
> > > repr_ref
> > >     def repr_ref(id, r=referenced, f=ff): return f(r, id)
> > >   File "/home/rwn/Projects/web2py/gluon/dal.py", line 3291, in ff
> > >     row=r(id)
> > >   File "/home/rwn/Projects/web2py/gluon/dal.py", line 4243, in
> > > __call__
> > >     record = self._db(self.id == key).select(limitby=(0,1)).first()
> > >   File "/home/rwn/Projects/web2py/gluon/dal.py", line 5009, in select
> > >     return self.db._adapter.select(self.query,fields,attributes)
> > >   File "/home/rwn/Projects/web2py/gluon/dal.py", line 1070, in select
> > >     return self.parse(rows,self._colnames)
> > >   File "/home/rwn/Projects/web2py/gluon/dal.py", line 1263, in parse
> > >     colset[fieldname] = rid = Reference(value)
> > > ValueError: invalid literal for int() with base 10: ''
>
> > Please post the code too, it is hard to follow with just the trace.
>
> > > Am using version 1.94.5.
>
>


[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 be a jpg?
I assume what I am asking is documented somewhere I just could not
find it. What should I be reading to know more about images and
web2py?

db.define_table('t_student',
Field('id','id',
  represent=lambda id:SPAN(id,'
',A('view',_href=URL('student_read',args=id,
Field('f_first_name', type='string', notnull=True,
  label=T('First Name')),

Field('f_image', type='upload',
  represent=lambda x: x and
A('download',_href=URL('download',args=x)) or '',
  label=T('Image')),


CONTROLLER
@auth.requires_login()
def student_read():
record = db.t_student(request.args(0)) or redirect(URL('error'))
form=crud.read(db.t_student,record)
return dict(form=form)

VIEW
{{extend 'layout.html'}}

Read student
{{=A(T('edit
student'),_href=URL('student_update',args=request.args(0)))}}


{{=form}}
{{for t,f in db.t_student._referenced_by:}}{{if not
t[-8:]=='_archive':}}
[{{=A(t[2:],_href=URL('%s_select'%t[2:],args=(f,form.record.id)))}}]
{{pass}}{{pass}}

Thanks
Vincent


[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 an application where I generate an INI file (could be
> any file) with specific info.
>
> For example I have this ini structure
>
> [Room]
>
> name = room1
> color = red
> size = big
>
> (I generate the file dynamically from an X computer [x could be any
> computer running a python script)
>
> After the file is generated, is sent by FTP to my web2py server PC in
> C:\SERVER\iniuploads
>
> The question is, how could I read the ini file values and save them in
> a model??
>
> Some to consider is:
>
> - Could be many ini files (each one with the room name, so the name of
> the file is the same of [Room])
> - I need to check every X time if a new ini file has been uploaded,
> and new files must be processed (save on db)
> - After a file is processed it must be deleted
>
> How could I do this?? It's ok to change the ini to any other file
> format, what I need is the contained info in a DB.


[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, 8:27 pm, Massimo Di Pierro 
wrote:
> web2py does not know whether the session is going to change or not so it 
> locks even if does not save it. To change it call session._unlock(request)
>
> On Mar 22, 2011, at 2:18 PM, Anthony wrote:
>
> > On Tuesday, March 22, 2011 2:39:45 PM UTC-4, Massimo Di Pierro wrote:
> > The only caveat is that - unless you unlock them - session are locked.
> > Therefore the same user cannot request two pages at the same time.
> > This in order to guarantee data integrity in sessions.
>
> > With the new changes in 1.94.5, is the session file still locked for every 
> > request, even if nothing is saved to the session, or does it only get 
> > locked if something is actually saved/changed?
>
> > Thanks.
>
> > Anthony
>
>


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 View:
{{=TAG.img(_width=90, _src=URL(r=request, c='default', f='download', 
args=[record.f_image]))}}



What I do when users are uploading pictures is to create a thumbnail of 
that picture and usually only show that thumbnail.



Kenneth




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 be a jpg?
I assume what I am asking is documented somewhere I just could not
find it. What should I be reading to know more about images and
web2py?

db.define_table('t_student',
 Field('id','id',
   represent=lambda id:SPAN(id,'
',A('view',_href=URL('student_read',args=id,
 Field('f_first_name', type='string', notnull=True,
   label=T('First Name')),

 Field('f_image', type='upload',
   represent=lambda x: x and
A('download',_href=URL('download',args=x)) or '',
   label=T('Image')),


CONTROLLER
@auth.requires_login()
def student_read():
 record = db.t_student(request.args(0)) or redirect(URL('error'))
 form=crud.read(db.t_student,record)
 return dict(form=form)

VIEW
{{extend 'layout.html'}}

Read student
{{=A(T('edit
student'),_href=URL('student_update',args=request.args(0)))}}


{{=form}}
{{for t,f in db.t_student._referenced_by:}}{{if not
t[-8:]=='_archive':}}
[{{=A(t[2:],_href=URL('%s_select'%t[2:],args=(f,form.record.id)))}}]
{{pass}}{{pass}}

Thanks
Vincent




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('jpeg'))),

This should work, havn´t tested.


Kenneth


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 be a jpg?
I assume what I am asking is documented somewhere I just could not
find it. What should I be reading to know more about images and
web2py?

db.define_table('t_student',
 Field('id','id',
   represent=lambda id:SPAN(id,'
',A('view',_href=URL('student_read',args=id,
 Field('f_first_name', type='string', notnull=True,
   label=T('First Name')),

 Field('f_image', type='upload',
   represent=lambda x: x and
A('download',_href=URL('download',args=x)) or '',
   label=T('Image')),


CONTROLLER
@auth.requires_login()
def student_read():
 record = db.t_student(request.args(0)) or redirect(URL('error'))
 form=crud.read(db.t_student,record)
 return dict(form=form)

VIEW
{{extend 'layout.html'}}

Read student
{{=A(T('edit
student'),_href=URL('student_update',args=request.args(0)))}}


{{=form}}
{{for t,f in db.t_student._referenced_by:}}{{if not
t[-8:]=='_archive':}}
[{{=A(t[2:],_href=URL('%s_select'%t[2:],args=(f,form.record.id)))}}]
{{pass}}{{pass}}

Thanks
Vincent




[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)
3. Desktop client -> Python with wxPython (I'm not interest) :D

What tools do I need? How?

PS. I'm new using web2py.

Thank you

-- 
coderbuzz


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.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 View:
> {{=TAG.img(_width=90, _src=URL(r=request, c='default', f='download', 
> args=[record.f_image]))}} 
>
>
> What I do when users are uploading pictures is to create a thumbnail of 
> that picture and usually only show that thumbnail. 
>
>
> Kenneth 
>
> > 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 be a jpg?
> > I assume what I am asking is documented somewhere I just could not
> > find it. What should I be reading to know more about images and
> > web2py?
> >
> > db.define_table('t_student',
> >  Field('id','id',
> >represent=lambda id:SPAN(id,'
> > ',A('view',_href=URL('student_read',args=id,
> >  Field('f_first_name', type='string', notnull=True,
> >label=T('First Name')),
> > 
> >  Field('f_image', type='upload',
> >represent=lambda x: x and
> > A('download',_href=URL('download',args=x)) or '',
> >label=T('Image')),
> > 
> >
> > CONTROLLER
> > @auth.requires_login()
> > def student_read():
> >  record = db.t_student(request.args(0)) or redirect(URL('error'))
> >  form=crud.read(db.t_student,record)
> >  return dict(form=form)
> >
> > VIEW
> > {{extend 'layout.html'}}
> >
> > Read student
> > {{=A(T('edit
> > student'),_href=URL('student_update',args=request.args(0)))}}
> > 
> >
> > {{=form}}
> > {{for t,f in db.t_student._referenced_by:}}{{if not
> > t[-8:]=='_archive':}}
> > [{{=A(t[2:],_href=URL('%s_select'%t[2:],args=(f,form.record.id)))}}]
> > {{pass}}{{pass}}
> >
> > Thanks
> > Vincent 
>
> 

[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 to rest - it requires that you use the same
function for multiple methods (GET/POST/etc) by using multiple
decorators or that you use different functions with different names to
handle different names (I do not like that).

On Mar 22, 3:13 am, Tom Atkins  wrote:
> I might be being naive here but in Flask I can do:
>
> @app.route('//users')
> ... def editusers(yoursitename): pass
>
> print url_for('editprofile', yoursitename='Supersite')
>
> gives:
>
> /Supersite/users
>
> On 22 March 2011 05:23, Jonathan Lundell  wrote:
>
>
>
>
>
>
>
> > On Mar 21, 2011, at 7:44 PM, Indra Gunawan wrote:
>
> > Agree, Flask way looks more elegant (see Variable Rules). It could be nice
> > if this way also exists on Web2Py.
>
> > On 22 March 2011 06:05, Tom Atkins  wrote:
>
> >> I was playing with Flask and I have to say its solution to routing is very
> >> nice:
>
> >>http://flask.pocoo.org/docs/quickstart/#routing
>
> >> The use of variable names anywhere within the URL structure is very handy.
> >> Anything like this possible in web2py?
>
> > Flask doesn't really allow variable names anywhere; near as I can tell
> > they're a considerably restricted version of web2py's args list.


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/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 View:
{{=TAG.img(_width=90, _src=URL(r=request, c='default', f='download',
args=[record.f_image]))}}


What I do when users are uploading pictures is to create a
thumbnail of
that picture and usually only show that thumbnail.


Kenneth

> 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 be a jpg?
> I assume what I am asking is documented somewhere I just could not
> find it. What should I be reading to know more about images and
> web2py?
>
> db.define_table('t_student',
>  Field('id','id',
>represent=lambda id:SPAN(id,'
> ',A('view',_href=URL('student_read',args=id,
>  Field('f_first_name', type='string', notnull=True,
>label=T('First Name')),
> 
>  Field('f_image', type='upload',
>represent=lambda x: x and
> A('download',_href=URL('download',args=x)) or '',
>label=T('Image')),
> 
>
> CONTROLLER
> @auth.requires_login()
> def student_read():
>  record = db.t_student(request.args(0)) or
redirect(URL('error'))
>  form=crud.read(db.t_student,record)
>  return dict(form=form)
>
> VIEW
> {{extend 'layout.html'}}
>
> Read student
> {{=A(T('edit
> student'),_href=URL('student_update',args=request.args(0)))}}
> 
>
> {{=form}}
> {{for t,f in db.t_student._referenced_by:}}{{if not
> t[-8:]=='_archive':}}
> [{{=A(t[2:],_href=URL('%s_select'%t[2:],args=(f,form.record.id
)))}}]
> {{pass}}{{pass}}
>
> Thanks
> Vincent





[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'),
>           INPUT(_type='submit'))
>
> In the view, I want to begin and end the form manually and put the input
> fields in random places. How do I do this? Because {{=form.custom}} doesn't
> exist.
>
> Thanks.


[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.__doc__,context=dict())

def combined():
"""
{{=form1}}
{{=form2}}
"""
return
render(content=combined.__doc__,context=dict(form1=form1(),form2=form2()))

def form1():
return crud.create(db.person)

def form1():
return crud.create(db.dog)



On Mar 23, 12:26 am, mart  wrote:
> These are great! :)
>
> Question: if a component is a part of a page like a form, then another
> part of the page (like another form) is also a component. How would we
> (or rather could we) pair up 2 components and treat them as one? (I.e.
> like in a form to subform relationship?).
>
> As an example, I've been using one of your idea (the audit trail
> slice) to handle combining forms/tables to create tio appearance of
> having all these dedicated forms when really, its just a matter of
> combining. this works well, but the one thing thing that I would like
> to improve in this case is the idea that forms can be a little more
> dynamic (as opposed to having to pre-set different combinations).
> Something like fill form_1, then make a choice (like with a drop down)
> which may change the out come of the next form... but in the end (like
> with the audit trail) it has the full look and feel of being a single
> form.
>
> Thanks,
> Mart :)
>
> On Mar 22, 9:57 pm, DenesL  wrote:
>
>
>
>
>
>
>
> > Thanks for this and other recent videos.
> > Keep them coming!!!
>
> > On Mar 22, 5:49 pm, Massimo Di Pierro 
> > wrote:
>
> > >http://vimeo.com/21363988
>
> > > Because we do not use them enough and feel we have room for
> > > improvement.
>
> > > Massimo


[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 Wednesday, March 23, 2011 9:17:31 AM UTC-4, Massimo Di Pierro wrote:

> 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 to rest - it requires that you use the same 
> function for multiple methods (GET/POST/etc) by using multiple 
> decorators or that you use different functions with different names to 
> handle different names (I do not like that). 
>
> On Mar 22, 3:13 am, Tom Atkins  wrote: 
> > I might be being naive here but in Flask I can do: 
> > 
> > @app.route('//users') 
> > ... def editusers(yoursitename): pass 
> > 
> > print url_for('editprofile', yoursitename='Supersite') 
> > 
> > gives: 
> > 
> > /Supersite/users 
> > 
> > On 22 March 2011 05:23, Jonathan Lundell  wrote: 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > > On Mar 21, 2011, at 7:44 PM, Indra Gunawan wrote: 
> > 
> > > Agree, Flask way looks more elegant (see Variable Rules). It could be 
> nice 
> > > if this way also exists on Web2Py. 
> > 
> > > On 22 March 2011 06:05, Tom Atkins  wrote: 
> > 
> > >> I was playing with Flask and I have to say its solution to routing is 
> very 
> > >> nice: 
> > 
> > >>http://flask.pocoo.org/docs/quickstart/#routing 
> > 
> > >> The use of variable names anywhere within the URL structure is very 
> handy. 
> > >> Anything like this possible in web2py? 
> > 
> > > Flask doesn't really allow variable names anywhere; near as I can tell 
> > > they're a considerably restricted version of web2py's args list.



[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, Anthony wrote:

> 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 Wednesday, March 23, 2011 9:17:31 AM UTC-4, Massimo Di Pierro wrote:
> 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 to rest - it requires that you use the same 
> function for multiple methods (GET/POST/etc) by using multiple 
> decorators or that you use different functions with different names to 
> handle different names (I do not like that). 
> 
> On Mar 22, 3:13 am, Tom Atkins  wrote: 
> > I might be being naive here but in Flask I can do: 
> > 
> > @app.route('//users') 
> > ... def editusers(yoursitename): pass 
> > 
> > print url_for('editprofile', yoursitename='Supersite') 
> > 
> > gives: 
> > 
> > /Supersite/users 
> > 
> > On 22 March 2011 05:23, Jonathan Lundell  wrote: 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > > On Mar 21, 2011, at 7:44 PM, Indra Gunawan wrote: 
> > 
> > > Agree, Flask way looks more elegant (see Variable Rules). It could be 
> > > nice 
> > > if this way also exists on Web2Py. 
> > 
> > > On 22 March 2011 06:05, Tom Atkins  wrote: 
> > 
> > >> I was playing with Flask and I have to say its solution to routing is 
> > >> very 
> > >> nice: 
> > 
> > >>http://flask.pocoo.org/docs/quickstart/#routing 
> > 
> > >> The use of variable names anywhere within the URL structure is very 
> > >> handy. 
> > >> Anything like this possible in web2py? 
> > 
> > > Flask doesn't really allow variable names anywhere; near as I can tell 
> > > they're a considerably restricted version of web2py's args list.



[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
>
> SyntaxError:invalid syntax
>
> Kenneth


[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():
>     """
>     
>     {{=LOAD('default','combined',ajax=True)}}
>     
>     """
>     return render(content=index.__doc__,context=dict())
>
> def combined():
>     """
>     {{=form1}}
>     {{=form2}}
>     """
>     return
> render(content=combined.__doc__,context=dict(form1=form1(),form2=form2()))
>
> def form1():
>     return crud.create(db.person)
>
> def form1():
>     return crud.create(db.dog)
>
> On Mar 23, 12:26 am, mart  wrote:
>
>
>
>
>
>
>
> > These are great! :)
>
> > Question: if a component is a part of a page like a form, then another
> > part of the page (like another form) is also a component. How would we
> > (or rather could we) pair up 2 components and treat them as one? (I.e.
> > like in a form to subform relationship?).
>
> > As an example, I've been using one of your idea (the audit trail
> > slice) to handle combining forms/tables to create tio appearance of
> > having all these dedicated forms when really, its just a matter of
> > combining. this works well, but the one thing thing that I would like
> > to improve in this case is the idea that forms can be a little more
> > dynamic (as opposed to having to pre-set different combinations).
> > Something like fill form_1, then make a choice (like with a drop down)
> > which may change the out come of the next form... but in the end (like
> > with the audit trail) it has the full look and feel of being a single
> > form.
>
> > Thanks,
> > Mart :)
>
> > On Mar 22, 9:57 pm, DenesL  wrote:
>
> > > Thanks for this and other recent videos.
> > > Keep them coming!!!
>
> > > On Mar 22, 5:49 pm, Massimo Di Pierro 
> > > wrote:
>
> > > >http://vimeo.com/21363988
>
> > > > Because we do not use them enough and feel we have room for
> > > > improvement.
>
> > > > Massimo


[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(record):
>      record = record[0]
>
> return dict(record=record)
>
Thanks for your response,
In the code I have (created by the wizard)
record = db.t_student(request.args(0)) or redirect(URL('error'))
Am I correct in thinking this return a "row" and can I ge the image by
doing something like
image = record['f_image']

Thanks
Vincent


> In View:
> {{=TAG.img(_width=90, _src=URL(r=request, c='default', f='download',
> args=[record.f_image]))}}
>
> What I do when users are uploading pictures is to create a thumbnail of
> that picture and usually only show that thumbnail.
>
> Kenneth
>
>
>
>
>
>
>
> > 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 be a jpg?
> > I assume what I am asking is documented somewhere I just could not
> > find it. What should I be reading to know more about images and
> > web2py?
>
> > db.define_table('t_student',
> >      Field('id','id',
> >            represent=lambda id:SPAN(id,'
> > ',A('view',_href=URL('student_read',args=id,
> >      Field('f_first_name', type='string', notnull=True,
> >            label=T('First Name')),
> > 
> >      Field('f_image', type='upload',
> >            represent=lambda x: x and
> > A('download',_href=URL('download',args=x)) or '',
> >            label=T('Image')),
> > 
>
> > CONTROLLER
> > @auth.requires_login()
> > def student_read():
> >      record = db.t_student(request.args(0)) or redirect(URL('error'))
> >      form=crud.read(db.t_student,record)
> >      return dict(form=form)
>
> > VIEW
> > {{extend 'layout.html'}}
>
> > Read student
> > {{=A(T('edit
> > student'),_href=URL('student_update',args=request.args(0)))}}
> > 
>
> > {{=form}}
> > {{for t,f in db.t_student._referenced_by:}}{{if not
> > t[-8:]=='_archive':}}
> > [{{=A(t[2:],_href=URL('%s_select'%t[2:],args=(f,form.record.id)))}}]
> > {{pass}}{{pass}}
>
> > Thanks
> > Vincent


[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=lambda r:max(r['tags'])),

the min and max computation dose not work as expected ... the third row in 
db in because of a small change for debug

line 2 of above code is changed as 
Field('refval','string', compute=lambda r:type(r['tags']) ),

so even though the type of r['tags'] is list the min and max is not working 
properly ... *any idea y?*
<>

[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 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=lambda r:max(r['tags'])),
>
> the min and max computation dose not work as expected ... the third row in
> db in because of a small change for debug
>
> line 2 of above code is changed as
>     Field('refval','string', compute=lambda r:type(r['tags']) ),
>
> so even though the type of r['tags'] is list the min and max is not working
> properly ... *any idea y?*
>
>  Capture.JPG
> 17KViewDownload


[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 time. 
So maybe this is a web2py bug?

But either way, a long-running script should be spun off into its own 
process for performance reasons.


[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 pretty sure there is no bug in tis regard.

Notice that other frameworks that use cookie based sessions do not
guarantee session integrity therefore they do not serialize requests
from the same user.



Massimo

On Mar 23, 9:44 am, Ross Peoples  wrote:
> 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 time.
> So maybe this is a web2py bug?
>
> But either way, a long-running script should be spun off into its own
> process for performance reasons.


[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 (forth line of the
buy method in database_examples.py) defines the following constraint
on the quantity:

 
TR("Quantity:",INPUT(_type="text",_name="quantity",requires=IS_INT_IN_RANGE(1,100))),

When you actually test the example application, the form accepts
values between 1 and 99 inclusive and the database is updated with the
appropriate value.

What is the point of the constraint in the model definition if it is
not enforced?  Seems like the model would be the ideal place to set
this constraint so that it doesn't need to be repeated for every form
that uses it.  However it would be nice to be able to override the
default per form if necessary.


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 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 (forth line of the
buy method in database_examples.py) defines the following constraint
on the quantity:


TR("Quantity:",INPUT(_type="text",_name="quantity",requires=IS_INT_IN_RANGE(1,100))),

When you actually test the example application, the form accepts
values between 1 and 99 inclusive and the database is updated with the
appropriate value.

What is the point of the constraint in the model definition if it is
not enforced?  Seems like the model would be the ideal place to set
this constraint so that it doesn't need to be repeated for every form
that uses it.  However it would be nice to be able to override the
default per form if necessary.





[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 FORM helper.
The Example 33 was written more then 3 years ago and needs to be
revised.

Massimo





On Mar 23, 10:45 am, Jaunx  wrote:
> 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 (forth line of the
> buy method in database_examples.py) defines the following constraint
> on the quantity:
>
> TR("Quantity:",INPUT(_type="text",_name="quantity",requires=IS_INT_IN_RANGE 
> (1,100))),
>
> When you actually test the example application, the form accepts
> values between 1 and 99 inclusive and the database is updated with the
> appropriate value.
>
> What is the point of the constraint in the model definition if it is
> not enforced?  Seems like the model would be the ideal place to set
> this constraint so that it doesn't need to be repeated for every form
> that uses it.  However it would be nice to be able to override the
> default per form if necessary.


[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 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 general...) my impression has always been that
> SAP wasn't the human-friendliest choice (maybe because of its size and
> extensive proprietary features?) but I'm game :)
>
> Anyways, I'll try it right now. do I just install the driver, and
> web2py will do the rest?
>
> Thanks,
> Mart :)
>
> On Mar 23, 10:36 am, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > 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: 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 general...) my impression has always been that
SAP wasn't the human-friendliest choice (maybe because of its size and
extensive proprietary features?) but I'm game :)

Anyways, I'll try it right now. do I just install the driver, and
web2py will do the rest?

Thanks,
Mart :)


On Mar 23, 10:36 am, Massimo Di Pierro 
wrote:
> 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: 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 overridden,
I suppose you might consider doing that in the DB itself.


On Mar 23, 3:45 pm, Jaunx  wrote:
> 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 (forth line of the
> buy method in database_examples.py) defines the following constraint
> on the quantity:
>
> TR("Quantity:",INPUT(_type="text",_name="quantity",requires=IS_INT_IN_RANGE(1,100))),
>
> When you actually test the example application, the form accepts
> values between 1 and 99 inclusive and the database is updated with the
> appropriate value.
>
> What is the point of the constraint in the model definition if it is
> not enforced?  Seems like the model would be the ideal place to set
> this constraint so that it doesn't need to be repeated for every form
> that uses it.  However it would be nice to be able to override the
> default per form if necessary.


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 
experience. so i think we need to change this one way or another. thanks to 
kevin for getting the process started.

matt


[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 that big ;)

 
I can see all the posts. Are they still missing for you?


[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 same here in Finland and as the number keyboard has , it the
> key to use.
>
> Kenneth
>
>
>
>
>
>
>
> > My main main problem is localization. since in portuguese decimal
> > separator is , and not a . I just have to disable it.
>
> > 2011/3/22 Massimo Di Pierro  > >
>
> >     I do not have a strong opinion about this one. What do other people
> >     think?
>
> >     On Mar 20, 1:15 pm, Kevin Ivarsen  >     > wrote:
> >     > Hi all,
>
> >     > I find the default javascript validators for integer, double,
> >     and decimal
> >     > SQLFORM fields to be a little annoying. Consider the following
> >     surprising
> >     > behaviors:
>
> >     > - You can't navigate within the textbox using the keyboard.
> >     Pressing left,
> >     > right, home, or end all result in the cursor jumping back to the
> >     end of the
> >     > input
> >     > - You can't select text with ctrl-a or ctrl-shift-left/right
> >     > - If the user accidentally flubs the input (e.g. 2.u1828 instead of
> >     > 2.71828), the offending character is silently removed and an
> >     incorrect value
> >     > may be submitted without warning.
>
> >     > I think a better alternative is to flag to the user that the
> >     input is wrong
> >     > rather than trying to correct it for them -- e.g. by changing
> >     the input
> >     > background color. The following is a sample implementation that
> >     does this:
>
> >     > -- in file web2py_ajax.html, replace the lines
> >     > "jQuery('input.integer').live..." and
> >     > "jQuery('input.double,input.decimal').live..." with:
>
> >     >   jQuery('input.integer').live('keydown keyup', function(){
> >     >      if (! this.value.match(/^[+-]?[0-9]*$/)) {
> >     >           jQuery(this).addClass("w2p_inputerror");
> >     >      }
> >     >      else {
> >     >           jQuery(this).removeClass("w2p_inputerror");
> >     >      }
> >     >   });
>
> >     >   jQuery('input.double,input.decimal').live('keydown keyup',
> >     function(){
> >     >      if (! this.value.match(/^[+-]?[0-9]*\.?[0-9]*$/)) {
> >     >           jQuery(this).addClass("w2p_inputerror");
> >     >      }
> >     >      else {
> >     >           jQuery(this).removeClass("w2p_inputerror");
> >     >      }
> >     >   });
>
> >     > -- in file base.css, add the following style:
>
> >     >      input.w2p_inputerror {
> >     >           background: #FF8;
> >     >      }
>
> >     > A few notes:
>
> >     > 1. The regexes used to validate numbers are "intentionally"
> >     naive. For
> >     > example. the double validator accepts "+", "-", "+.", and "-.",
> >     which are of
> >     > couse not valid numbers. However, suppose the user enters a
> >     value between -1
> >     > and 0. They are likely to start by typing "-.", and I don't
> >     think it's
> >     > polite to flash the textbox at them when they are about to enter
> >     a valid
> >     > number.
>
> >     > 2. The double validator does not permit scientific notation -
> >     e.g. "1e6" for
> >     > 1 million. Such notation is probably of limited use for most
> >     people, the old
> >     > validator rejected such values anyway, and I didn't feel like
> >     implementing
> >     > it :-)
>
> >     > 3. The jquery events listen to both keyup and keydown. keyup is
> >     necessary
> >     > because the input.value has not yet been updated when keydown is
> >     fired. But
> >     > listening to keydown is useful if the user holds down the
> >     backspace key -
> >     > the background color will be reset as soon as the last offending
> >     character
> >     > has been deleted, rather than waiting for the user to release
> >     the backspace
> >     > key.
>
> >     > 4. I used the class name "w2p_inputerror" in an attept to
> >     namespace this
> >     > somewhat web2py-specific class.
>
> >     > I hope some people find this to be useful. If other people have
> >     been annoyed
> >     > by the current default, perhaps we could open discussion to make
> >     this the
> >     > new default in web2py?
>
> >     > Cheers,
> >     > Kevin
>
> > --
> > Atenciosamente
>
> > Alexandre Andrade
> > Hipercenter.com Classificados Gratuitos


[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 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 ;)
>  
> I can see all the posts. Are they still missing for you?

Mart
msenecal...@gmail.com





[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, 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 that big ;)
>
>  
> I can see all the posts. Are they still missing for you?
>
>
>  Mart
> msenecal...@gmail.com
>
>
>
>

[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.
>
> 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 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 general...) my impression has always been that
> > SAP wasn't the human-friendliest choice (maybe because of its size and
> > extensive proprietary features?) but I'm game :)
>
> > Anyways, I'll try it right now. do I just install the driver, and
> > web2py will do the rest?
>
> > Thanks,
> > Mart :)
>
> > On Mar 23, 10:36 am, Massimo Di Pierro 
> > wrote:
>
> > > 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: 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 component2 
action then unlock the session, or will the component2 action have to wait 
for the component1 action to finish and release the lock?
 
Thanks.
 
Anthony

On Wednesday, March 23, 2011 11:02:06 AM UTC-4, Massimo Di Pierro wrote:

> 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 pretty sure there is no bug in tis regard. 
>
> Notice that other frameworks that use cookie based sessions do not 
> guarantee session integrity therefore they do not serialize requests 
> from the same user. 
>
>
>
> Massimo 
>
> On Mar 23, 9:44 am, Ross Peoples  wrote: 
> > 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 
> time. 
> > So maybe this is a web2py bug? 
> > 
> > But either way, a long-running script should be spun off into its own 
> > process for performance reasons.



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 request for component1 locks the session, can the component2 action 
> then unlock the session, or will the component2 action have to wait for the 
> component1 action to finish and release the lock?

No, but component1 can call session.forget to release the lock and close the 
session file.



>  
> Thanks.
>  
> Anthony
> 
> On Wednesday, March 23, 2011 11:02:06 AM UTC-4, Massimo Di Pierro wrote:
> 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 pretty sure there is no bug in tis regard. 
> 
> Notice that other frameworks that use cookie based sessions do not 
> guarantee session integrity therefore they do not serialize requests 
> from the same user. 
> 
> 
> 
> Massimo 
> 
> On Mar 23, 9:44 am, Ross Peoples  wrote: 
> > 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 
> > time. 
> > So maybe this is a web2py bug? 
> > 
> > But either way, a long-running script should be spun off into its own 
> > process for performance reasons.




[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 just jumps right into an . I took a deep breath, deleted 
everything that was there, replaced it with the code in the manual, and saved 
it. If this is what you want your students to do, it would be helpful if you 
said so right out. 

It seems to be working, but it has a little 1 2 3 above the big, bold "Hello 
from MyApp", and a little 5 6 below it. Something extra is happening here.




From: Anthony 
To: web2py@googlegroups.com
Cc: Hal Smith 
Sent: Tue, March 22, 2011 3:22:57 PM
Subject: Re: Runnning my new app


Hopefully it will become clear as you go through the book. If not, come back 
and 
ask. :)
 
This section might help: http://web2py.com/book/default/chapter/04#Dispatching
 
Anthony


On Tuesday, March 22, 2011 4:14:26 PM UTC-4, Hal Smith wrote:
I got it working. But I don't understand what is going on there. I hope your 
manual clarifies that. 
>
>
>

 From: Anthony 
>To: web...@googlegroups.com
>Cc: Hal Smith 
>Sent: Tue, March 22, 2011 9:59:29 AM
>Subject: Re: Runnning my new app
>
>On Tuesday, March 22, 2011 11:43:10 AM UTC-4, Hal Smith wrote: 
>I am supposed to get "Hello from my first Web app", but all I see is "Hello 
>World"
 
Are you following the tutorial in the book? Is your new app named "myapp"? If 
so, make sure the default.py controller that you edited is the one in the 
"myapp" app (and not the one in the "welcome" app), and make sure you entered 
the url for "myapp" -- http://127.0.0.1:8000/myapp/ default/index.
 
Anthony

[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 generate each submenu 
from the model
i.e.

submenu1=[ 
['item1',False,URL(r=request,f='item1')], 
['item2',False,URL(r=request,f='item2')], 
] 
i have 

ping_result = db().select(db.t_ping_result.f_hub, 
orderby=db.t_ping_result.f_hub, distinct=True)

should i iterate every ping_result and manually create the submenu string?
regards


[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 recall the default "index.html" file, you should have seen at the top 
"{{extend 'layout.html'}}". This is what tells web2py to take your 
index.html file and insert it into the layout.html file.

What you also should have seen is in controllers/default.py:

def index():
"""
example action using the internationalization operator T and flash
rendered by views/default/index.html or views/generic.html
"""
return dict(message=T('Hello World'))

When you visit "/welcome/default/index" in your browser, it looks for the 
app "welcome, then "default.py" in your controllers file and then "def 
index()" in default.py. You will see that index() returns a variable 
"message='Hello World'". "message" is sent to the view file 
views/default/index.html and is available like this: {{=message}}. The 
default index.html file includes some other content but you should be able 
to find {{=message}} in there somewhere. Try editing "message" to 'Good bye 
world'. Or try moving {{=message}} to a different position in index.html and 
see what happens.


[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 separators injected 
into class names or elsewhere in the javascript code wouldn't be be terribly 
difficult, but the complications may not be worth the minimal potential 
gains.

Kevin



[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 user request two pages at the same 
> time or am I missing something?

 
As per Jonathan's recent reply, you have to unlock the session within 
the same request that locks it. For example, let's say you have:
 
def function1():
# some code that takes a while to run...
return dict()
 
def function2():
# do stuff...
return dict()
 
If a request comes in for function1 first, it will lock the session file, 
and a subsequent request for function2 will have to wait. If you don't want 
function2 to wait for function1, then you have to unlock the session at the 
beginning of function1 (or in the controller, outside both functions, or in 
a model file). Is that what you're doing? Can you show some code?
 
Anthony
 


[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 prevent any integer outside of that range (0-9
inclusive) from being added into the quantity field regardless of
constraints specified in custom forms.

So the following custom form specific constraint:

 
TR("Quantity:",INPUT(_type="text",_name="quantity",requires=IS_INT_IN_RANGE
(1,100))),

would only further limit the constraint specified by the model.  If
this were the case, it wouldn't make sense to allow values in the
custom form that the model did not allow.  For instance, a value of 50
would pass the custom form validation, but get rejected by the model
constraint.  So the custom form constraint would effectively limit the
values to 1-9 inclusive (10-99 would get rejected by the model
constraint).

I usually consider model definitions as hard rules for the data that
should not be broken.  But as Massimo stated, this is not the way it
is implemented.  It is too easy to be a critic when you aren't the one
doing the implementation.

Keep up the great work!

On Mar 23, 12:39 pm, villas  wrote:
> 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 overridden,
> I suppose you might consider doing that in the DB itself.
>
> On Mar 23, 3:45 pm, Jaunx  wrote:
>
>
>
>
>
>
>
> > 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 (forth line of the
> > buy method in database_examples.py) defines the following constraint
> > on the quantity:
>
> > TR("Quantity:",INPUT(_type="text",_name="quantity",requires=IS_INT_IN_RANGE 
> > (1,100))),
>
> > When you actually test the example application, the form accepts
> > values between 1 and 99 inclusive and the database is updated with the
> > appropriate value.
>
> > What is the point of the constraint in the model definition if it is
> > not enforced?  Seems like the model would be the ideal place to set
> > this constraint so that it doesn't need to be repeated for every form
> > that uses it.  However it would be nice to be able to override the
> > default per form if necessary.


[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 Smith 
Sent: Wed, March 23, 2011 1:15:01 PM
Subject: Re: Runnning my new app

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 recall the default "index.html" file, you should have seen at the top 
"{{extend 'layout.html'}}". This is what tells web2py to take your index.html 
file and insert it into the layout.html file.

What you also should have seen is in controllers/default.py:

def index():
"""
example action using the internationalization operator T and flash
rendered by views/default/index.html or views/generic.html
"""
return dict(message=T('Hello World'))

When you visit "/welcome/default/index" in your browser, it looks for the app 
"welcome, then "default.py" in your controllers file and then "def index()" in 
default.py. You will see that index() returns a variable "message='Hello 
World'". "message" is sent to the view file views/default/index.html and is 
available like this: {{=message}}. The default index.html file includes some 
other content but you should be able to find {{=message}} in there somewhere. 
Try editing "message" to 'Good bye world'. Or try moving {{=message}} to a 
different position in index.html and see what happens.

[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 to guarantee checks at the db level in every case.
Consider this:

db.define_table('ab',Field('a','integer'),Field('b','integer',requires=IS_IN_IN_RANGE(0,10))
for i in range(100):
db.ab.insert(a=i,b=0)
db(db.ab).update(b=db.ab.a) # <

there is no way to enforce this constraint without looping and
checking each individual record. That is very expensive.

Massimo

On Mar 23, 2:57 pm, Jaunx  wrote:
> 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 prevent any integer outside of that range (0-9
> inclusive) from being added into the quantity field regardless of
> constraints specified in custom forms.
>
> So the following custom form specific constraint:
>
> TR("Quantity:",INPUT(_type="text",_name="quantity",requires=IS_INT_IN_RANGE
> (1,100))),
>
> would only further limit the constraint specified by the model.  If
> this were the case, it wouldn't make sense to allow values in the
> custom form that the model did not allow.  For instance, a value of 50
> would pass the custom form validation, but get rejected by the model
> constraint.  So the custom form constraint would effectively limit the
> values to 1-9 inclusive (10-99 would get rejected by the model
> constraint).
>
> I usually consider model definitions as hard rules for the data that
> should not be broken.  But as Massimo stated, this is not the way it
> is implemented.  It is too easy to be a critic when you aren't the one
> doing the implementation.
>
> Keep up the great work!
>
> On Mar 23, 12:39 pm, villas  wrote:
>
>
>
>
>
>
>
> > 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 overridden,
> > I suppose you might consider doing that in the DB itself.
>
> > On Mar 23, 3:45 pm, Jaunx  wrote:
>
> > > 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 (forth line of the
> > > buy method in database_examples.py) defines the following constraint
> > > on the quantity:
>
> > > TR("Quantity:",INPUT(_type="text",_name="quantity",requires=IS_INT_IN_RANGE
> > >  (1,100))),
>
> > > When you actually test the example application, the form accepts
> > > values between 1 and 99 inclusive and the database is updated with the
> > > appropriate value.
>
> > > What is the point of the constraint in the model definition if it is
> > > not enforced?  Seems like the model would be the ideal place to set
> > > this constraint so that it doesn't need to be repeated for every form
> > > that uses it.  However it would be nice to be able to override the
> > > default per form if necessary.


[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 should have missed 
it.

That's all.
Keep up the great work, web2pyers ;)

[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, if you're on p. 88 doing the "Say Hello" example, you have not yet 
gotten to the stuff about using layouts and {{include}} -- that stuff starts 
in p. 92 in the "Let's Count" section. Because ch. 3 is tutorial style, 
explanations tend to be limited to what's going on with the immediate 
example, so you learn the details progressively. On p. 87, you learn that 
returning a string from your controller function simply sends the string as 
is to the browser (it's not inserted into any view/template). On p. 88, you 
learn that if you return a dictionary (instead of a string), web2py looks 
for the associated view file (and uses the generic view if it can't be 
found). And then on p. 92, you learn about extending a layout template.
 
I think the instruction about editing index.html on p. 88 could probably be 
improved. First, where it says "the new file associated with the action", it 
should probably say "the view file associated with the action". Second, it 
should probably explicitly say to completely replace the existing index.html 
content with the example code to avoid confusion. I'll make some edits to 
help clarify.
 
As for the numbers above and below your message, I can't explain that. Are 
you sure your index.html includes only the text from p. 88 and your 
controller is just:
 
def index():
return dict(message="Hello from MyApp")
 
Anthony


[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_and_insert
>
> How long has that been around? I don't think it's in the book, is it?


[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

http://semanticsbml.org/semanticSBML/sbmldiff/index/biomodels
and one the my most awesome use of components :P
source here
http://semanticsbml.svn.sourceforge.net/viewvc/semanticsbml/trunk/webui/controllers/sbmldiff.py?revision=3285&view=markup


[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. 
>
> My views/default/index.html contains only the code in the manual (I deleted 
> everything else). 
>
> Attached is a screen dump of the output.
>
>  --
> *From:* Anthony 
> *To:* web...@googlegroups.com
> *Cc:* Hal Smith 
> *Sent:* Wed, March 23, 2011 3:36:05 PM
> *Subject:* Re: Runnning my new app
>
> 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, if you're on p. 88 doing the "Say Hello" example, you have not yet 
> gotten to the stuff about using layouts and {{include}} -- that stuff starts 
> in p. 92 in the "Let's Count" section. Because ch. 3 is tutorial style, 
> explanations tend to be limited to what's going on with the immediate 
> example, so you learn the details progressively. On p. 87, you learn that 
> returning a string from your controller function simply sends the string as 
> is to the browser (it's not inserted into any view/template). On p. 88, you 
> learn that if you return a dictionary (instead of a string), web2py looks 
> for the associated view file (and uses the generic view if it can't be 
> found). And then on p. 92, you learn about extending a layout template.
>  
> I think the instruction about editing index.html on p. 88 could probably be 
> improved. First, where it says "the new file associated with the action", it 
> should probably say "the view file associated with the action". Second, it 
> should probably explicitly say to completely replace the existing index.html 
> content with the example code to avoid confusion. I'll make some edits to 
> help clarify.
>  
> As for the numbers above and below your message, I can't explain that. Are 
> you sure your index.html includes only the text from p. 88 and your 
> controller is just:
>  
> def index():
> return dict(message="Hello from MyApp")
>  
> Anthony
>


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
http://serafimnatural.com.br/fotoform
http://serafimnatural.com.br/galeriaflickr/standalone
http://serafimnatural.com.br/contato

Turned in to this:
http://serafimnatural.com.br/


For a new project, I am investing in components and restfull API.
http://animalsystem.com.br

--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]



On Tue, Mar 22, 2011 at 6:49 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> http://vimeo.com/21363988
>
> Because we do not use them enough and feel we have room for
> improvement.
>
> Massimo


[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/principalahttp://serafimnatural.com.br/principalbhttp://serafimnatural.com.br/principalchttp://serafimnatural.com.br/principaldhttp://serafimnatural.com.br/fotoformhttp://serafimnatural.com.br/galeriaflickr/standalonehttp://serafimnatural.com.br/contato
>
> Turned in to this:http://serafimnatural.com.br/
>
> For a new project, I am investing in components and restfull 
> API.http://animalsystem.com.br
>
> --
> Bruno Rocha
> [ About me:http://zerp.ly/rochacbruno]
>
> On Tue, Mar 22, 2011 at 6:49 PM, Massimo Di Pierro <
>
>
>
>
>
>
>
> massimo.dipie...@gmail.com> wrote:
> >http://vimeo.com/21363988
>
> > Because we do not use them enough and feel we have room for
> > improvement.
>
> > Massimo


[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 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.
>
> > 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 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 general...) my impression has always been that
> > > SAP wasn't the human-friendliest choice (maybe because of its size and
> > > extensive proprietary features?) but I'm game :)
>
> > > Anyways, I'll try it right now. do I just install the driver, and
> > > web2py will do the rest?
>
> > > Thanks,
> > > Mart :)
>
> > > On Mar 23, 10:36 am, Massimo Di Pierro 
> > > wrote:
>
> > > > 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.


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 and I have a different perspective...
> 
> For me if you put enterprise in the tagline that means only a few things; 
> it's a mature, production-ready, stable and high quality, proven software. 
> Thats because enterprise companies avoid investing in betas or experimental 
> solutions - they do prefer a stable, proven software even if it's not so 
> cheap.
> 
> So if you want to attract developers like me - people with enterprise 
> experience - leave this word in tagline. Otherwise they will choose Django 
> only because it's more popular... 
> 
> Personally I would think about tagline that shows 3 points: enterprise 
> quality and stability, agile development, fast learning
> 
> Regards
> 
> Adam


[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 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 the nbsp but still getting the
> > extra radio button.
>
> The nbsp are there just to create some spacing.
> To remove the extra radio button you have to specify
>   zero=None
> when you define your options, e.g.
>   requires=IS_IN_SET(['A','B','C'], zero=None)
>
>
>
>
>
>
>
> > def radioboxes(field,value):
>
> > items=[SPAN(name,INPUT(_type='radio',_value=key,_name=field.name,value=valu 
> > e))
> >         for key,name in field.requires.options()]
> >         return DIV(*items)
>
> > The error I posted did not occur again. Probably related to the test
> > data I was making. After rebuilding the db, it didn't show itself
> > again. [crossing my fingers..]
>
> > On Mar 23, 10:28 am, DenesL  wrote:
>
> > > Hi,
>
> > > On Mar 22, 9:39 pm, niknok  wrote:
>
> > > > Hi everyone.
>
> > > > a few question about forms:
> > > > 1. why doesn't the datepicker appear when I use the sqlform.factory to
> > > > generate input fields?
>
> > > It works for me.
> > > How did you define the field?.
> > > Are you using the default layout?.
>
> > > > 2. Other than customizing a view, is there a way to display radiobox
> > > > options horizontally when using sqlform?
>
> > > Yes, with widgets, for example:
>
> > > def radioboxes(field,value):
> > >     nbsp = XML(' ')
> > >     items=[TAG['']
> > > (SPAN(name,INPUT(_type='radio',_value=key,_name=field.name,value=value)),
> > > nbsp, nbsp )
> > >            for key,name in field.requires.options()]
> > >     return DIV(*items)
>
> > > and in the field definition just add
> > >   widget=radioboxes
>
> > > > I'm stuck with this "internal error": ValueError: invalid literal for
> > > > int() with base 10: ''
>
> > > > Traceback (most recent call last):
> > > >   File "/home/rwn/Projects/web2py/gluon/restricted.py", line 188, in
> > > > restricted
> > > >     exec ccode in environment
> > > >   File "/home/rwn/Projects/web2py/applications/bbc_test/views/
> > > > appadmin.html", line 193, in 
> > > >     
> > > >   File "/home/rwn/Projects/web2py/gluon/sqlhtml.py", line 1356, in
> > > > __init__
> > > >     r = A(field.represent(r), _href=str(href))
> > > >   File "/home/rwn/Projects/web2py/gluon/dal.py", line 3322, in
> > > > repr_ref
> > > >     def repr_ref(id, r=referenced, f=ff): return f(r, id)
> > > >   File "/home/rwn/Projects/web2py/gluon/dal.py", line 3291, in ff
> > > >     row=r(id)
> > > >   File "/home/rwn/Projects/web2py/gluon/dal.py", line 4243, in
> > > > __call__
> > > >     record = self._db(self.id == key).select(limitby=(0,1)).first()
> > > >   File "/home/rwn/Projects/web2py/gluon/dal.py", line 5009, in select
> > > >     return self.db._adapter.select(self.query,fields,attributes)
> > > >   File "/home/rwn/Projects/web2py/gluon/dal.py", line 1070, in select
> > > >     return self.parse(rows,self._colnames)
> > > >   File "/home/rwn/Projects/web2py/gluon/dal.py", line 1263, in parse
> > > >     colset[fieldname] = rid = Reference(value)
> > > > ValueError: invalid literal for int() with base 10: ''
>
> > > Please post the code too, it is hard to follow with just the trace.
>
> > > > Am using version 1.94.5.


[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:
>
>
>
>
>
>
>
> > 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 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 general...) my impression has always been that
> > > SAP wasn't the human-friendliest choice (maybe because of its size and
> > > extensive proprietary features?) but I'm game :)
>
> > > Anyways, I'll try it right now. do I just install the driver, and
> > > web2py will do the rest?
>
> > > Thanks,
> > > Mart :)
>
> > > On Mar 23, 10:36 am, Massimo Di Pierro 
> > > wrote:
>
> > > > 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] 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_appserver.py:3285] Exception
encountered handling request
Traceback (most recent call last):
  File "/data-current/programming/python/gae/google_appengine/google/
appengine/tools/dev_appserver.py", line 3245, in _HandleRequest
self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
  File "/data-current/programming/python/gae/google_appengine/google/
appengine/tools/dev_appserver.py", line 3186, in _Dispatch
base_env_dict=env_dict)
  File "/data-current/programming/python/gae/google_appengine/google/
appengine/tools/dev_appserver.py", line 531, in Dispatch
base_env_dict=base_env_dict)
  File "/data-current/programming/python/gae/google_appengine/google/
appengine/tools/dev_appserver.py", line 2410, in Dispatch
self._module_dict)
  File "/data-current/programming/python/gae/google_appengine/google/
appengine/tools/dev_appserver.py", line 2320, in ExecuteCGI
reset_modules = exec_script(handler_path, cgi_path, hook)
  File "/data-current/programming/python/gae/google_appengine/google/
appengine/tools/dev_appserver.py", line 2216, in ExecuteOrImportScript
exec module_code in script_module.__dict__
  File "/data-current/programming/python/gae/web2py/web2py.py", line
9, in 
os.chdir(path)
AttributeError: 'module' object has no attribute 'chdir'

Any ideas on what's going on/how to fix?
web2py version is most recent stable from the website this morning
(1.94.5)
Python version is Python 2.5.5 (r255:77872, Mar 24 2011, 09:36:33),
but I get the same failure using python2.6

Brendan


[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 python goodies, so decided
to try your web2py-setup shell script and having a few problems there
(will look later).

So, so far I got a driver installed but only on windows (I think its
installed)... but I can't test it because when I start web2py, the
browser(s) give me a broken link :( I don't know enough about windows
to know why I have that... Do you know if trunk is in a usable state?
if it is, I can spam and beg the group for windows help ;)

Anyways, haven't given up! ;) Stay tuned!


Mart :)

On Mar 23, 11:53 pm, Massimo Di Pierro 
wrote:
> 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:
>
> > > 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 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 general...) my impression has always been that
> > > > SAP wasn't the human-friendliest choice (maybe because of its size and
> > > > extensive proprietary features?) but I'm game :)
>
> > > > Anyways, I'll try it right now. do I just install the driver, and
> > > > web2py will do the rest?
>
> > > > Thanks,
> > > > Mart :)
>
> > > > On Mar 23, 10:36 am, Massimo Di Pierro 
> > > > wrote:
>
> > > > > 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.


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

SyntaxError:invalid syntax

Kenneth




[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, required=True, unique=True),
Field('paypal_email', length=128, default=lambda r: r.email))

With any other forms I could probably set the form.vars or do an 
onvalidation but I'm not sure how or if I can do that with auth() forms.