[web2py] Re: IMG helper and _width

2010-11-10 Thread annet
Massimo,

Thanks, problem solved. However, this:

{{=IMG(_src=URL(r=request,a='base',c='static',f='base/card/logos/%s' %
logo[0].link), _vertical-align="middle")}}

.. result in a SyntaxError: keyword can't be an expression

According to W3C I should be able to set vertical-align on an img.


Kind regards,

Annet.


[web2py] CAS not found

2010-11-10 Thread notabene
The CAS  provider applicance should be here.
http://mdp.cti.depaul.edu/appliances/default/index  (https://
www.web2py.com/cas)
https://mdp.cti.depaul.edu/cas (http://en.wikipedia.org/wiki/
Central_Authentication_Service).

But I am not able to find it?


Re: [web2py] Re: IMG helper and _width

2010-11-10 Thread Bruno Rocha
This is working for me:

{{=IMG(_src=URL(r=request,a='base',c='static',f='base/card/logos/%s' %
logo[0].link), _style="vertical-align:'middle';")}}

2010/11/10 annet 

> Massimo,
>
> Thanks, problem solved. However, this:
>
> {{=IMG(_src=URL(r=request,a='base',c='static',f='base/card/logos/%s' %
> logo[0].link), _vertical-align="middle")}}
>
> .. result in a SyntaxError: keyword can't be an expression
>
> According to W3C I should be able to set vertical-align on an img.
>
>
> Kind regards,
>
> Annet.




-- 

http://rochacbruno.com.br


[web2py] Re: How to switch back to English for the Admin interface?

2010-11-10 Thread Stefan Scholl
I know, but I don't want to use one browser for development (English)
and one for the rest (German).


On 9 Nov., 14:28, mdipierro  wrote:
> wait. You should not need to delete files. The language is set by your
> browser.
>
> On Nov 9, 3:41 am, Stefan Scholl  wrote:
>
>
>
>
>
>
>
> > Oops, found it 5 minutes later.
>
> > In case somebody wants to switch back to English, too:
>
> > Delete (or rename) your language in applications/admin/languages


[web2py] Re: validators order

2010-11-10 Thread andrej burja
thank you
it is too obvious to see that i made replacement of the validators :)

On Nov 4, 10:24 am, DenesL  wrote:
> On Nov 3, 3:52 pm, andrej burja  wrote:
>
> > hi
>
> > why is order of validators important?
> > i have
>
> > db.tecaj.voditelj.requires=IS_NOT_EMPTY()
> > db.tecaj.voditelj.requires=IS_IN_DB(db,'person.id','%(name)s')
>
> > why does putting the IS_NOT_EMPTY() at the end doesn't produce
> > dropdown list?
>
> Your code replaces one validator with another,
> it does not create a list with both.
>
> To have both and get a dropdown you need something like:
> db.tecaj.voditelj.requires=[IS_NOT_EMPTY(),IS_IN_DB(...)]
>
> > do i need the IS_NOT_EMPTY() if i have IS_IN_DB validator?
>
> It depends on your data and model.
> In your case it is superfluous because you are storing an id which can
> not be empty.
> But if your requires was: IS_IN_DB(db,'person.name')
> and some entry in person.name was empty then you would need an
> IS_NOT_EMPTY validator to avoid having an empty entry.
>
> > andrej


Re: [web2py] Re: "UnicodeDecodeError: 'ascii' codec can't decode byte ...

2010-11-10 Thread Omri
sorry for the stupid question - but how can I call the "print data" function
inside a function that is called through JSONRPC? where will I see the
output?
in case it helps - I know that at least I get the two fields that I sent,
because the last line (where I name them specifically) works.

On Tue, Nov 9, 2010 at 21:01, mdipierro  wrote:

> As a debug check. I'd like to see what you gate if you "print data"
> before the update.
> Just in case what you put it in it is not what you get.
>
> On Nov 9, 1:25 pm, Omri  wrote:
> > in the qooxdoo application, I define data as
> > data = {name: "Prüfung", textfield : "Etwas mit umlaut- üäüöö"}
> > and then send it through an asynchronous call (using
> > qx.io.remote.Rpc.callAsync)
> >
> > On Tue, Nov 9, 2010 at 19:42, mdipierro  wrote:
> > > can you print data? What is in data?
> >
> > > On Nov 9, 12:20 pm, Omri  wrote:
> > > > I did some tryouts and it seems that the only problem is with the
> > > > update method, and then only when called through service.jsonrpc. I
> > > > created the following model:
> >
> > > > db.define_table("debug_stuff",
> > > > Field("name", length=100),
> > > > Field("textfield", "text"),
> > > > format="%(name)s")
> >
> > > > and defined the following function in the controller (default):
> >
> > > > @service.jsonrpc
> > > > def debug_umlauts(data):
> > > > # db["debug_stuff"].insert(**data)  #  <--- Worked, no
> problem
> > > > # db(db["debug_stuff"]["id"] == 2).update(**data)   # <---
> Didn't
> > > > work
> > > > db(db["debug_stuff"]["id"] == 2).update(name = data['name'],
> > > > textfield=data['textfield'])  # <--- Worked
> > > > return "OK update"
> >
> > > > The only line that didn't work was the second one, where I tried to
> > > > use the **data for the update method. The problem is that I want the
> > > > method to be general, and therefore cannot use the method of the
> third
> > > > line to specify for .update what fields I'm updating.
> >
> > > > Thanks,
> > > > Omri
> >
> > > > On Nov 8, 5:19 pm, mdipierro  wrote:
> >
> > > > > Can you try put a u in front of the string u"..."
> >
> > > > > On Nov 8, 5:30 am, Omri  wrote:
> >
> > > > > > Hello,
> >
> > > > > > I'm having a unicode problem with the DAL.
> >
> > > > > > I'm developing a (mainly) RPC database application with qooxdoo
> as JS
> > > > > > framework and web2py as the webserver.
> >
> > > > > > I have created a fairly generic update_record function which
> simply
> > > > > > gets two input variables - a table name and a data dictionary
> with
> > > > > > name/value pairs which correspond to the fields of the table.
> > > > > > My function looks like this:
> >
> > > > > > def update_record(table_name, data):
> > > > > > db(db[table_name]['id'] == data['id']).update(**data)
> > > > > > return db(db[table_name]['id'] == data['id']).select()
> >
> > > > > > My application should work both in English and in German, and my
> > > > > > problem is that when I try to update a string value with an
> Umlaut
> > > > > > (example - "Überwlad") I get an error:
> > > > > > "UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in
> > > > > > position..."
> >
> > > > > > I am able to insert records to the database with Umlauts, but I
> use a
> > > > > > different method for the insert. I use the syntax of .insert(name
> =
> > > > > > value, name2 = value2,...).
> >
> > > > > > I tried to encode all the data keys which are unicode objects
> without
> > > > > > success, it keeps raising the same error.
> >
> > > > > > Am I missing something here, or is this a bug? And more
> > > interestingly,
> > > > > > how can it be solved?
> >
> > > > > > Thanks,
> > > > > > Omri
> >
> >
>


[web2py] Re: Manipulate Rows Object and/or SQLTABLE

2010-11-10 Thread villas
The function looks interesting, but I didnt understand how to create
the cols var.

def mytable(rows, cols):
return  TABLE(*[TR(*[TD(row[c]) for c in cols]) for row in rows])

I would be grateful for an example how it might work.

I did have this other idea to include an extra column, but I imagine
that it's not so elegant as above.

rows = db(db.test.id>0).select()
extras = list()
for row in rows: extras.append('whatever')

for row,extra in zip(rows,extras):
print TR(TD(row.id),TD(extra))

-D

On Nov 9, 6:33 pm, mdipierro  wrote:
> I see two options:
>
> 1) use
>
>     db.table.field.represent = lambda value: DIV(value)
>
> and give any representation you want to the field value.
>
> 2) If this does not work make your own SQLTABLE helper:
>
> def mytable(rows, cols):
>     return  TABLE(*[TR(*[TD(row[c]) for c in cols]) for row in rows)
>
> On Nov 9, 11:36 am, villas  wrote:
>
> > I want to customize the result of SQLTABLE so that it can make me a
> > nice table without lines and lines of code in my view file.  To
> > achieve that,  I need for example to:
>
> > 1) Add columns to hold icons and links and extra stuff.
> > 2) Customize the rows, e.g.  links which depend on content,  different
> > icons etc
>
> > After giving it some thought,  I think I should leave SQLTABLE alone
> > and concentrate on 'improving' the rows object so that it contains
> > everything I want before passing it to SQLTABLE.
>
> > To do 1) I can simply add a column to the rows object. How can I best
> > do that?
> > To do 2) I could iterate the rows object and make changes.
>
> > Or  maybe there is another way.
> > I appreciate that if I want to style the HTML table,  I'll have to
> > write my code in the form (which I am trying to avoid).
>
> > Thanks,
> > -D
>
>


[web2py] Small suggestion regarding auth.add_membership

2010-11-10 Thread Omri
Hello all,

I used auth.add_membership today for the first time, and I realized
that the add_membership function adds a membership also if the user
already has this membership.

Wouldn't it make more sense if the function first uses the
has_membership function to check if the user is already a part of the
group?

Thanks for the great work with web2py! I love it :)
Omri


Re: [web2py] Re: IMG helper and _width

2010-11-10 Thread Martín Mulone
Like bruno said, there are no attribute vertical-align in img object, this
is  css style thing

2010/11/10 Bruno Rocha 

> This is working for me:
>
> {{=IMG(_src=URL(r=request,a='base',c='static',f='base/card/logos/%s' %
> logo[0].link), _style="vertical-align:'middle';")}}
>
> 2010/11/10 annet 
>
> Massimo,
>>
>> Thanks, problem solved. However, this:
>>
>> {{=IMG(_src=URL(r=request,a='base',c='static',f='base/card/logos/%s' %
>> logo[0].link), _vertical-align="middle")}}
>>
>> .. result in a SyntaxError: keyword can't be an expression
>>
>> According to W3C I should be able to set vertical-align on an img.
>>
>>
>> Kind regards,
>>
>> Annet.
>
>
>
>
> --
>
> http://rochacbruno.com.br
>



-- 
My blog: http://martin.tecnodoc.com.ar
My portfolio *spanish*: http://www.tecnodoc.com.ar
Checkout my last proyect instant-press: http://www.instant2press.com


[web2py] Re: linked tables and dropdown display

2010-11-10 Thread andrej burja
does not work, still getting id and no name

On Nov 4, 3:59 pm, mdipierro  wrote:
> do this:
>
> db.define.table('basic'
>                 Field('name1')
>                 ...,format='%(name1)s')
>
> db.define.table('advanced'
>                 Field('name2',db.basic)
>                 ...,format='%(name2)s')
>
> # db.advanced.name.requires=IS_IN_DB(db,'basic.id','%(name1)s')
>
> db.define.table('data'
>                 Field('something',db.advanced)
>                 ...)


Re: [web2py] Re: Not getting a result from query

2010-11-10 Thread Lorin Rivers
Alex,

You put me on the right track! Thanks.

-- 
Lorin Rivers
Mosasaur: Killer Technical Marketing 

512/203.3198 (m)




[web2py] Error Installing Appliance

2010-11-10 Thread Syed
Apologies for what will probably be a complete noob-error. I just
tried installing Instant Press through the web2py admin and received
the error.

This is what I did on my Windows 7 machine running the x64 OS.
1. Downloaded and installed Python 2.5.5.7 (x86) from ActiveState
2. Downloaded and installed web2py
3. Downloaded Instant Press Beta5 from code.google.com

I then started web2py and pulled up the admin site. I named the
package using "Upload & install packed application", located on the
right-side of the page and fourth box from the top. I chose the zipped-
package from my desktop, named it instant_press, and then clicked
install. I then received the following error:

unable to install application "instant_press"

Am I doing something wrong?


[web2py] Re: IMG helper and _width

2010-11-10 Thread DenesL

Annet, allow me a little explanation on why you got SyntaxError:
keyword can't be an expression.
web2py does not know that you are using CSS inside HTML, the error
happens because IMG is expecting named arguments, which are dictionary
keys and those keys must be valid hashable ids.

_src is a valid hashable id.
_vertical-align is not, because python will try to interpret that as
the following expression:
_vertical (an id) minus (math operator) align (another id).

Hope this helps.

On Nov 10, 7:00 am, Martín Mulone  wrote:
> Like bruno said, there are no attribute vertical-align in img object, this
> is  css style thing
>
> 2010/11/10 Bruno Rocha 
>
>
>
> > This is working for me:
>
> > {{=IMG(_src=URL(r=request,a='base',c='static',f='base/card/logos/%s' %
> > logo[0].link), _style="vertical-align:'middle';")}}
>
> > 2010/11/10 annet 
>
> > Massimo,
>
> >> Thanks, problem solved. However, this:
>
> >> {{=IMG(_src=URL(r=request,a='base',c='static',f='base/card/logos/%s' %
> >> logo[0].link), _vertical-align="middle")}}
>
> >> .. result in a SyntaxError: keyword can't be an expression
>
> >> According to W3C I should be able to set vertical-align on an img.
>
> >> Kind regards,
>
> >> Annet.
>
> > --
>
> >http://rochacbruno.com.br
>
> --
> My blog:http://martin.tecnodoc.com.ar
> My portfolio *spanish*:http://www.tecnodoc.com.ar
> Checkout my last proyect instant-press:http://www.instant2press.com


[web2py] Re: linked tables and dropdown display

2010-11-10 Thread mdipierro
ERRATA:

do this:

db.define.table('basic'
Field('name1')
...,format='%(name1)s')

db.define.table('advanced'
Field('name2',db.basic)
...,format=lambda row: db.basic(row.name2).name1)

# db.advanced.name.requires=IS_IN_DB(db,'basic.id','%(name1)s')

db.define.table('data'
Field('something',db.advanced)
...)


but this is going to be SOOO slow. You are making two select per each
row in the dropdown.

On Nov 4, 8:59 am, mdipierro  wrote:
> do this:
>
> db.define.table('basic'
>                 Field('name1')
>                 ...,format='%(name1)s')
>
> db.define.table('advanced'
>                 Field('name2',db.basic)
>                 ...,format='%(name2)s')
>
> # db.advanced.name.requires=IS_IN_DB(db,'basic.id','%(name1)s')
>
> db.define.table('data'
>                 Field('something',db.advanced)
>                 ...)


[web2py] Re: "UnicodeDecodeError: 'ascii' codec can't decode byte ...

2010-11-10 Thread mdipierro
If you start web2py from the console you should see the output to the
console. You can also print to a file or log the output if that makes
it easier.

On Nov 10, 5:47 am, Omri  wrote:
> sorry for the stupid question - but how can I call the "print data" function
> inside a function that is called through JSONRPC? where will I see the
> output?
> in case it helps - I know that at least I get the two fields that I sent,
> because the last line (where I name them specifically) works.
>
> On Tue, Nov 9, 2010 at 21:01, mdipierro  wrote:
> > As a debug check. I'd like to see what you gate if you "print data"
> > before the update.
> > Just in case what you put it in it is not what you get.
>
> > On Nov 9, 1:25 pm, Omri  wrote:
> > > in the qooxdoo application, I define data as
> > > data = {name: "Prüfung", textfield : "Etwas mit umlaut- üäüöö"}
> > > and then send it through an asynchronous call (using
> > > qx.io.remote.Rpc.callAsync)
>
> > > On Tue, Nov 9, 2010 at 19:42, mdipierro  wrote:
> > > > can you print data? What is in data?
>
> > > > On Nov 9, 12:20 pm, Omri  wrote:
> > > > > I did some tryouts and it seems that the only problem is with the
> > > > > update method, and then only when called through service.jsonrpc. I
> > > > > created the following model:
>
> > > > > db.define_table("debug_stuff",
> > > > >         Field("name", length=100),
> > > > >         Field("textfield", "text"),
> > > > >         format="%(name)s")
>
> > > > > and defined the following function in the controller (default):
>
> > > > > @service.jsonrpc
> > > > > def debug_umlauts(data):
> > > > >         # db["debug_stuff"].insert(**data)  #  <--- Worked, no
> > problem
> > > > >         # db(db["debug_stuff"]["id"] == 2).update(**data)   # <---
> > Didn't
> > > > > work
> > > > >         db(db["debug_stuff"]["id"] == 2).update(name = data['name'],
> > > > > textfield=data['textfield'])  # <--- Worked
> > > > >         return "OK update"
>
> > > > > The only line that didn't work was the second one, where I tried to
> > > > > use the **data for the update method. The problem is that I want the
> > > > > method to be general, and therefore cannot use the method of the
> > third
> > > > > line to specify for .update what fields I'm updating.
>
> > > > > Thanks,
> > > > > Omri
>
> > > > > On Nov 8, 5:19 pm, mdipierro  wrote:
>
> > > > > > Can you try put a u in front of the string u"..."
>
> > > > > > On Nov 8, 5:30 am, Omri  wrote:
>
> > > > > > > Hello,
>
> > > > > > > I'm having a unicode problem with the DAL.
>
> > > > > > > I'm developing a (mainly) RPC database application with qooxdoo
> > as JS
> > > > > > > framework and web2py as the webserver.
>
> > > > > > > I have created a fairly generic update_record function which
> > simply
> > > > > > > gets two input variables - a table name and a data dictionary
> > with
> > > > > > > name/value pairs which correspond to the fields of the table.
> > > > > > > My function looks like this:
>
> > > > > > > def update_record(table_name, data):
> > > > > > >         db(db[table_name]['id'] == data['id']).update(**data)
> > > > > > >         return db(db[table_name]['id'] == data['id']).select()
>
> > > > > > > My application should work both in English and in German, and my
> > > > > > > problem is that when I try to update a string value with an
> > Umlaut
> > > > > > > (example - "Überwlad") I get an error:
> > > > > > > "UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in
> > > > > > > position..."
>
> > > > > > > I am able to insert records to the database with Umlauts, but I
> > use a
> > > > > > > different method for the insert. I use the syntax of .insert(name
> > =
> > > > > > > value, name2 = value2,...).
>
> > > > > > > I tried to encode all the data keys which are unicode objects
> > without
> > > > > > > success, it keeps raising the same error.
>
> > > > > > > Am I missing something here, or is this a bug? And more
> > > > interestingly,
> > > > > > > how can it be solved?
>
> > > > > > > Thanks,
> > > > > > > Omri
>
>


[web2py] Re: Plugin_JqGrid long-polling

2010-11-10 Thread AsmanCom
Is there no solution to my concerns?

It´s such a pity...


[web2py] Re: Small suggestion regarding auth.add_membership

2010-11-10 Thread mdipierro
yes. In trunk, please check it.

On Nov 10, 5:52 am, Omri  wrote:
> Hello all,
>
> I used auth.add_membership today for the first time, and I realized
> that the add_membership function adds a membership also if the user
> already has this membership.
>
> Wouldn't it make more sense if the function first uses the
> has_membership function to check if the user is already a part of the
> group?
>
> Thanks for the great work with web2py! I love it :)
> Omri


[web2py] Re: CAS not found

2010-11-10 Thread mdipierro
Has moved

http://web2py.com/cas

On Nov 10, 6:46 am, notabene  wrote:
> The CAS  provider applicance should be 
> here.http://mdp.cti.depaul.edu/appliances/default/index (https://www.web2py.com/cas)https://mdp.cti.depaul.edu/cas(http://en.wikipedia.org/wiki/
> Central_Authentication_Service).
>
> But I am not able to find it?


[web2py] Re: Manipulate Rows Object and/or SQLTABLE

2010-11-10 Thread DenesL
If all you need is an extra column have a look at col3 in SQLFORM
http://web2py.com/book/default/chapter/07#SQLFORM


On Nov 10, 5:33 am, villas  wrote:
> The function looks interesting, but I didnt understand how to create
> the cols var.
>
> def mytable(rows, cols):
> return  TABLE(*[TR(*[TD(row[c]) for c in cols]) for row in rows])
>
> I would be grateful for an example how it might work.
>
> I did have this other idea to include an extra column, but I imagine
> that it's not so elegant as above.
>
> rows = db(db.test.id>0).select()
> extras = list()
> for row in rows: extras.append('whatever')
>
> for row,extra in zip(rows,extras):
> print TR(TD(row.id),TD(extra))
>
> -D
>
> On Nov 9, 6:33 pm, mdipierro  wrote:
>
> > I see two options:
>
> > 1) use
>
> > db.table.field.represent = lambda value: DIV(value)
>
> > and give any representation you want to the field value.
>
> > 2) If this does not work make your own SQLTABLE helper:
>
> > def mytable(rows, cols):
> > return  TABLE(*[TR(*[TD(row[c]) for c in cols]) for row in rows)
>
> > On Nov 9, 11:36 am, villas  wrote:
>
> > > I want to customize the result of SQLTABLE so that it can make me a
> > > nice table without lines and lines of code in my view file.  To
> > > achieve that,  I need for example to:
>
> > > 1) Add columns to hold icons and links and extra stuff.
> > > 2) Customize the rows, e.g.  links which depend on content,  different
> > > icons etc
>
> > > After giving it some thought,  I think I should leave SQLTABLE alone
> > > and concentrate on 'improving' the rows object so that it contains
> > > everything I want before passing it to SQLTABLE.
>
> > > To do 1) I can simply add a column to the rows object. How can I best
> > > do that?
> > > To do 2) I could iterate the rows object and make changes.
>
> > > Or  maybe there is another way.
> > > I appreciate that if I want to style the HTML table,  I'll have to
> > > write my code in the form (which I am trying to avoid).
>
> > > Thanks,
> > > -D


[web2py] Re: Plugin_JqGrid long-polling

2010-11-10 Thread mdipierro
Sorry I did not help. I cannot help you because the code you have
above is incomplete. It opens a """ but never closes so I not
understand how callback is used. Anyway I assume in the view you have:


{{callback = URL(r=request,c='plugin_jqgrid',f='data',
   vars=dict(tablename=table._tablename,
 columns=','.join(columns),
 fieldname=fieldname or '',
 fieldvalue=fieldvalue,
 ))}}

var server_time="test"

... jQuery.getJSON('{{=callback}}
&'server_time='+escape(server_time)) ...

hope this helps.




On Nov 10, 8:24 am, AsmanCom  wrote:
> Is there no solution to my concerns?
>
> It´s such a pity...


[web2py] Re: Error Installing Appliance

2010-11-10 Thread mdipierro
If you are using Windows, can you please try the web2py binary
distribution. Personally I have never used web2py with ActiveState
Python and I cannot exclude some quirks with it.

On Nov 10, 7:31 am, Syed  wrote:
> Apologies for what will probably be a complete noob-error. I just
> tried installing Instant Press through the web2py admin and received
> the error.
>
> This is what I did on my Windows 7 machine running the x64 OS.
> 1. Downloaded and installed Python 2.5.5.7 (x86) from ActiveState
> 2. Downloaded and installed web2py
> 3. Downloaded Instant Press Beta5 from code.google.com
>
> I then started web2py and pulled up the admin site. I named the
> package using "Upload & install packed application", located on the
> right-side of the page and fourth box from the top. I chose the zipped-
> package from my desktop, named it instant_press, and then clicked
> install. I then received the following error:
>
> unable to install application "instant_press"
>
> Am I doing something wrong?


[web2py] Re: error with uploadfield and blob

2010-11-10 Thread mdipierro
bug. Fixed in trunk. Sorry it took so long.

On Nov 8, 10:38 pm, "richard.ree"  wrote:
> I want to upload a file and store it in a blob field:
>
> db.define_table(
>     "data",
>     Field("citation", "string", required=True, notnull=True),
>     Field("datafile", "upload", uploadfield="data"),
>     Field("data", "blob"),
>     )
>
> But if I insert a record (through SQLFORM or admin) but leave the
> datafile field empty, i.e., I input a citation but not a file, I get
> this error:
>
> web2py Version 1.88.2 (2010-10-29 23:04:43)
>
> Traceback (most recent call last):
>   File "/home/rree/web2py/gluon/restricted.py", line 188, in
> restricted
>     exec ccode in environment
>   File "/home/rree/web2py/applications/mytest/controllers/
> appadmin.py", line 410, in 
>   File "/home/rree/web2py/gluon/globals.py", line 96, in 
>     self._caller = lambda f: f()
>   File "/home/rree/web2py/applications/mytest/controllers/
> appadmin.py", line 125, in insert
>     if form.accepts(request.vars, session):
>   File "/home/rree/web2py/gluon/sqlhtml.py", line 1105, in accepts
>     value = fields[fieldname]
> KeyError: 'data'
>
> How to make the upload field optional?
>
> Thanks
> -Rick


[web2py] Re: Upload a file to db and store all metadata to separated db fields

2010-11-10 Thread mdipierro
def Upload():
from gluon.contenttype import contenttype
import os, stat
form=SQLFORM(db.image)

if form.accepts(request.vars, session):
file_handler = request.vars.pic ### this if a cgi.FieldStorage
file_path  = os.path.join(request.folder,
'uploads/',form.vars.pic)
raw_file_size = file_handler.?file_size()
MIME_Version  = ?get_MIME()
Content_ID= file_handler.?file_handler()
Content_Type  = file_handler.?file_type()
file_header   = ?get_Phys_File_Header(file_handler)

db(db.image.id==form.vars.id).update(
physical_file_name = file_path,
file_extension = file_path.split('.')[-1],
file_size = os.stat(file_path)[stat.ST_SIZE],
Content_Type =  contenttype(file_name),
MIME_Version =  ?
Content_ID =  ?,
file_header = ?,
)

response.flash = 'File Uploaded'

return dict(form=form)

I fixed some. Not all because I am not sure what those fields should
contain.


On Nov 9, 3:52 pm, Alexandre Augusto  wrote:
> Hi Massimo and Cesar. First of all another one zillion thxz to the
> Extremely Amazing  Framework ever created !
>
> I have a sittuation that is not the same as 
> Cesar:http://groups.google.com/group/web2py/browse_thread/thread/c83cd69dee...
> but somehow it is related..
> and I did spent like 6 days trying many things and I could not make it
> right... hope you could help me out..
> and maybe this solves many others problems...
>
> *In a nut shell, I'm trying to upload the file, store it on the
> database (using the two fields upload and  blob ),
> and save all meta-data and common information to different fields on
> the same record *
>
> *By meta-data I refer to file Mime types*
>  1. MIME-Version
>  2. Content-ID
>  3. Content-Type
>    [ 4.  File header signature, extracted from the file first data
> block -- not sure one of the 3 fields above provide this incase not ]
>
> *and common infomation*
> I mean all user information that could be associated to the file:
>
> 5. Full file name ( 'C:\My Documents\pics\agape.jpg' )
> 6. File Extension (  '.jpg' )
> 7. File Size ( ' 230 kb ' )
>  n. ...or any other metadata information available for the file
>
> I could make the upload/ and blob/ work but I'm not having success to
> gather and extract this information from the file at the same time I'm
> uploading and storing it on the DB..
>
> This is for my Computer Science Bachelor Graduation Work at Unip, São
> Paulo University, once i get it more mature  I'm going to release it
> to the community, as I'm aiming to create an Open Source Project
> similar what happened to Instant Press but on a different scope
> application some sort of ECM tool.. Even being aware that may not be
> wise to store all these and some could be derivative from other
> fields, I need to make this work for the proof of concept to develop
> other concepts in the project.
>
> So my model is like this
>
> # Model
> db.define_table("image",
>     Field('pic','upload',default=''),
>     Field('file','upload', default="", autodelete=True,
> uploadfield='file_binary_data') ,
>     Field('file_binary_data', 'blob'),
>     Field('physical_file_name'), # the full file name.. is it possible
> grab the folder from where it was uploaded ?
>     Field('file_extension'),
>     Field('file_size'),
>     Field('MIME_Version'),
>     Field('Content_ID'),
>     Field('Content_Type'),
>     Field('file_header'),  #File header footprint extracted from X top
> chars from file
>     )
>
> #Controller
> def Upload():
>     form=SQLFORM(db.image)
>
>     if form.accepts(request.vars, session):
>
>         file_name = request.vars.pic
>
>         try: ext = re.compile('\.\w+
> $').findall(file_name.filename.strip())[0]
>         except IndexError: ext = '.txt'
>
>         #pic_filename = 'image.'+'pic.'+str(random.random())[2:] + ext
>         #pic_filename = 'image.'+'pic.' +
> str(uuid.uuid4()).replace('-','') + ext
>
>         #pic_filename = pic.filename
>         file_path  = os.path.join(request.folder, 'uploads/',
> file_name)
>         file_handler = open(file_path,'wb')
>         file_handler.close()
>
>         raw_file_size = file_handler.?file_size()
>         MIME_Version  = ?get_MIME()
>         Content_ID    = file_handler.?file_handler()
>         Content_Type  = file_handler.?file_type()
>         file_header   = ?get_Phys_File_Header(file_handler)
>
>         image_id = db.image.insert(
>                 pic  = file_name.uuid64 ,
>                 file_binary_data = file_name ,
>                 physical_file_name = file_path ,
>                 file_extension = ext ,
>                 file_size =  raw_file_size ,
>                 MIME_Version =  MIME_Version ,
>                 Content_ID =  Content_ID ,
>                 Content_Type =  Content_Type ,
>                 file_header = file_header ,
>             )
>
>        

[web2py] Re: Error Installing Appliance

2010-11-10 Thread Syed
I'll make sure that all variables are removed from the equation.--I'll
uninstall everything and that start from scratch with 2.5.5 from
python.org. And then I'll be sure to try the binary distribution. I'll
report back with the results. Thanks.


[web2py] Re: Plugin_JqGrid long-polling

2010-11-10 Thread AsmanCom
Hi Massimo, never mind. I do not want the variable passed with
jQuery.getJSON, but with the url: '% (callback) s', which is called
with LoadComplete: .trigger ("reload grid").
Here's the code so far..

_
app/models/plugin_jqgrid.py:

def
plugin_live_grid(table,fieldname=None,fieldvalue=None,col_widths={},
 
_id=None,columns=None,col_width=80,width=700,height=300):
"""
just do to embed the jqGrid with ajax search capability and
pagination
{{=plugin_jqgrid(db.tablename)}}
- table is the db.tablename
- fieldname, fieldvalue are an optional filter
(fieldname==fieldvalue)
- _id is the "id" of the DIV that contains the jqGrid
- columns is a list of columns names to be displayed
- cold_width is the width of each column
- height is the height of the jqGrid
"""
from gluon.serializers import json
_id = 'jqgrid_%s' % table
columns = columns or [x for x in table.fields if
table[x].readable]
colnames = [x.replace('_',' ').capitalize() for x in columns]
colmodel = [{'name':x,'index':x,
'width':col_widths.get(x,col_width), 'sortable':True} \
for x in columns if table[x].readable]
callback = URL(r=request,c='plugin_jqgrid',f='data',
   vars=dict(tablename=table._tablename,
 columns=','.join(columns),
 fieldname=fieldname or '',
 fieldvalue=fieldvalue,
 ))
script="""
var server_time=null;
jQuery(document).ready(function(server_time){jQuery("#%
(id)s").jqGrid({
url:'%(callback)s',
datatype: "json",
colNames: %(colnames)s,
colModel:%(colmodel)s,
rowNum:10,
rowList:[20,50,100],
pager: '#%(id)s_pager',
onSelectRow: function(postdata) {web2py_ajax_page('get','/jqgrid2/
default/tabs2/'+(postdata),null,'panel');},
loadComplete: function () {
var server_time=jQuery("#%(id)s").getGridParam('userData');

setTimeout(function(){
 alert(server_time);
 jQuery("#%(id)s").jqGrid().setGridParam({datatype:"json"});
 jQuery("#%(id)s").jqGrid().trigger("reloadGrid",
[{current:true}]);

}, 1000); /* 1000..after 1 seconds */

},
loadError: function () {
setTimeout(function(){

 jQuery("#%(id)s").jqGrid().setGridParam({datatype:"json"});
 jQuery("#%(id)s").jqGrid().trigger("reloadGrid",
[{current:true}]);

}, 15000); /* milliseconds (15seconds) */

},
caption:'%(tablename)s',
viewrecords: true,
height:%(height)s,
loadui:"disabled"});
jQuery("#%(id)s").jqGrid('navGrid','#%(id)s_pager',
{search:true,add:false,edit:false,del:false});
jQuery("#%(id)s").setGridWidth(%(width)s,false);});
""" % dict(callback=callback,colnames=json(colnames),
tablename=table._tablename.capitalize(),
   colmodel=json(colmodel),id=_id,height=height,width=width)
return TAG[''](TABLE(_id=_id),
   DIV(_id=_id+"_pager"),
   SCRIPT(script))

___

app/controllers/plugin_jqgrid.py:

from random import randint
from time import sleep

def error():
raise HTTP(400)

def data2():# for testing
if randint(1,3) == 1:
raise HTTP(400)
else:
return data2()

def data():
sleep(10) # for testing
"http://trirand.com/blog/jqgrid/server.php?
q=1&_search=false&nd=1267835445772&rows=10&page=1&sidx=amount&sord=asc&searchField=&searchString=&searchOper="
from gluon.serializers import json
import cgi
tablename = request.vars.tablename or error()
columns = (request.vars.columns or error()).split(',')
rows=int(request.vars.rows or 25)
page=int(request.vars.page or 0)
sidx=request.vars.sidx or 'id'
sord=request.vars.sord or 'asc'
searchField=request.vars.searchField
searchString=request.vars.searchString
searchOper={'eq':lambda a,b: a==b,
'nq':lambda a,b: a!=b,
'gt':lambda a,b: a>b,
'ge':lambda a,b: a>=b,
'lt':lambda a,b: a0)
if searchField:
dbset=dbset(searchOper(table[searchField],searchString))
orderby = table[sidx]
if sord=='desc': orderby=~orderby
limitby=(rows*(page-1),rows*page)
fields = [table[f] for f in columns]
records = dbset.select(orderby=orderby,limitby=limitby,*fields)
nrecords = dbset.count()
items = {}
items['userdata']=request.now
items['page']=page
items['total']=int((nrecords+(rows-1))/rows)
items['records']=nrecords
readable_fields=[f.name for f in fields if f.readable]
def f(value,fieldname):
r = table[fieldname].represent
if r: value=r(value)
try: return value.xml()
except: return cgi.escape(str(value))

items['rows']=[{'id':r.id,'cell':[f(r[x],x) for x in
readable_fields]} \
   for r in records]
return json(items)



app/controllers/default.py:

# -*- coding: utf-8 -*-

##

[web2py] Re: Plugin_JqGrid long-polling

2010-11-10 Thread mdipierro
replace


jQuery(document).ready(function(server_time){jQuery("#%
(id)s").jqGrid({
url:'%(callback)s',


with


jQuery(document).ready(function(server_time){jQuery("#%
(id)s").jqGrid({
url:'%(callback)s&server_time'+escape(server_time),



On Nov 10, 9:34 am, AsmanCom  wrote:
> Hi Massimo, never mind. I do not want the variable passed with
> jQuery.getJSON, but with the url: '% (callback) s', which is called
> with LoadComplete: .trigger ("reload grid").
> Here's the code so far..
>
> _
> app/models/plugin_jqgrid.py:
>
> def
> plugin_live_grid(table,fieldname=None,fieldvalue=None,col_widths={},
>
> _id=None,columns=None,col_width=80,width=700,height=300):
>     """
>     just do to embed the jqGrid with ajax search capability and
> pagination
>     {{=plugin_jqgrid(db.tablename)}}
>     - table is the db.tablename
>     - fieldname, fieldvalue are an optional filter
> (fieldname==fieldvalue)
>     - _id is the "id" of the DIV that contains the jqGrid
>     - columns is a list of columns names to be displayed
>     - cold_width is the width of each column
>     - height is the height of the jqGrid
>     """
>     from gluon.serializers import json
>     _id = 'jqgrid_%s' % table
>     columns = columns or [x for x in table.fields if
> table[x].readable]
>     colnames = [x.replace('_',' ').capitalize() for x in columns]
>     colmodel = [{'name':x,'index':x,
> 'width':col_widths.get(x,col_width), 'sortable':True} \
>                     for x in columns if table[x].readable]
>     callback = URL(r=request,c='plugin_jqgrid',f='data',
>                    vars=dict(tablename=table._tablename,
>                              columns=','.join(columns),
>                              fieldname=fieldname or '',
>                              fieldvalue=fieldvalue,
>                              ))
>     script="""
> var server_time=null;
> jQuery(document).ready(function(server_time){jQuery("#%
> (id)s").jqGrid({
> url:'%(callback)s',
> datatype: "json",
> colNames: %(colnames)s,
> colModel:%(colmodel)s,
> rowNum:10,
> rowList:[20,50,100],
> pager: '#%(id)s_pager',
> onSelectRow: function(postdata) {web2py_ajax_page('get','/jqgrid2/
> default/tabs2/'+(postdata),null,'panel');},
> loadComplete: function () {
>     var server_time=jQuery("#%(id)s").getGridParam('userData');
>
>     setTimeout(function(){
>      alert(server_time);
>      jQuery("#%(id)s").jqGrid().setGridParam({datatype:"json"});
>      jQuery("#%(id)s").jqGrid().trigger("reloadGrid",
> [{current:true}]);
>
> }, 1000); /* 1000..after 1 seconds */
> },
>
> loadError: function () {
>     setTimeout(function(){
>
>      jQuery("#%(id)s").jqGrid().setGridParam({datatype:"json"});
>      jQuery("#%(id)s").jqGrid().trigger("reloadGrid",
> [{current:true}]);
>
> }, 15000); /* milliseconds (15seconds) */
> },
>
> caption:'%(tablename)s',
> viewrecords: true,
> height:%(height)s,
> loadui:"disabled"});
> jQuery("#%(id)s").jqGrid('navGrid','#%(id)s_pager',
> {search:true,add:false,edit:false,del:false});
> jQuery("#%(id)s").setGridWidth(%(width)s,false);});
> """ % dict(callback=callback,colnames=json(colnames),
> tablename=table._tablename.capitalize(),
>            colmodel=json(colmodel),id=_id,height=height,width=width)
>     return TAG[''](TABLE(_id=_id),
>                    DIV(_id=_id+"_pager"),
>                    SCRIPT(script))
>
> ___
>
> app/controllers/plugin_jqgrid.py:
>
> from random import randint
> from time import sleep
>
> def error():
>     raise HTTP(400)
>
> def data2():# for testing
>     if randint(1,3) == 1:
>         raise HTTP(400)
>     else:
>         return data2()
>
> def data():
>     sleep(10) # for testing
>     "http://trirand.com/blog/jqgrid/server.php?
> q=1&_search=false&nd=1267835445772&rows=10&page=1&sidx=amount&sord=asc&searchField=&searchString=&searchOper="
>     from gluon.serializers import json
>     import cgi
>     tablename = request.vars.tablename or error()
>     columns = (request.vars.columns or error()).split(',')
>     rows=int(request.vars.rows or 25)
>     page=int(request.vars.page or 0)
>     sidx=request.vars.sidx or 'id'
>     sord=request.vars.sord or 'asc'
>     searchField=request.vars.searchField
>     searchString=request.vars.searchString
>     searchOper={'eq':lambda a,b: a==b,
>                 'nq':lambda a,b: a!=b,
>                 'gt':lambda a,b: a>b,
>                 'ge':lambda a,b: a>=b,
>                 'lt':lambda a,b: a                 'le':lambda a,b: a<=b,
>                 'bw':lambda a,b: a.like(b+'%'),
>                 'bn':lambda a,b: ~a.like(b+'%'),
>                 'ew':lambda a,b: a.like('%'+b),
>                 'en':lambda a,b: ~a.like('%'+b),
>                 'cn':lambda a,b: a.like('%'+b+'%'),
>                 'nc':lambda a,b: ~a.like('%'+b+'%'),
>                 'in':lambda a,b: a.belongs(b.split()),
>                 'ni':lambda a,b: ~a.be

[web2py] Re: Error Installing Appliance

2010-11-10 Thread Anthony
Note, if you use the web2py binary, it includes Python (2.5, I think),
so you don't need to install Python separately. If you want to install
your own Python, then you can run web2py from source on Windows (make
sure your Python installation directory is in your Windows PATH
variable). If installing your own Python, you'll also want this:

http://sourceforge.net/projects/pywin32/

Also, you should be able to run Python 2.6 or 2.7 with web2py, so you
don't have to stick with 2.5.

Anthony

On Nov 10, 10:05 am, Syed  wrote:
> I'll make sure that all variables are removed from the equation.--I'll
> uninstall everything and that start from scratch with 2.5.5 from
> python.org. And then I'll be sure to try the binary distribution. I'll
> report back with the results. Thanks.


[web2py] help us test new admin on windows....

2010-11-10 Thread mdipierro
download the windows binary (nightly built) from

   http://web2py.com/examples/default/download

with FF and IE, try admin, try create a new app and edit a file,
report any problem.


[web2py] Re: Plugin_JqGrid long-polling

2010-11-10 Thread AsmanCom
tried it like this:


app/models/plugin_jqgrid.py:

var server_time=null;
jQuery(document).ready(function(server_time){jQuery("#%
(id)s").jqGrid({
url:'%(callback)s&server_time'+escape(server_time),


app/controllers/plugin_jqgrid.py:

def data():
sleep(10)
...
test1 = request.vars.server_time or error()
tablename = request.vars.tablename or error()
...
items = {}
items['userdata']=request.now
...
__

It seems not working, data is not returned by the controller.

On 10 Nov., 16:37, mdipierro  wrote:
> replace
>
> 
> jQuery(document).ready(function(server_time){jQuery("#%
> (id)s").jqGrid({
> url:'%(callback)s',
> 
>
> with
>
> 
> jQuery(document).ready(function(server_time){jQuery("#%
> (id)s").jqGrid({
> url:'%(callback)s&server_time'+escape(server_time),
> 
>
> On Nov 10, 9:34 am, AsmanCom  wrote:
>
> > Hi Massimo, never mind. I do not want the variable passed with
> > jQuery.getJSON, but with the url: '% (callback) s', which is called
> > with LoadComplete: .trigger ("reload grid").
> > Here's the code so far..
>
> > _
> > app/models/plugin_jqgrid.py:
>
> > def
> > plugin_live_grid(table,fieldname=None,fieldvalue=None,col_widths={},
>
> > _id=None,columns=None,col_width=80,width=700,height=300):
> >     """
> >     just do to embed the jqGrid with ajax search capability and
> > pagination
> >     {{=plugin_jqgrid(db.tablename)}}
> >     - table is the db.tablename
> >     - fieldname, fieldvalue are an optional filter
> > (fieldname==fieldvalue)
> >     - _id is the "id" of the DIV that contains the jqGrid
> >     - columns is a list of columns names to be displayed
> >     - cold_width is the width of each column
> >     - height is the height of the jqGrid
> >     """
> >     from gluon.serializers import json
> >     _id = 'jqgrid_%s' % table
> >     columns = columns or [x for x in table.fields if
> > table[x].readable]
> >     colnames = [x.replace('_',' ').capitalize() for x in columns]
> >     colmodel = [{'name':x,'index':x,
> > 'width':col_widths.get(x,col_width), 'sortable':True} \
> >                     for x in columns if table[x].readable]
> >     callback = URL(r=request,c='plugin_jqgrid',f='data',
> >                    vars=dict(tablename=table._tablename,
> >                              columns=','.join(columns),
> >                              fieldname=fieldname or '',
> >                              fieldvalue=fieldvalue,
> >                              ))
> >     script="""
> > var server_time=null;
> > jQuery(document).ready(function(server_time){jQuery("#%
> > (id)s").jqGrid({
> > url:'%(callback)s',
> > datatype: "json",
> > colNames: %(colnames)s,
> > colModel:%(colmodel)s,
> > rowNum:10,
> > rowList:[20,50,100],
> > pager: '#%(id)s_pager',
> > onSelectRow: function(postdata) {web2py_ajax_page('get','/jqgrid2/
> > default/tabs2/'+(postdata),null,'panel');},
> > loadComplete: function () {
> >     var server_time=jQuery("#%(id)s").getGridParam('userData');
>
> >     setTimeout(function(){
> >      alert(server_time);
> >      jQuery("#%(id)s").jqGrid().setGridParam({datatype:"json"});
> >      jQuery("#%(id)s").jqGrid().trigger("reloadGrid",
> > [{current:true}]);
>
> > }, 1000); /* 1000..after 1 seconds */
> > },
>
> > loadError: function () {
> >     setTimeout(function(){
>
> >      jQuery("#%(id)s").jqGrid().setGridParam({datatype:"json"});
> >      jQuery("#%(id)s").jqGrid().trigger("reloadGrid",
> > [{current:true}]);
>
> > }, 15000); /* milliseconds (15seconds) */
> > },
>
> > caption:'%(tablename)s',
> > viewrecords: true,
> > height:%(height)s,
> > loadui:"disabled"});
> > jQuery("#%(id)s").jqGrid('navGrid','#%(id)s_pager',
> > {search:true,add:false,edit:false,del:false});
> > jQuery("#%(id)s").setGridWidth(%(width)s,false);});
> > """ % dict(callback=callback,colnames=json(colnames),
> > tablename=table._tablename.capitalize(),
> >            colmodel=json(colmodel),id=_id,height=height,width=width)
> >     return TAG[''](TABLE(_id=_id),
> >                    DIV(_id=_id+"_pager"),
> >                    SCRIPT(script))
>
> > ___
>
> > app/controllers/plugin_jqgrid.py:
>
> > from random import randint
> > from time import sleep
>
> > def error():
> >     raise HTTP(400)
>
> > def data2():# for testing
> >     if randint(1,3) == 1:
> >         raise HTTP(400)
> >     else:
> >         return data2()
>
> > def data():
> >     sleep(10) # for testing
> >     "http://trirand.com/blog/jqgrid/server.php?
> > q=1&_search=false&nd=1267835445772&rows=10&page=1&sidx=amount&sord=asc&searchField=&searchString=&searchOper="
> >     from gluon.serializers import json
> >     import cgi
> >     tablename = request.vars.tablename or error()
> >     columns = (request.vars.columns or error()).split(',')
> >     rows=int(request.vars.rows or 25)
> >     page=int(request.vars.page or 0)
> >     sidx=request.vars.

[web2py] Re: Plugin_JqGrid long-polling

2010-11-10 Thread mdipierro
You need to install firebug and check in the console log what is going
on.

On Nov 10, 9:53 am, AsmanCom  wrote:
> tried it like this:
>
> app/models/plugin_jqgrid.py:
>
> var server_time=null;
> jQuery(document).ready(function(server_time){jQuery("#%
> (id)s").jqGrid({
> url:'%(callback)s&server_time'+escape(server_time),
>
> app/controllers/plugin_jqgrid.py:
>
> def data():
>     sleep(10)
>     ...
>     test1 = request.vars.server_time or error()
>     tablename = request.vars.tablename or error()
>     ...
>     items = {}
>     items['userdata']=request.now
>     ...
> __
>
> It seems not working, data is not returned by the controller.
>
> On 10 Nov., 16:37, mdipierro  wrote:
>
> > replace
>
> > 
> > jQuery(document).ready(function(server_time){jQuery("#%
> > (id)s").jqGrid({
> > url:'%(callback)s',
> > 
>
> > with
>
> > 
> > jQuery(document).ready(function(server_time){jQuery("#%
> > (id)s").jqGrid({
> > url:'%(callback)s&server_time'+escape(server_time),
> > 
>
> > On Nov 10, 9:34 am, AsmanCom  wrote:
>
> > > Hi Massimo, never mind. I do not want the variable passed with
> > > jQuery.getJSON, but with the url: '% (callback) s', which is called
> > > with LoadComplete: .trigger ("reload grid").
> > > Here's the code so far..
>
> > > _
> > > app/models/plugin_jqgrid.py:
>
> > > def
> > > plugin_live_grid(table,fieldname=None,fieldvalue=None,col_widths={},
>
> > > _id=None,columns=None,col_width=80,width=700,height=300):
> > >     """
> > >     just do to embed the jqGrid with ajax search capability and
> > > pagination
> > >     {{=plugin_jqgrid(db.tablename)}}
> > >     - table is the db.tablename
> > >     - fieldname, fieldvalue are an optional filter
> > > (fieldname==fieldvalue)
> > >     - _id is the "id" of the DIV that contains the jqGrid
> > >     - columns is a list of columns names to be displayed
> > >     - cold_width is the width of each column
> > >     - height is the height of the jqGrid
> > >     """
> > >     from gluon.serializers import json
> > >     _id = 'jqgrid_%s' % table
> > >     columns = columns or [x for x in table.fields if
> > > table[x].readable]
> > >     colnames = [x.replace('_',' ').capitalize() for x in columns]
> > >     colmodel = [{'name':x,'index':x,
> > > 'width':col_widths.get(x,col_width), 'sortable':True} \
> > >                     for x in columns if table[x].readable]
> > >     callback = URL(r=request,c='plugin_jqgrid',f='data',
> > >                    vars=dict(tablename=table._tablename,
> > >                              columns=','.join(columns),
> > >                              fieldname=fieldname or '',
> > >                              fieldvalue=fieldvalue,
> > >                              ))
> > >     script="""
> > > var server_time=null;
> > > jQuery(document).ready(function(server_time){jQuery("#%
> > > (id)s").jqGrid({
> > > url:'%(callback)s',
> > > datatype: "json",
> > > colNames: %(colnames)s,
> > > colModel:%(colmodel)s,
> > > rowNum:10,
> > > rowList:[20,50,100],
> > > pager: '#%(id)s_pager',
> > > onSelectRow: function(postdata) {web2py_ajax_page('get','/jqgrid2/
> > > default/tabs2/'+(postdata),null,'panel');},
> > > loadComplete: function () {
> > >     var server_time=jQuery("#%(id)s").getGridParam('userData');
>
> > >     setTimeout(function(){
> > >      alert(server_time);
> > >      jQuery("#%(id)s").jqGrid().setGridParam({datatype:"json"});
> > >      jQuery("#%(id)s").jqGrid().trigger("reloadGrid",
> > > [{current:true}]);
>
> > > }, 1000); /* 1000..after 1 seconds */
> > > },
>
> > > loadError: function () {
> > >     setTimeout(function(){
>
> > >      jQuery("#%(id)s").jqGrid().setGridParam({datatype:"json"});
> > >      jQuery("#%(id)s").jqGrid().trigger("reloadGrid",
> > > [{current:true}]);
>
> > > }, 15000); /* milliseconds (15seconds) */
> > > },
>
> > > caption:'%(tablename)s',
> > > viewrecords: true,
> > > height:%(height)s,
> > > loadui:"disabled"});
> > > jQuery("#%(id)s").jqGrid('navGrid','#%(id)s_pager',
> > > {search:true,add:false,edit:false,del:false});
> > > jQuery("#%(id)s").setGridWidth(%(width)s,false);});
> > > """ % dict(callback=callback,colnames=json(colnames),
> > > tablename=table._tablename.capitalize(),
> > >            colmodel=json(colmodel),id=_id,height=height,width=width)
> > >     return TAG[''](TABLE(_id=_id),
> > >                    DIV(_id=_id+"_pager"),
> > >                    SCRIPT(script))
>
> > > ___
>
> > > app/controllers/plugin_jqgrid.py:
>
> > > from random import randint
> > > from time import sleep
>
> > > def error():
> > >     raise HTTP(400)
>
> > > def data2():# for testing
> > >     if randint(1,3) == 1:
> > >         raise HTTP(400)
> > >     else:
> > >         return data2()
>
> > > def data():
> > >     sleep(10) # for testing
> > >     "http://trirand.com/blog/jqgrid/server.php?
> > > q=1&_search=false&nd=12678354457

[web2py] cas incorrect address in email

2010-11-10 Thread leone
Hi,
CAS return this incorrect address in email
https://mdp.cti.depaul.edu/cas/cas/verify?id=191&key=d1c373ab1570cfb9a7dbb53c186b37a2
It must be
https://www.web2py.com/cas/cas/verify?id=191&key=d1c373ab1570cfb9a7dbb53c186b37a2
What can I do to correct it.
There is a CAS application downloadable?
Thanks
leone


[web2py] Re: Plugin_JqGrid long-polling

2010-11-10 Thread AsmanCom
By the way, how can i set initially the "var server_time=null;" to a
python readble False?

THX

On 10 Nov., 16:55, mdipierro  wrote:
> You need to install firebug and check in the console log what is going
> on.
>
> On Nov 10, 9:53 am, AsmanCom  wrote:
>
> > tried it like this:
>
> > app/models/plugin_jqgrid.py:
>
> > var server_time=null;
> > jQuery(document).ready(function(server_time){jQuery("#%
> > (id)s").jqGrid({
> > url:'%(callback)s&server_time'+escape(server_time),
>
> > app/controllers/plugin_jqgrid.py:
>
> > def data():
> >     sleep(10)
> >     ...
> >     test1 = request.vars.server_time or error()
> >     tablename = request.vars.tablename or error()
> >     ...
> >     items = {}
> >     items['userdata']=request.now
> >     ...
> > __
>
> > It seems not working, data is not returned by the controller.
>
> > On 10 Nov., 16:37, mdipierro  wrote:
>
> > > replace
>
> > > 
> > > jQuery(document).ready(function(server_time){jQuery("#%
> > > (id)s").jqGrid({
> > > url:'%(callback)s',
> > > 
>
> > > with
>
> > > 
> > > jQuery(document).ready(function(server_time){jQuery("#%
> > > (id)s").jqGrid({
> > > url:'%(callback)s&server_time'+escape(server_time),
> > > 
>
> > > On Nov 10, 9:34 am, AsmanCom  wrote:
>
> > > > Hi Massimo, never mind. I do not want the variable passed with
> > > > jQuery.getJSON, but with the url: '% (callback) s', which is called
> > > > with LoadComplete: .trigger ("reload grid").
> > > > Here's the code so far..
>
> > > > _
> > > > app/models/plugin_jqgrid.py:
>
> > > > def
> > > > plugin_live_grid(table,fieldname=None,fieldvalue=None,col_widths={},
>
> > > > _id=None,columns=None,col_width=80,width=700,height=300):
> > > >     """
> > > >     just do to embed the jqGrid with ajax search capability and
> > > > pagination
> > > >     {{=plugin_jqgrid(db.tablename)}}
> > > >     - table is the db.tablename
> > > >     - fieldname, fieldvalue are an optional filter
> > > > (fieldname==fieldvalue)
> > > >     - _id is the "id" of the DIV that contains the jqGrid
> > > >     - columns is a list of columns names to be displayed
> > > >     - cold_width is the width of each column
> > > >     - height is the height of the jqGrid
> > > >     """
> > > >     from gluon.serializers import json
> > > >     _id = 'jqgrid_%s' % table
> > > >     columns = columns or [x for x in table.fields if
> > > > table[x].readable]
> > > >     colnames = [x.replace('_',' ').capitalize() for x in columns]
> > > >     colmodel = [{'name':x,'index':x,
> > > > 'width':col_widths.get(x,col_width), 'sortable':True} \
> > > >                     for x in columns if table[x].readable]
> > > >     callback = URL(r=request,c='plugin_jqgrid',f='data',
> > > >                    vars=dict(tablename=table._tablename,
> > > >                              columns=','.join(columns),
> > > >                              fieldname=fieldname or '',
> > > >                              fieldvalue=fieldvalue,
> > > >                              ))
> > > >     script="""
> > > > var server_time=null;
> > > > jQuery(document).ready(function(server_time){jQuery("#%
> > > > (id)s").jqGrid({
> > > > url:'%(callback)s',
> > > > datatype: "json",
> > > > colNames: %(colnames)s,
> > > > colModel:%(colmodel)s,
> > > > rowNum:10,
> > > > rowList:[20,50,100],
> > > > pager: '#%(id)s_pager',
> > > > onSelectRow: function(postdata) {web2py_ajax_page('get','/jqgrid2/
> > > > default/tabs2/'+(postdata),null,'panel');},
> > > > loadComplete: function () {
> > > >     var server_time=jQuery("#%(id)s").getGridParam('userData');
>
> > > >     setTimeout(function(){
> > > >      alert(server_time);
> > > >      jQuery("#%(id)s").jqGrid().setGridParam({datatype:"json"});
> > > >      jQuery("#%(id)s").jqGrid().trigger("reloadGrid",
> > > > [{current:true}]);
>
> > > > }, 1000); /* 1000..after 1 seconds */
> > > > },
>
> > > > loadError: function () {
> > > >     setTimeout(function(){
>
> > > >      jQuery("#%(id)s").jqGrid().setGridParam({datatype:"json"});
> > > >      jQuery("#%(id)s").jqGrid().trigger("reloadGrid",
> > > > [{current:true}]);
>
> > > > }, 15000); /* milliseconds (15seconds) */
> > > > },
>
> > > > caption:'%(tablename)s',
> > > > viewrecords: true,
> > > > height:%(height)s,
> > > > loadui:"disabled"});
> > > > jQuery("#%(id)s").jqGrid('navGrid','#%(id)s_pager',
> > > > {search:true,add:false,edit:false,del:false});
> > > > jQuery("#%(id)s").setGridWidth(%(width)s,false);});
> > > > """ % dict(callback=callback,colnames=json(colnames),
> > > > tablename=table._tablename.capitalize(),
> > > >            colmodel=json(colmodel),id=_id,height=height,width=width)
> > > >     return TAG[''](TABLE(_id=_id),
> > > >                    DIV(_id=_id+"_pager"),
> > > >                    SCRIPT(script))
>
> > > > ___
>
> > > > app/controllers/plugin_jqgrid.py:
>
> > > > from random import rand

Re: [web2py] Re: "UnicodeDecodeError: 'ascii' codec can't decode byte ...

2010-11-10 Thread Omri
I should have thought about that.. the result from the print data function
is:

{u'textfield': u'Viele Umlauts:
\xe4\xe4\xe4\xfc\xfc\xfc\xdc\xdc\xdc\xd6\xd6\xd6\xe4\xe4\xe4', u'name':
u'\xdcberprufen'}

for the following data sent:
data = {
  name : "Überprufen",
  textfield : "Viele Umlauts: äääüüüÜÜÜÖÖÖäää"
}

On Wed, Nov 10, 2010 at 15:23, mdipierro  wrote:

> If you start web2py from the console you should see the output to the
> console. You can also print to a file or log the output if that makes
> it easier.
>
> On Nov 10, 5:47 am, Omri  wrote:
> > sorry for the stupid question - but how can I call the "print data"
> function
> > inside a function that is called through JSONRPC? where will I see the
> > output?
> > in case it helps - I know that at least I get the two fields that I sent,
> > because the last line (where I name them specifically) works.
> >
> > On Tue, Nov 9, 2010 at 21:01, mdipierro  wrote:
> > > As a debug check. I'd like to see what you gate if you "print data"
> > > before the update.
> > > Just in case what you put it in it is not what you get.
> >
> > > On Nov 9, 1:25 pm, Omri  wrote:
> > > > in the qooxdoo application, I define data as
> > > > data = {name: "Prüfung", textfield : "Etwas mit umlaut- üäüöö"}
> > > > and then send it through an asynchronous call (using
> > > > qx.io.remote.Rpc.callAsync)
> >
> > > > On Tue, Nov 9, 2010 at 19:42, mdipierro 
> wrote:
> > > > > can you print data? What is in data?
> >
> > > > > On Nov 9, 12:20 pm, Omri  wrote:
> > > > > > I did some tryouts and it seems that the only problem is with the
> > > > > > update method, and then only when called through service.jsonrpc.
> I
> > > > > > created the following model:
> >
> > > > > > db.define_table("debug_stuff",
> > > > > > Field("name", length=100),
> > > > > > Field("textfield", "text"),
> > > > > > format="%(name)s")
> >
> > > > > > and defined the following function in the controller (default):
> >
> > > > > > @service.jsonrpc
> > > > > > def debug_umlauts(data):
> > > > > > # db["debug_stuff"].insert(**data)  #  <--- Worked, no
> > > problem
> > > > > > # db(db["debug_stuff"]["id"] == 2).update(**data)   #
> <---
> > > Didn't
> > > > > > work
> > > > > > db(db["debug_stuff"]["id"] == 2).update(name =
> data['name'],
> > > > > > textfield=data['textfield'])  # <--- Worked
> > > > > > return "OK update"
> >
> > > > > > The only line that didn't work was the second one, where I tried
> to
> > > > > > use the **data for the update method. The problem is that I want
> the
> > > > > > method to be general, and therefore cannot use the method of the
> > > third
> > > > > > line to specify for .update what fields I'm updating.
> >
> > > > > > Thanks,
> > > > > > Omri
> >
> > > > > > On Nov 8, 5:19 pm, mdipierro  wrote:
> >
> > > > > > > Can you try put a u in front of the string u"..."
> >
> > > > > > > On Nov 8, 5:30 am, Omri  wrote:
> >
> > > > > > > > Hello,
> >
> > > > > > > > I'm having a unicode problem with the DAL.
> >
> > > > > > > > I'm developing a (mainly) RPC database application with
> qooxdoo
> > > as JS
> > > > > > > > framework and web2py as the webserver.
> >
> > > > > > > > I have created a fairly generic update_record function which
> > > simply
> > > > > > > > gets two input variables - a table name and a data dictionary
> > > with
> > > > > > > > name/value pairs which correspond to the fields of the table.
> > > > > > > > My function looks like this:
> >
> > > > > > > > def update_record(table_name, data):
> > > > > > > > db(db[table_name]['id'] == data['id']).update(**data)
> > > > > > > > return db(db[table_name]['id'] ==
> data['id']).select()
> >
> > > > > > > > My application should work both in English and in German, and
> my
> > > > > > > > problem is that when I try to update a string value with an
> > > Umlaut
> > > > > > > > (example - "Überwlad") I get an error:
> > > > > > > > "UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in
> > > > > > > > position..."
> >
> > > > > > > > I am able to insert records to the database with Umlauts, but
> I
> > > use a
> > > > > > > > different method for the insert. I use the syntax of
> .insert(name
> > > =
> > > > > > > > value, name2 = value2,...).
> >
> > > > > > > > I tried to encode all the data keys which are unicode objects
> > > without
> > > > > > > > success, it keeps raising the same error.
> >
> > > > > > > > Am I missing something here, or is this a bug? And more
> > > > > interestingly,
> > > > > > > > how can it be solved?
> >
> > > > > > > > Thanks,
> > > > > > > > Omri
> >
> >
>


[web2py] Re: Plugin_JqGrid long-polling

2010-11-10 Thread AsmanCom
http://127.0.0.1:8000/core/plugin_jqgrid/data?fieldname=&tablename=device&fieldvalue=None&columns=id%2Ccolumn1%2Ccolumn2%2Ccolumn3%2Ccolumn4%2Ccolumn5%2Ccolumn6%2Ccolumn7%2Ccolumn8%2Ccolumn9%2Ccolumn10&server_timenull&_search=false&nd=1289404767209&rows=10&page=1&sidx=&sord=asc

Parameter:
_search false
columns
id,column1,column2,column3,column4,column5,column6,column7,column8,column9,column10
fieldname
fieldvalue  None
nd  1289404767209
page1
rows10
server_timenull
sidx
sordasc
tablename   device



"server_timenull" seems wrong? what to do?

THX


On 10 Nov., 16:55, mdipierro  wrote:
> You need to install firebug and check in the console log what is going
> on.
>
> On Nov 10, 9:53 am, AsmanCom  wrote:
>
> > tried it like this:
>
> > app/models/plugin_jqgrid.py:
>
> > var server_time=null;
> > jQuery(document).ready(function(server_time){jQuery("#%
> > (id)s").jqGrid({
> > url:'%(callback)s&server_time'+escape(server_time),
>
> > app/controllers/plugin_jqgrid.py:
>
> > def data():
> >     sleep(10)
> >     ...
> >     test1 = request.vars.server_time or error()
> >     tablename = request.vars.tablename or error()
> >     ...
> >     items = {}
> >     items['userdata']=request.now
> >     ...
> > __
>
> > It seems not working, data is not returned by the controller.
>
> > On 10 Nov., 16:37, mdipierro  wrote:
>
> > > replace
>
> > > 
> > > jQuery(document).ready(function(server_time){jQuery("#%
> > > (id)s").jqGrid({
> > > url:'%(callback)s',
> > > 
>
> > > with
>
> > > 
> > > jQuery(document).ready(function(server_time){jQuery("#%
> > > (id)s").jqGrid({
> > > url:'%(callback)s&server_time'+escape(server_time),
> > > 
>
> > > On Nov 10, 9:34 am, AsmanCom  wrote:
>
> > > > Hi Massimo, never mind. I do not want the variable passed with
> > > > jQuery.getJSON, but with the url: '% (callback) s', which is called
> > > > with LoadComplete: .trigger ("reload grid").
> > > > Here's the code so far..
>
> > > > _
> > > > app/models/plugin_jqgrid.py:
>
> > > > def
> > > > plugin_live_grid(table,fieldname=None,fieldvalue=None,col_widths={},
>
> > > > _id=None,columns=None,col_width=80,width=700,height=300):
> > > >     """
> > > >     just do to embed the jqGrid with ajax search capability and
> > > > pagination
> > > >     {{=plugin_jqgrid(db.tablename)}}
> > > >     - table is the db.tablename
> > > >     - fieldname, fieldvalue are an optional filter
> > > > (fieldname==fieldvalue)
> > > >     - _id is the "id" of the DIV that contains the jqGrid
> > > >     - columns is a list of columns names to be displayed
> > > >     - cold_width is the width of each column
> > > >     - height is the height of the jqGrid
> > > >     """
> > > >     from gluon.serializers import json
> > > >     _id = 'jqgrid_%s' % table
> > > >     columns = columns or [x for x in table.fields if
> > > > table[x].readable]
> > > >     colnames = [x.replace('_',' ').capitalize() for x in columns]
> > > >     colmodel = [{'name':x,'index':x,
> > > > 'width':col_widths.get(x,col_width), 'sortable':True} \
> > > >                     for x in columns if table[x].readable]
> > > >     callback = URL(r=request,c='plugin_jqgrid',f='data',
> > > >                    vars=dict(tablename=table._tablename,
> > > >                              columns=','.join(columns),
> > > >                              fieldname=fieldname or '',
> > > >                              fieldvalue=fieldvalue,
> > > >                              ))
> > > >     script="""
> > > > var server_time=null;
> > > > jQuery(document).ready(function(server_time){jQuery("#%
> > > > (id)s").jqGrid({
> > > > url:'%(callback)s',
> > > > datatype: "json",
> > > > colNames: %(colnames)s,
> > > > colModel:%(colmodel)s,
> > > > rowNum:10,
> > > > rowList:[20,50,100],
> > > > pager: '#%(id)s_pager',
> > > > onSelectRow: function(postdata) {web2py_ajax_page('get','/jqgrid2/
> > > > default/tabs2/'+(postdata),null,'panel');},
> > > > loadComplete: function () {
> > > >     var server_time=jQuery("#%(id)s").getGridParam('userData');
>
> > > >     setTimeout(function(){
> > > >      alert(server_time);
> > > >      jQuery("#%(id)s").jqGrid().setGridParam({datatype:"json"});
> > > >      jQuery("#%(id)s").jqGrid().trigger("reloadGrid",
> > > > [{current:true}]);
>
> > > > }, 1000); /* 1000..after 1 seconds */
> > > > },
>
> > > > loadError: function () {
> > > >     setTimeout(function(){
>
> > > >      jQuery("#%(id)s").jqGrid().setGridParam({datatype:"json"});
> > > >      jQuery("#%(id)s").jqGrid().trigger("reloadGrid",
> > > > [{current:true}]);
>
> > > > }, 15000); /* milliseconds (15seconds) */
> > > > },
>
> > > > caption:'%(tablename)s',
> > > > viewrecords: true,
> > > > height:%(height)s,
> > > > loadui:"disabled"});
> > > > jQuery("#%(id)s").jqGrid('navGrid','#%(id)s_pager',
> > > > {search:true,add:false,edit:false,del:false});
> > > > jQuery("#%(id)s").setGri

[web2py] Re: help us test new admin on windows....

2010-11-10 Thread mart
Is it worth a test on Mac?

On Nov 10, 10:48 am, mdipierro  wrote:
> download the windows binary (nightly built) from
>
>    http://web2py.com/examples/default/download
>
> with FF and IE, try admin, try create a new app and edit a file,
> report any problem.


[web2py] Pagination [Web2py Utils] returns None

2010-11-10 Thread Andrew Evans
Hello I am trying to create some pagination on my comments page everything
seems to be working, however when I click the next link it goes to a page
that all it says is None

Anyone know why this is happening and how to fix it

There are entries in the db.

Thanks in Advance

below is my code

*cheers


def product_wall():
this_page = request.args(0)
product=db(db.product.id == this_page).select(db.product.ALL)
for products in product:
#comments=db(db.comment.product == this_page).select(db.comment.ALL)
comments=db.comment.product == this_page
orderby = ~db.comment.id
pcache = (cache.ram, 15)
stars = StarRatingWidget(single_vote=True)
db.comment.rating.widget = stars.widget

db.comment.product.default = products.id
form = SQLFORM(db.comment)
db.comment.product.id = products.id
if form.accepts(request.vars,session):
response.flash = 'Your Comment has been submitted'
paginate =
Pagination(db,comments,orderby,display_count=2,cache=pcache,r=request,res=response)
rows=paginate.get_set(set_links=True)
return dict(comments=rows,form=form,products=products)
elif form.errors:
response.flash = 'Please correct your error'
paginate =
Pagination(db,comments,orderby,display_count=2,cache=pcache,r=request,res=response)
rows=paginate.get_set(set_links=True)
return dict(comments=rows,form=form,products=products)
else:
paginate =
Pagination(db,comments,orderby,display_count=2,cache=pcache,r=request,res=response)
rows=paginate.get_set(set_links=True)
return dict(comments=rows,form=form,products=products)


[web2py] Re: new demo appliance for gmap and fullcalendar

2010-11-10 Thread JmiXIII
Nice example...

Just a note :
Line 25 of mycal.html
stop: new Date('{{=row.f_end_time.strftime('%B %d, %Y %H:%M:%S')}}'),
should be:
end: new Date('{{=row.f_end_time.strftime('%B %d, %Y %H:%M:%S')}}'),

So events longer than a day render correctly.

On 10 nov, 16:35, mdipierro  wrote:
> http://web2py.com/appliances/default/show/71


[web2py] plugin wiki on older aps?

2010-11-10 Thread mart
Hi,

Helping my daughter with a school project and she loves the look of
web2py in the "Example minimalist wiki with versioning and
authentication". She 's making a "memory game" (not sure how, but she
is ;) ).  Since she knows how to use the widget builder in
plugin_wiki, she installed it, has the pages menu item and everything
seem to be good.

But some of the widgets like "comments" and "action_load" just stay
seem to be stuck on "loading" (doesn't resolve to a widget).

Assuming something is  missing, would anybody know what that is ? I
added everything I could think of, but no go yet.

Thanks,
Mart :)


Re: [web2py] plugin wiki on older aps?

2010-11-10 Thread Bruno Rocha
You have to replace web2py_ajax.html to a new version.

web2py_components depends on some things in web2py_ajax.html!



2010/11/10 mart 

> Hi,
>
> Helping my daughter with a school project and she loves the look of
> web2py in the "Example minimalist wiki with versioning and
> authentication". She 's making a "memory game" (not sure how, but she
> is ;) ).  Since she knows how to use the widget builder in
> plugin_wiki, she installed it, has the pages menu item and everything
> seem to be good.
>
> But some of the widgets like "comments" and "action_load" just stay
> seem to be stuck on "loading" (doesn't resolve to a widget).
>
> Assuming something is  missing, would anybody know what that is ? I
> added everything I could think of, but no go yet.
>
> Thanks,
> Mart :)
>



-- 

http://rochacbruno.com.br


Re: [web2py] plugin wiki on older aps?

2010-11-10 Thread Bruno Rocha
The newest version
http://code.google.com/p/web2py/source/browse/applications/welcome/views/web2py_ajax.html

2010/11/10 Bruno Rocha 

> You have to replace web2py_ajax.html to a new version.
>
> web2py_components depends on some things in web2py_ajax.html!
>
>
>
> 2010/11/10 mart 
>
> Hi,
>>
>> Helping my daughter with a school project and she loves the look of
>> web2py in the "Example minimalist wiki with versioning and
>> authentication". She 's making a "memory game" (not sure how, but she
>> is ;) ).  Since she knows how to use the widget builder in
>> plugin_wiki, she installed it, has the pages menu item and everything
>> seem to be good.
>>
>> But some of the widgets like "comments" and "action_load" just stay
>> seem to be stuck on "loading" (doesn't resolve to a widget).
>>
>> Assuming something is  missing, would anybody know what that is ? I
>> added everything I could think of, but no go yet.
>>
>> Thanks,
>> Mart :)
>>
>
>
>
> --
>
> http://rochacbruno.com.br
>



-- 

http://rochacbruno.com.br


[web2py] Re: IMG helper and _width

2010-11-10 Thread annet
@Bruno,

Thanks for providing me with a working solution.


@Denes,

Thanks for explaining me why I got this error.


Kind regards,

Annet.


On Nov 10, 3:20 pm, DenesL  wrote:
> Annet, allow me a little explanation on why you got SyntaxError:
> keyword can't be an expression.
> web2py does not know that you are using CSS inside HTML, the error
> happens because IMG is expecting named arguments, which are dictionary
> keys and those keys must be valid hashable ids.
>
> _src is a valid hashable id.
> _vertical-align is not, because python will try to interpret that as
> the following expression:
> _vertical (an id) minus (math operator) align (another id).
>
> Hope this helps.
>
> On Nov 10, 7:00 am, Martín Mulone  wrote:
>
> > Like bruno said, there are no attribute vertical-align in img object, this
> > is  css style thing
>
> > 2010/11/10 Bruno Rocha 
>
> > > This is working for me:
>
> > > {{=IMG(_src=URL(r=request,a='base',c='static',f='base/card/logos/%s' %
> > > logo[0].link), _style="vertical-align:'middle';")}}
>
> > > 2010/11/10 annet 
>
> > > Massimo,
>
> > >> Thanks, problem solved. However, this:
>
> > >> {{=IMG(_src=URL(r=request,a='base',c='static',f='base/card/logos/%s' %
> > >> logo[0].link), _vertical-align="middle")}}
>
> > >> .. result in a SyntaxError: keyword can't be an expression
>
> > >> According to W3C I should be able to set vertical-align on an img.
>
> > >> Kind regards,
>
> > >> Annet.
>
> > > --
>
> > >http://rochacbruno.com.br
>
> > --
> > My blog:http://martin.tecnodoc.com.ar
> > My portfolio *spanish*:http://www.tecnodoc.com.ar
> > Checkout my last proyect instant-press:http://www.instant2press.com
>
>


[web2py] Re: help us test new admin on windows....

2010-11-10 Thread Anthony
Creating a new app and editing files seems to work fine in IE and FF
on Windows.

One question: For files in subfolders, there is no slash in between
the folder and file name (e.g., under static/css/ it says "css
base.css" instead of "css/base.css") -- is that intentional? Actually,
now that we're indenting the file names within subfolders, maybe we
can simply get rid of the path altogether (this will especially help
when there are several nested subfolders).

A couple additional issues (these aren't new):
- In IE, when you position the cursor within EditArea, about 10-20
characters to the right of the cursor are automatically highlighted in
blue. This doesn't seem to hinder the functionality, but it's annoying
and confusing.
- I'm just noticing some problems with very long load times (e.g. a
couple minutes or more) for some applications on occasion (e.g., the
welcome app or the examples app). It seems to be a problem when I open
multiple apps in separate tabs, particularly if one of the tabs is
admin (e.g., admin is open in one tab, then open a test app, then open
welcome, then open examples -- in that case, examples will hang for
several minutes, even though the other apps are all finished loading
-- if I close the other apps, I can open examples instantly). I assume
this has something to do with Rocket.

Anthony

On Nov 10, 10:48 am, mdipierro  wrote:
> download the windows binary (nightly built) from
>
>    http://web2py.com/examples/default/download
>
> with FF and IE, try admin, try create a new app and edit a file,
> report any problem.


[web2py] Re: plugin wiki on older aps?

2010-11-10 Thread mart
ah, i see it! :) Great! I must have declined the "replace file?" while
dropping an updated filesset.

thank you very much for that! :)

On Nov 10, 12:35 pm, Bruno Rocha  wrote:
> The newest 
> versionhttp://code.google.com/p/web2py/source/browse/applications/welcome/vi...
>
> 2010/11/10 Bruno Rocha 
>
>
>
> > You have to replace web2py_ajax.html to a new version.
>
> > web2py_components depends on some things in web2py_ajax.html!
>
> > 2010/11/10 mart 
>
> > Hi,
>
> >> Helping my daughter with a school project and she loves the look of
> >> web2py in the "Example minimalist wiki with versioning and
> >> authentication". She 's making a "memory game" (not sure how, but she
> >> is ;) ).  Since she knows how to use the widget builder in
> >> plugin_wiki, she installed it, has the pages menu item and everything
> >> seem to be good.
>
> >> But some of the widgets like "comments" and "action_load" just stay
> >> seem to be stuck on "loading" (doesn't resolve to a widget).
>
> >> Assuming something is  missing, would anybody know what that is ? I
> >> added everything I could think of, but no go yet.
>
> >> Thanks,
> >> Mart :)
>
> > --
>
> >http://rochacbruno.com.br
>
> --
>
> http://rochacbruno.com.br


Re: [web2py] Re: help us test new admin on windows....

2010-11-10 Thread Branko Vukelic
On Wed, Nov 10, 2010 at 6:51 PM, Anthony  wrote:
> now that we're indenting the file names within subfolders, maybe we
> can simply get rid of the path altogether (this will especially help
> when there are several nested subfolders).

I absolutely agree. In fact, I would have done it myself, but that
part of the code was a bit fiddly, so I mostly left it alone. I keep
forgetting to ask Massimo about this.


-- 
Branko Vukelić

bg.bra...@gmail.com
stu...@brankovukelic.com

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group


[web2py] flow charts

2010-11-10 Thread mart
Hey,

Anybody know of any relatively decent flow chart app out there that
would be compatible with web2py?

Thanks,
Mart :)


[web2py] Re: Book Update - Chapter 9 - Pyjamas and jsonrpc

2010-11-10 Thread João Ventura
Hi again,

I can login in the book application, using my google credentials, but
I don't know how to edit the page, can't seem to find any edit button.
Googled for how to do it, but can't seem to find how.
I think I'm not editor already, but if you want, you can make me
editor, and I shall gladly edit that info myself.

Best whishes,
João Ventura

On 10 Nov, 14:28, mdipierro  wrote:
> where you able to fix it in the book online? I can make you editor if
> you are not already.


[web2py] Re: plugin wiki on older aps?

2010-11-10 Thread mart
Works great! double thanks! she'll be thrilled, now I just need to
change the blueish-green header/footer to purple, then I can walk
away :)

On Nov 10, 12:51 pm, mart  wrote:
> ah, i see it! :) Great! I must have declined the "replace file?" while
> dropping an updated filesset.
>
> thank you very much for that! :)
>
> On Nov 10, 12:35 pm, Bruno Rocha  wrote:
>
> > The newest 
> > versionhttp://code.google.com/p/web2py/source/browse/applications/welcome/vi...
>
> > 2010/11/10 Bruno Rocha 
>
> > > You have to replace web2py_ajax.html to a new version.
>
> > > web2py_components depends on some things in web2py_ajax.html!
>
> > > 2010/11/10 mart 
>
> > > Hi,
>
> > >> Helping my daughter with a school project and she loves the look of
> > >> web2py in the "Example minimalist wiki with versioning and
> > >> authentication". She 's making a "memory game" (not sure how, but she
> > >> is ;) ).  Since she knows how to use the widget builder in
> > >> plugin_wiki, she installed it, has the pages menu item and everything
> > >> seem to be good.
>
> > >> But some of the widgets like "comments" and "action_load" just stay
> > >> seem to be stuck on "loading" (doesn't resolve to a widget).
>
> > >> Assuming something is  missing, would anybody know what that is ? I
> > >> added everything I could think of, but no go yet.
>
> > >> Thanks,
> > >> Mart :)
>
> > > --
>
> > >http://rochacbruno.com.br
>
> > --
>
> >http://rochacbruno.com.br
>
>


[web2py] problem whith admin

2010-11-10 Thread Jose

I have to edit some applications problems with the new admin. With
some works without problems. In other gives the following error:

Traceback (most recent call last):
  File "/usr/home/jose/web2py/gluon/restricted.py", line 188, in
restricted
exec ccode in environment
  File "/usr/home/jose/web2py/applications/admin/views/default/
design.html", line 290, in 

IndexError: list index out of range

Jose


[web2py] Re: cas incorrect address in email

2010-11-10 Thread mdipierro
fixed everywhere I think

On Nov 10, 9:58 am, leone  wrote:
> Hi,
> CAS return this incorrect address in 
> emailhttps://mdp.cti.depaul.edu/cas/cas/verify?id=191&key=d1c373ab1570cfb9...
> It must 
> behttps://www.web2py.com/cas/cas/verify?id=191&key=d1c373ab1570cfb9a7db...
> What can I do to correct it.
> There is a CAS application downloadable?
> Thanks
> leone


[web2py] Re: Pyodbc error with web2py under Apache and mod_wsgi

2010-11-10 Thread azarkowsky
Hi Massimo,

Thanks for your prompt response.  That was my first thought as well.
The system I'm working on though is a pretty fresh build and searching
the file system for 'site-packages' I only find results (as expected)
within web2py and in my python installation folder, 'C:\python'.  So
unless modwsgi (or some other installed software) ships with a copy of
python I think it's using the correct version.

I see in the Apache error.log file when starting Apache the following
message:
[Tue Nov 09 18:25:58 2010] [notice] Apache/2.2.17 (Win32) mod_ssl/
2.2.17 OpenSSL/0.9.8o mod_wsgi/3.3 Python/2.7 configured -- resuming
normal operations

Python 2.7 is what I installed, but I'm not sure how to have modwsgi
verify the path to the specific python interpreter that it's using.  I
added a few lines of debug in gluon.sql.py:
sys.path returns:
[Tue Nov 09 18:26:01 2010] [error] ['', 'C:web2pysite-
packages', 'C:web2py', 'C:Windowssystem32\\\
\python27.zip', 'C:PythonLib', 'C:PythonDLLs', 'C:\\\
\PythonLiblib-tk', 'C:Program Files (x86)Apache
Software FoundationApache2.2', 'C:Program Files (x86)\\\
\Apache Software FoundationApache2.2bin', 'C:Python', 'C:\\
\\Pythonlibsite-packages', '../gluon']

Also, I printed the stack trace after it throws the exception trying
to load pyodbc:
[Tue Nov 09 18:26:01 2010] [error] Traceback (most recent call last):
[Tue Nov 09 18:26:01 2010] [error]   File "C:\\web2py\\gluon\\sql.py",
line 95, in 
[Tue Nov 09 18:26:01 2010] [error] import pyodbc
[Tue Nov 09 18:26:01 2010] [error] ImportError: DLL load failed: The
specified module could not be found.

I did find a post regarding DLLs failing to load under mod_wsgi
(http://groups.google.com/group/modwsgi/browse_thread/thread/
013b4a5faa962d77/107d04edc473d732?#107d04edc473d732) where the
solution seemed to be using MinGWto compile psycopg2.  Since I used
the "Windows Installer" version of pyodbc, I may go back and try to
build pyodbc following these steps as well.

I'm also wondering if this could be related to either a windows or
Apache security issue since pyodbc works with web2py directly
(bypassing Apache/mod_wsgi).  I'll work on building a fresh pyodbc on
my system with MinGW, but if any of this additional info leads to any
other suggestions I'm all ears, since I'm largely guessing at this
point!  :)

Thanks,
Adam

On Nov 9, 10:35 pm, mdipierro  wrote:
> you may have different python versions installed. Check the one used
> by modwsgi
>
> On Nov 9, 3:02 pm, azarkowsky  wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I'm relatively new to web2py and am attempting to set up my production
> > environment for the first time.  I'm running Apache2.2 with mod_wsgi,
> > python 2.7, & web2py 1.88.2 on Win XP SP3.  If I run web2py without
> > Apache by running:  'python web2py.py -a "" -i 127.0.0.1 -p
> > 8000' I can access both my application and the admin interface without
> > any problems.  Once I try to access my site running behind Apache
> > though, I receive a ticket containing the following trackback:
>
> > Traceback (most recent call last):
> >   File "C:\web2py\gluon\restricted.py", line 188, in restricted
> >     exec ccode in environment
> >   File "C:/web2py/applications/lunch/models/db.py", line 11, in
> > 
> >     db = DAL('mssql://lunch:lu...@b1ts003/lunch1')
> >   File "C:\web2py\gluon\sql.py", line 4048, in DAL
> >     raise RuntimeError, "%s (tried 5 times)" % exception
> > RuntimeError: global name 'pyodbc' is not defined (tried 5 times)
>
> > If I run web2py in terminal mode and import pyodbc I don't receive any
> > errors:
>
> > C:\web2py>python web2py.py -S welcome -P
> > No handlers could be found for logger "web2py"
> > web2py Enterprise Web Framework
> > Created by Massimo Di Pierro, Copyright 2007-2010
> > Version 1.88.2 (2010-10-29 23:04:43)
> > Database drivers available: SQLite3, MSSQL/DB2
> > Python 2.7 (r27:82525, Jul  4 2010, 09:01:59) [MSC v.1500 32 bit
> > (Intel)] on win
> > 32
> > Type "help", "copyright", "credits" or "license" for more information.
> > (InteractiveConsole)
>
> > >>> import pyodbc
>
> > I'm sure I'm probably just missing something in my confiration, but
> > after scouring the web2py book and searching Google I haven't been
> > able to find a solution.  I'd greatly appreciate any suggestions, or
> > if you need additional info, please let me know!
>
> > Thanks,
> > Adam


[web2py] another component question

2010-11-10 Thread Chris Baron
Hello web2py users,

I've been playing around with components recently and they are helping
me modularize my application.  I was hoping someone could explain to
me why they do what they do.


I've noticed that when a controller function that is referenced by a
component returns a dict(), it requires a view, but when the function
returns a string, it doesn't.

Also, when I return a very long string, there is an error with the
request, but this does not happen with a dict attribute containing
that same string - why is this ?


One more thing - is there a way to dynamically create components via
javascript?  Is it simply just calling a function in the views/
web2py_ajax.html view ?


Thanks in advance,

Chris


Re: [web2py] Re: plugin wiki on older aps?

2010-11-10 Thread rochacbruno
You can try web2py.com/layouts


Enviado via iPhone

Em 10/11/2010, às 16:04, mart  escreveu:

> Works great! double thanks! she'll be thrilled, now I just need to
> change the blueish-green header/footer to purple, then I can walk
> away :)
> 
> On Nov 10, 12:51 pm, mart  wrote:
>> ah, i see it! :) Great! I must have declined the "replace file?" while
>> dropping an updated filesset.
>> 
>> thank you very much for that! :)
>> 
>> On Nov 10, 12:35 pm, Bruno Rocha  wrote:
>> 
>>> The newest 
>>> versionhttp://code.google.com/p/web2py/source/browse/applications/welcome/vi...
>> 
>>> 2010/11/10 Bruno Rocha 
>> 
 You have to replace web2py_ajax.html to a new version.
>> 
 web2py_components depends on some things in web2py_ajax.html!
>> 
 2010/11/10 mart 
>> 
 Hi,
>> 
> Helping my daughter with a school project and she loves the look of
> web2py in the "Example minimalist wiki with versioning and
> authentication". She 's making a "memory game" (not sure how, but she
> is ;) ).  Since she knows how to use the widget builder in
> plugin_wiki, she installed it, has the pages menu item and everything
> seem to be good.
>> 
> But some of the widgets like "comments" and "action_load" just stay
> seem to be stuck on "loading" (doesn't resolve to a widget).
>> 
> Assuming something is  missing, would anybody know what that is ? I
> added everything I could think of, but no go yet.
>> 
> Thanks,
> Mart :)
>> 
 --
>> 
 http://rochacbruno.com.br
>> 
>>> --
>> 
>>> http://rochacbruno.com.br
>> 
>> 


[web2py] Re: making layout plugin

2010-11-10 Thread Carlos
Hi John,

I'm interested on the theme you are working on for web2py, in case you
want to share.

Thanks!,

   Carlos


On Nov 9, 4:25 am, John Murphy  wrote:
> There are numerous web2py themes, but none of them are very good. So I
> decided to make a nice one based 
> on:http://demo.woothemes.com/?name=meta-morphosis.
>
> I'm creating a layout plugin according to these instructions:
> -http://web2py.com/book/default/chapter/13#Layout-plugins
> -http://www.web2py.com/AlterEgo/default/show/92
>
> I tried the following from the official book:
>
> > Third, modify the "views/layout.html" so that it simply reads:
>
> 1. {{include 'plugin_layout_name/layout.html'}}
>
> It almost works, however the {{include}} in my layout.html is not expanded.
> Earlier in the same file, "{{include 'web2py_ajax.html'}}" expands as
> expected.
> If I over-write the "views/layout.html" file instead of {{including}} it as
> recommended, it works. Any ideas as to why?
>
> Also, what's the easiest way to package this as a web2py plugin? 
> (Like:http://www.web2py.com/layouts/static/plugin_layouts/plugins/web2py.pl...
> )
> I'd be happy to share my work if anyone is interested. I intentionally
> picked a free, GPL'ed theme.
>
> Thanks,
> John
> --www.leftium.com


[web2py] Web2py Application Exhibition ( Version 2.0 ) 5 weeks to go!

2010-11-10 Thread NetAdmin

Just in case you didn't see the "pinned" message at the top of the
group messages, there are 5 weeks to get your apps ready for the
Web2py Application Exhibition ( Version 2.0 )

For more details, see the "pinned" message.

Good Luck!

Mr.NetAdmin



[web2py] Re: linked tables and dropdown display

2010-11-10 Thread andrej burja
hi

is it possible to create a text field in table 'advandced' containing
'name1' (no reference, just characters)

andrej


On 10 nov., 15:22, mdipierro  wrote:
> ERRATA:
>
> do this:
>
> db.define.table('basic'
>                 Field('name1')
>                 ...,format='%(name1)s')
>
> db.define.table('advanced'
>                 Field('name2',db.basic)
>                 ...,format=lambda row: db.basic(row.name2).name1)
>
> # db.advanced.name.requires=IS_IN_DB(db,'basic.id','%(name1)s')
>
> db.define.table('data'
>                 Field('something',db.advanced)
>                 ...)
>
> but this is going to be SOOO slow. You are making two select per each
> row in the dropdown.
>
> On Nov 4, 8:59 am, mdipierro  wrote:
>
> > do this:
>
> > db.define.table('basic'
> >                 Field('name1')
> >                 ...,format='%(name1)s')
>
> > db.define.table('advanced'
> >                 Field('name2',db.basic)
> >                 ...,format='%(name2)s')
>
> > # db.advanced.name.requires=IS_IN_DB(db,'basic.id','%(name1)s')
>
> > db.define.table('data'
> >                 Field('something',db.advanced)
> >                 ...)
>
>


[web2py] Can I use redirect to pass hash variable?

2010-11-10 Thread Tom Chang
All,

I just realized that when I pass a hash variable to redirect, it will
get converted into a string? Is there a way I can pass a hash variable
via redirect?

for example,
redirect(URL(r=request,
f='scmView.html',vars=dict(scmResult=scmResult, a= a,
totalCm=totalCm,osPath=osPath,scmOUI=scmOUI,scmOUIName=scmOUIName)))

scmOUI and scmOUIName are string after the redirect and I verify that
by using type operation.

cheers,
tom


Re: [web2py] Re: making layout plugin

2010-11-10 Thread John Kim Murphy
I kind of stopped working on it after I learned that the Web2Py nightly has
a default layout that is much more pleasing to the eye.
I just wanted to demo my Web2Py appliances with a better looking theme.

You can grab what I have, though:
http://dl.dropbox.com/u/508947/plugin_layout_metamorphosis.zip It is in a
working, usable state.
(Suggestions for better ways to package and distribute this plugin
appreciated.)

TODO:
- remove extraneous files (including the default Web2Py files except
layout.html)
- adjust colors in #top section
- cleanup/tweak CSS
- include GPL license

If I were to do this again, I would start from the new Web2Py default
layout.

John

On Thu, Nov 11, 2010 at 4:13 AM, Carlos  wrote:

> Hi John,
>
> I'm interested on the theme you are working on for web2py, in case you
> want to share.
>
> Thanks!,
>
>   Carlos
>


[web2py] Re: help us test new admin on windows....

2010-11-10 Thread mdipierro
fixed in trunk

On Nov 10, 11:55 am, Branko Vukelic  wrote:
> On Wed, Nov 10, 2010 at 6:51 PM, Anthony  wrote:
> > now that we're indenting the file names within subfolders, maybe we
> > can simply get rid of the path altogether (this will especially help
> > when there are several nested subfolders).
>
> I absolutely agree. In fact, I would have done it myself, but that
> part of the code was a bit fiddly, so I mostly left it alone. I keep
> forgetting to ask Massimo about this.
>
> --
> Branko Vukelić
>
> bg.bra...@gmail.com
> stu...@brankovukelic.com
>
> Check out my blog:http://www.brankovukelic.com/
> Check out my portfolio:http://www.flickr.com/photos/foxbunny/
> Registered Linux user #438078 (http://counter.li.org/)
> I hang out on identi.ca:http://identi.ca/foxbunny
>
> Gimp Brushmakers Guildhttp://bit.ly/gbg-group


[web2py] Re: another component question

2010-11-10 Thread mdipierro


On Nov 10, 12:50 pm, Chris Baron  wrote:
> Hello web2py users,
>
> I've been playing around with components recently and they are helping
> me modularize my application.  I was hoping someone could explain to
> me why they do what they do.
>
> I've noticed that when a controller function that is referenced by a
> component returns a dict(), it requires a view, but when the function
> returns a string, it doesn't.

Can you provide an example. I never noticed this.

>
> Also, when I return a very long string, there is an error with the
> request, but this does not happen with a dict attribute containing
> that same string - why is this ?
>
> One more thing - is there a way to dynamically create components via
> javascript?  Is it simply just calling a function in the views/
> web2py_ajax.html view ?
>
> Thanks in advance,
>
> Chris


[web2py] Re: linked tables and dropdown display

2010-11-10 Thread mdipierro
db.define.table('advanced'
Field('name1',requires=IS_IN_DB(db,'basic.name1')),

On Nov 10, 1:49 pm, andrej burja  wrote:
> hi
>
> is it possible to create a text field in table 'advandced' containing
> 'name1' (no reference, just characters)
>
> andrej
>
> On 10 nov., 15:22, mdipierro  wrote:
>
> > ERRATA:
>
> > do this:
>
> > db.define.table('basic'
> >                 Field('name1')
> >                 ...,format='%(name1)s')
>
> > db.define.table('advanced'
> >                 Field('name2',db.basic)
> >                 ...,format=lambda row: db.basic(row.name2).name1)
>
> > # db.advanced.name.requires=IS_IN_DB(db,'basic.id','%(name1)s')
>
> > db.define.table('data'
> >                 Field('something',db.advanced)
> >                 ...)
>
> > but this is going to be SOOO slow. You are making two select per each
> > row in the dropdown.
>
> > On Nov 4, 8:59 am, mdipierro  wrote:
>
> > > do this:
>
> > > db.define.table('basic'
> > >                 Field('name1')
> > >                 ...,format='%(name1)s')
>
> > > db.define.table('advanced'
> > >                 Field('name2',db.basic)
> > >                 ...,format='%(name2)s')
>
> > > # db.advanced.name.requires=IS_IN_DB(db,'basic.id','%(name1)s')
>
> > > db.define.table('data'
> > >                 Field('something',db.advanced)
> > >                 ...)
>
>


[web2py] Re: help us test new admin on windows....

2010-11-10 Thread qqsaqq
I tried the nightly on Win7 with FF 3.6 and IE.

I couldn't break anything significant. Creating an app and fiddling
around with it worked just fine.

One thing that's a bit odd is the in file search, which doesn't seem
to have any effect on FF (I entered "index" and pressed enter). On IE
it's a bit different: "index" and [enter] collapsed all sections
(Models, Controllers, Views,...) and they couldn't be expanded again
after this. Only F5 solved this.

Thank You all for the new design(s). I like them a lot!

regards

Stephan

On 10 Nov., 16:48, mdipierro  wrote:
> download the windows binary (nightly built) from
>
>    http://web2py.com/examples/default/download
>
> with FF and IE, try admin, try create a new app and edit a file,
> report any problem.


[web2py] Re: Can I use redirect to pass hash variable?

2010-11-10 Thread mdipierro
URL generates a URL, it can only contains strings.

On Nov 10, 1:50 pm, Tom Chang  wrote:
> All,
>
> I just realized that when I pass a hash variable to redirect, it will
> get converted into a string? Is there a way I can pass a hash variable
> via redirect?
>
> for example,
> redirect(URL(r=request,
> f='scmView.html',vars=dict(scmResult=scmResult, a= a,
> totalCm=totalCm,osPath=osPath,scmOUI=scmOUI,scmOUIName=scmOUIName)))
>
> scmOUI and scmOUIName are string after the redirect and I verify that
> by using type operation.
>
> cheers,
> tom


[web2py] Re: help us test new admin on windows....

2010-11-10 Thread qqsaqq
IE8 to be precise

On 10 Nov., 21:00, qqsaqq  wrote:
> I tried the nightly on Win7 with FF 3.6 and IE.
>
> I couldn't break anything significant. Creating an app and fiddling
> around with it worked just fine.
>
> One thing that's a bit odd is the in file search, which doesn't seem
> to have any effect on FF (I entered "index" and pressed enter). On IE
> it's a bit different: "index" and [enter] collapsed all sections
> (Models, Controllers, Views,...) and they couldn't be expanded again
> after this. Only F5 solved this.
>
> Thank You all for the new design(s). I like them a lot!
>
> regards
>
> Stephan
>
> On 10 Nov., 16:48, mdipierro  wrote:
>
> > download the windows binary (nightly built) from
>
> >    http://web2py.com/examples/default/download
>
> > with FF and IE, try admin, try create a new app and edit a file,
> > report any problem.
>
>


Re: [web2py] Re: ProgrammingError: (2014, "Commands out of sync; you can't run this command now")

2010-11-10 Thread David Zejda
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

This one is also quite common:

Traceback (most recent call last):
  File "/opt/web2py/gluon/main.py", line 475, in wsgibase
BaseAdapter.close_all_instances(BaseAdapter.rollback)
  File "/opt/web2py/gluon/sql.py", line 810, in close_all_instances
action(instance)
  File "/opt/web2py/gluon/sql.py", line 1393, in rollback
self._connection.rollback()
ProgrammingError: (2014, "Commands out of sync; you can't run this
command now")

Yes, I have many queries also in try..except blocks. But it is really
hard to find what exactly is the root of problem because I did not
reveal any meaningful shape in the error occurencies. At least not yet. :(

D.

mdipierro wrote:
> Has anybody else here had a similar problem?
> 
> massimo
> 
> On Nov 9, 11:29 am, David Zejda  wrote:
> Hi :)
> 
> E.g. now the exception was raised by the web2py internal db
> initialization routine:
> 
> 28: db = SQLDB('mysql://myus:myp...@localhost:330h6/mydb', pool_size=10)
> 
> Traceback (most recent call last):
>   File "/opt/web2py/gluon/restricted.py", line 188, in restricted
> exec ccode in environment
>   File "/opt/web2py/applications/myapp/compiled/models_db.py", line 28,
> in 
>   File "/opt/web2py/gluon/sql.py", line 978, in __init__
> self._execute('SET FOREIGN_KEY_CHECKS=1;')
>   File "/opt/web2py/gluon/sql.py", line 977, in 
> self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
>   File "/var/lib/python-support/python2.5/MySQLdb/cursors.py", line 166,
> in execute
> self.errorhandler(self, exc, value)
>   File "/var/lib/python-support/python2.5/MySQLdb/connections.py", line
> 35, in defaulterrorhandler
> raise errorclass, errorvalue
> ProgrammingError: (2014, "Commands out of sync; you can't run this
> command now")
> 
> I'm thinking about possibility to raise the size of my poll. But in the
> past with higher poll I think I was receiving more OperationalError:
> (2006, 'MySQL server has gone away'). Because I am referring to a live
> server, I would prefer to avoid experiments which could make frequency
> of db errors even worse :)
> 
> thanks & wishing you a nice day..
> David
> 
> 
> 
> mdipierro wrote:
 I cannot say without looking at the code. MySQL has lots of
 undocumented quirks about what you can do and what you cannot do
 within one transaction.
 Try add a db.commit() after each insert/unpdate/form.accepts/
 crud.update/crud.select IF you do a select after that.
 Do you have any try:...except in your controllers and db queries
 inside?
 On Nov 8, 2:57 am, David Zejda  wrote:
 The MySQL error occurs quite often, several times every day. The app has
 about 2 page views daily and heavily communicates with db (tens of
 queries per request, in db I have about 100 tables). Currently I have
 pool with size for 10 connections.
 Meaning of the error message is described here:
 http://dev.mysql.com/doc/refman/4.1/en/commands-out-of-sync.html
 It seems that with MySQL statements on the same db connection have to be
 exhausted one-by-one, never in parallel. Two statements returning data
 to the process must be using separate DBConnections (possibly to the
 same host/db). Multiple statements on the same connection are supported,
 but only 1 may be in a state to 'fetch' data.
 Traces for the errors look like this:
   File "/opt/web2py/gluon/sql.py", line 3378, in count
 return self.select('count(*)')[0]._extra['count(*)']
   File "/opt/web2py/gluon/sql.py", line 3237, in select
 rows = response(query)
   File "/opt/web2py/gluon/sql.py", line 3232, in response
 db._execute(query)
   File "/opt/web2py/gluon/sql.py", line 977, in 
 self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
   File "/var/lib/python-support/python2.5/MySQLdb/cursors.py", line 166,
 in execute
 self.errorhandler(self, exc, value)
   File "/var/lib/python-support/python2.5/MySQLdb/connections.py", line
 35, in defaulterrorhandler
 raise errorclass, errorvalue
 ProgrammingError: (2014, "Commands out of sync; you can't run this
 command now")
 Or e.g.:
 Traceback (most recent call last):
   File "/opt/web2py/gluon/main.py", line 475, in wsgibase
 BaseAdapter.close_all_instances(BaseAdapter.rollback)
   File "/opt/web2py/gluon/sql.py", line 810, in close_all_instances
 action(instance)
   File "/opt/web2py/gluon/sql.py", line 1393, in rollback
 self._connection.rollback()
 ProgrammingError: (2014, "Commands out of sync; you can't run this
 command now")
 Do you have any tips how to aviod these errors?
 Thanks!

- --
David Zejda, Open-IT cz
web development & services
http://www.o-it.info
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkza+54ACgkQ3oCkkciamV

[web2py] Re: Error Installing Appliance

2010-11-10 Thread Syed
Complete user-error. Although I did reinstall with python 2.5.4 from
python.org, and then the binary distribution of web2py, the probably
was a result of me trying to install instantpress_beta5.zip.

I found the proper file: web2py.app.instantpress_beta5.w2p

Installation was without issue. Sorry about that.

@Anthony: The reason that I am using python 2.5 is because I want
web2py to play nicely with App Engine. If I am limiting myself to
learning web2py first and foremost, does it matter that I am using
python 2.5?


[web2py] Re: error with uploadfield and blob

2010-11-10 Thread richard.ree
Not long at all.  Many thanks!

On Nov 10, 8:51 am, mdipierro  wrote:
> bug. Fixed in trunk. Sorry it took so long.
>
> On Nov 8, 10:38 pm, "richard.ree"  wrote:
>
> > I want to upload a file and store it in a blob field:
>
> > db.define_table(
> >     "data",
> >     Field("citation", "string", required=True, notnull=True),
> >     Field("datafile", "upload", uploadfield="data"),
> >     Field("data", "blob"),
> >     )
>
> > But if I insert a record (through SQLFORM or admin) but leave the
> > datafile field empty, i.e., I input a citation but not a file, I get
> > this error:
>
> > web2py Version 1.88.2 (2010-10-29 23:04:43)
>
> > Traceback (most recent call last):
> >   File "/home/rree/web2py/gluon/restricted.py", line 188, in
> > restricted
> >     exec ccode in environment
> >   File "/home/rree/web2py/applications/mytest/controllers/
> > appadmin.py", line 410, in 
> >   File "/home/rree/web2py/gluon/globals.py", line 96, in 
> >     self._caller = lambda f: f()
> >   File "/home/rree/web2py/applications/mytest/controllers/
> > appadmin.py", line 125, in insert
> >     if form.accepts(request.vars, session):
> >   File "/home/rree/web2py/gluon/sqlhtml.py", line 1105, in accepts
> >     value = fields[fieldname]
> > KeyError: 'data'
>
> > How to make the upload field optional?
>
> > Thanks
> > -Rick
>
>


[web2py] Re: CRUD select with autosort headers

2010-11-10 Thread yamandu
But this fails when you to show the result of a query.
You can only filter by one field from the serverside. It´s good, but
not enough.
A lot of potential of this jquery plugin is being lost.
The editable jqgrid plugin is good, but is not documented and does not
work fully.
Would be nice to have its funcionalities fully integrated but I don´t
have to do such
complex job now.

On Nov 5, 1:52 am, mdipierro  wrote:
> Good work. You also have the option to do
>
> {{=plugin_wiki.widget('jqgrid',table)}}
>
> which is sortable, searchable, resizable, can reorder columns, 
> ajaxpagination, etc.
>
> On Nov 4, 4:38 pm, baloan  wrote:
>
> > Final attempt. Much better now. web2py is cool!
>
> > def history():
> >     headers, key = auto_orderby(db.email_archive,
> > default_order=('desc', 'id'))
> >     emails =crud.select(db.email_archive, headers=headers,
> > orderby=key, limitby=(0, 50))
> >     return dict(emails=emails)
>
> > def auto_orderby(dal_table, default_order=None):
> >     '''
> >     Creates headers and key forcrud.select() tables.
>
> >     @param tablename:      dal table
> >     @param default_order:  ('asc'|'desc', column_name)
> >     '''
> >     tablename = dal_table._tablename
> >     orderby_key = tablename + '_orderby'
> >     if default_order is None:
> >         default_order = ('asc', 'id')
> >     # create header column links
> >     headers = dict()
> >     for col in dal_table.fields:
> >         headers[tablename + '.' + col] = A(col,
> > _href=URL(vars=dict(orderby=col)))
> >     # manage sort order
> >     if orderby_key not in session:
> >         session[orderby_key] = list(default_order)
> >     if 'orderby' in request.vars:
> >         if session[orderby_key][1] == request.vars.orderby:
> >             if session[orderby_key][0] == 'asc':
> >                 session[orderby_key][0] = 'desc'
> >             else:
> >                 session[orderby_key][0] = 'asc'
> >         else:
> >             session[orderby_key] = ['asc', request.vars.orderby]
> >     # convert to DAL orderby
> >     key = db.email_archive[session[orderby_key][1]]
> >     if session[orderby_key][0] == 'desc':
> >         key = ~key
> >     return (headers, key)
>
> > Any suggestions for improvement?
>
> > Regards, Andreas
>
> > On Nov 4, 10:19 pm, baloan  wrote:
>
> > > An updated attempt:
>
> > > def index():
> > >     # create header column links
> > >     headers = dict()
> > >     for col in db.email_archive.fields:
> > >         headers['email_archive.' + col] = A(col,
> > > _href=URL(vars=dict(orderby=col)))
> > >     # manage sort order
> > >     if 'email_archive_orderby' not in session:
> > >         session.email_archive_orderby = ['desc', 'id']
> > >     if 'orderby' in request.vars:
> > >         if session.email_archive_orderby[1] == request.vars.orderby:
> > >             if session.email_archive_orderby[0] == 'asc':
> > >                 session.email_archive_orderby[0] = 'desc'
> > >             else:
> > >                 session.email_archive_orderby[0] = 'asc'
> > >         else:
> > >             session.email_archive_orderby = ['asc',
> > > request.vars.orderby]
> > >     # convert to DAL orderby
> > >     key = db.email_archive[session.email_archive_orderby[1]]
> > >     if session.email_archive_orderby[0] == 'desc':
> > >         key = ~key
> > >     emails =crud.select(db.email_archive, headers=headers,
> > > orderby=key)
> > >     return dict(emails=emails)
>
> > > On Nov 4, 10:06 pm, baloan  wrote:
>
> > > > When I say ugly I mean:
> > > > 1. too much duplication,
> > > > 2. too much boilerplate code.
>
> > > > Just imagine what happens if I apply my solution to more than a few
> > > > tables.
>
> > > > Regards, Andreas
>
> > > > On Nov 4, 10:00 pm, baloan  wrote:
>
> > > > > This is my feeble attempt at the problem - but it does the job:
>
> > > > > def index():
> > > > >     add_submenu()
> > > > >     headers = {'email.id': A('Id',
> > > > > _href=URL(vars=dict(orderby='id'))),
> > > > >                'email.email': A('Email address',
> > > > > _href=URL(vars=dict(orderby='email'))),
> > > > >                'email.active':A('Active',
> > > > > _href=URL(vars=dict(orderby='active'))),
> > > > >                'email.expires':A('Expires',
> > > > > _href=URL(vars=dict(orderby='expires'))),
> > > > >                'email.change_user':A('Changed by',
> > > > > _href=URL(vars=dict(orderby='change_user'))),
> > > > >                'email.change_date':A('Changed on',
> > > > > _href=URL(vars=dict(orderby='change_date'))),
> > > > >     }
> > > > >     if 'email_orderby' not in session:
> > > > >         session.email_orderby = ['asc', 'email']
> > > > >     if 'orderby' in request.vars:
> > > > >         if session.email_orderby[1] == request.vars.orderby:
> > > > >             if session.email_orderby[0] == 'asc':
> > > > >                 session.email_orderby[0] = 'desc'
> > > > >             else:
> > > > >                 session.email_orderby[0] = 'asc'
> > > > >         else:

[web2py] Re: help us test new admin on windows....

2010-11-10 Thread Anthony
> One thing that's a bit odd is the in file search, which doesn't seem
> to have any effect on FF (I entered "index" and pressed enter). On IE
> it's a bit different: "index" and [enter] collapsed all sections
> (Models, Controllers, Views,...) and they couldn't be expanded again
> after this. Only F5 solved this.

Actually, I don't think running the search collapses the sections.
Instead, I think it is supposed to hide everything except the files
that match the search. The problem is, it appears to simply hide
everything, including the files that match the search (so the files
are hidden, not collapsed). F5 (or clicking the Edit button at the
top) gets you back to the original page, without the search.

Obviously we should fix the search. But once it's fixed, we should
also make sure there's some UI indicator when there are no search
results -- otherwise, the user is likely to be confused by what
appears to be all of the sections collapsing.

Anthony


[web2py] Re: Error Installing Appliance

2010-11-10 Thread Anthony
> @Anthony: The reason that I am using python 2.5 is because I want
> web2py to play nicely with App Engine. If I am limiting myself to
> learning web2py first and foremost, does it matter that I am using
> python 2.5?

If you're creating an app for App Engine, then I suppose sticking with
2.5 makes sense. And 2.5 will certainly be fine if your main focus is
learning web2py.


[web2py] Re: ProgrammingError: (2014, "Commands out of sync; you can't run this command now")

2010-11-10 Thread mdipierro
Here is a the problem. If you put queries in try... except you must
follow this pattern:

try:
... any db io ...
except:
db.rollback()

If you do not rollback any subsequent attempt to commit or access the
db again results in an error.

On Nov 10, 2:07 pm, David Zejda  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> This one is also quite common:
>
> Traceback (most recent call last):
>   File "/opt/web2py/gluon/main.py", line 475, in wsgibase
>     BaseAdapter.close_all_instances(BaseAdapter.rollback)
>   File "/opt/web2py/gluon/sql.py", line 810, in close_all_instances
>     action(instance)
>   File "/opt/web2py/gluon/sql.py", line 1393, in rollback
>     self._connection.rollback()
> ProgrammingError: (2014, "Commands out of sync; you can't run this
> command now")
>
> Yes, I have many queries also in try..except blocks. But it is really
> hard to find what exactly is the root of problem because I did not
> reveal any meaningful shape in the error occurencies. At least not yet. :(
>
> D.
>
>
>
> mdipierro wrote:
> > Has anybody else here had a similar problem?
>
> > massimo
>
> > On Nov 9, 11:29 am, David Zejda  wrote:
> > Hi :)
>
> > E.g. now the exception was raised by the web2py internal db
> > initialization routine:
>
> > 28: db = SQLDB('mysql://myus:myp...@localhost:330h6/mydb', pool_size=10)
>
> > Traceback (most recent call last):
> >   File "/opt/web2py/gluon/restricted.py", line 188, in restricted
> >     exec ccode in environment
> >   File "/opt/web2py/applications/myapp/compiled/models_db.py", line 28,
> > in 
> >   File "/opt/web2py/gluon/sql.py", line 978, in __init__
> >     self._execute('SET FOREIGN_KEY_CHECKS=1;')
> >   File "/opt/web2py/gluon/sql.py", line 977, in 
> >     self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
> >   File "/var/lib/python-support/python2.5/MySQLdb/cursors.py", line 166,
> > in execute
> >     self.errorhandler(self, exc, value)
> >   File "/var/lib/python-support/python2.5/MySQLdb/connections.py", line
> > 35, in defaulterrorhandler
> >     raise errorclass, errorvalue
> > ProgrammingError: (2014, "Commands out of sync; you can't run this
> > command now")
>
> > I'm thinking about possibility to raise the size of my poll. But in the
> > past with higher poll I think I was receiving more OperationalError:
> > (2006, 'MySQL server has gone away'). Because I am referring to a live
> > server, I would prefer to avoid experiments which could make frequency
> > of db errors even worse :)
>
> > thanks & wishing you a nice day..
> > David
>
> > mdipierro wrote:
>  I cannot say without looking at the code. MySQL has lots of
>  undocumented quirks about what you can do and what you cannot do
>  within one transaction.
>  Try add a db.commit() after each insert/unpdate/form.accepts/
>  crud.update/crud.select IF you do a select after that.
>  Do you have any try:...except in your controllers and db queries
>  inside?
>  On Nov 8, 2:57 am, David Zejda  wrote:
>  The MySQL error occurs quite often, several times every day. The app has
>  about 2 page views daily and heavily communicates with db (tens of
>  queries per request, in db I have about 100 tables). Currently I have
>  pool with size for 10 connections.
>  Meaning of the error message is described here:
> http://dev.mysql.com/doc/refman/4.1/en/commands-out-of-sync.html
>  It seems that with MySQL statements on the same db connection have to be
>  exhausted one-by-one, never in parallel. Two statements returning data
>  to the process must be using separate DBConnections (possibly to the
>  same host/db). Multiple statements on the same connection are supported,
>  but only 1 may be in a state to 'fetch' data.
>  Traces for the errors look like this:
>    File "/opt/web2py/gluon/sql.py", line 3378, in count
>      return self.select('count(*)')[0]._extra['count(*)']
>    File "/opt/web2py/gluon/sql.py", line 3237, in select
>      rows = response(query)
>    File "/opt/web2py/gluon/sql.py", line 3232, in response
>      db._execute(query)
>    File "/opt/web2py/gluon/sql.py", line 977, in 
>      self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
>    File "/var/lib/python-support/python2.5/MySQLdb/cursors.py", line 166,
>  in execute
>      self.errorhandler(self, exc, value)
>    File "/var/lib/python-support/python2.5/MySQLdb/connections.py", line
>  35, in defaulterrorhandler
>      raise errorclass, errorvalue
>  ProgrammingError: (2014, "Commands out of sync; you can't run this
>  command now")
>  Or e.g.:
>  Traceback (most recent call last):
>    File "/opt/web2py/gluon/main.py", line 475, in wsgibase
>      BaseAdapter.close_all_instances(BaseAdapter.rollback)
>    File "/opt/web2py/gluon/sql.py", line 810, in close_all_instances
>      action(instance)
>    File "/opt/web2py/gluon/sql

[web2py] Re: How to switch back to English for the Admin interface?

2010-11-10 Thread guruyaya
I'm not sure how to attach files here, but I've created a patch that
creates a dropdown with all possible languages on the admin. Anyone
wants it?

On Nov 10, 2:53 pm, Stefan Scholl  wrote:
> I know, but I don't want to use one browser for development (English)
> and one for the rest (German).
>
> On 9 Nov., 14:28, mdipierro  wrote:
>
> > wait. You should not need to delete files. The language is set by your
> > browser.
>
> > On Nov 9, 3:41 am, Stefan Scholl  wrote:
>
> > > Oops, found it 5 minutes later.
>
> > > In case somebody wants to switch back to English, too:
>
> > > Delete (or rename) your language in applications/admin/languages
>
>


[web2py] Re: help us test new admin on windows....

2010-11-10 Thread mdipierro
In admin/controllers/default.py|search(), can you add a print
statement to make sure it is being called and it is returning te
correct list of matching files?



On Nov 10, 2:49 pm, Anthony  wrote:
> > One thing that's a bit odd is the in file search, which doesn't seem
> > to have any effect on FF (I entered "index" and pressed enter). On IE
> > it's a bit different: "index" and [enter] collapsed all sections
> > (Models, Controllers, Views,...) and they couldn't be expanded again
> > after this. Only F5 solved this.
>
> Actually, I don't think running the search collapses the sections.
> Instead, I think it is supposed to hide everything except the files
> that match the search. The problem is, it appears to simply hide
> everything, including the files that match the search (so the files
> are hidden, not collapsed). F5 (or clicking the Edit button at the
> top) gets you back to the original page, without the search.
>
> Obviously we should fix the search. But once it's fixed, we should
> also make sure there's some UI indicator when there are no search
> results -- otherwise, the user is likely to be confused by what
> appears to be all of the sections collapsing.
>
> Anthony


[web2py] Re: How to switch back to English for the Admin interface?

2010-11-10 Thread mdipierro
send it to me and I will take a look.

On Nov 10, 3:04 pm, guruyaya  wrote:
> I'm not sure how to attach files here, but I've created a patch that
> creates a dropdown with all possible languages on the admin. Anyone
> wants it?
>
> On Nov 10, 2:53 pm, Stefan Scholl  wrote:
>
> > I know, but I don't want to use one browser for development (English)
> > and one for the rest (German).
>
> > On 9 Nov., 14:28, mdipierro  wrote:
>
> > > wait. You should not need to delete files. The language is set by your
> > > browser.
>
> > > On Nov 9, 3:41 am, Stefan Scholl  wrote:
>
> > > > Oops, found it 5 minutes later.
>
> > > > In case somebody wants to switch back to English, too:
>
> > > > Delete (or rename) your language in applications/admin/languages
>
>


[web2py] Re: Error Installing Appliance

2010-11-10 Thread Anthony
On Nov 10, 3:18 pm, Syed  wrote:
> Complete user-error. Although I did reinstall with python 2.5.4 from
> python.org, and then the binary distribution of web2py

Note, if you run the binary version of web2py, I think it simply runs
the Python interpreter that comes with web2py (which happens to be
2.5.4), regardless of the Python interpreter you've got installed. If
you want it to run from your own installation of Python (and be able
to access modules in your Python site-packages), I think you would
have to run from source (alternatively, you can put third party
modules in the web2py site-packages folder, as discussed here:
http://web2py.com/book/default/chapter/04#Third-Party-Modules).

Anthony


[web2py] Re: Error Installing Appliance

2010-11-10 Thread Syed
Nice. Thanks for the tip. If I'm completely new to python and web2py--
and am most interested building web2py apps on GAE--should I just
stick to official book for awhile? Will I need to delve into
peculiarities of GAE anytime soon?


[web2py] Re: help us test new admin on windows....

2010-11-10 Thread Anthony
According to Firebug, when I search for "gae", it is calling:

http://127.0.0.1:8000/admin/default/search/welcome?keywords=gae

and returning the following JSON response:

{"files": ["models\\db.py"]}

So, it appears to be working -- but the admin design page is not then
displaying the output properly. Probably a problem with the javascript/
jQuery code in the view.

Anthony

On Nov 10, 4:09 pm, mdipierro  wrote:
> In admin/controllers/default.py|search(), can you add a print
> statement to make sure it is being called and it is returning te
> correct list of matching files?
>
> On Nov 10, 2:49 pm, Anthony  wrote:
>
>
>
> > > One thing that's a bit odd is the in file search, which doesn't seem
> > > to have any effect on FF (I entered "index" and pressed enter). On IE
> > > it's a bit different: "index" and [enter] collapsed all sections
> > > (Models, Controllers, Views,...) and they couldn't be expanded again
> > > after this. Only F5 solved this.
>
> > Actually, I don't think running the search collapses the sections.
> > Instead, I think it is supposed to hide everything except the files
> > that match the search. The problem is, it appears to simply hide
> > everything, including the files that match the search (so the files
> > are hidden, not collapsed). F5 (or clicking the Edit button at the
> > top) gets you back to the original page, without the search.
>
> > Obviously we should fix the search. But once it's fixed, we should
> > also make sure there's some UI indicator when there are no search
> > results -- otherwise, the user is likely to be confused by what
> > appears to be all of the sections collapsing.
>
> > Anthony- Hide quoted text -
>
> - Show quoted text -


[web2py] Re: CRON doesn't work

2010-11-10 Thread Jonas Rundberg
Hi Sverre,

I have the exact same issue. (Running web2py 1.87.3)
Did you manage to get to work?

/ jonas


On Nov 4, 11:10 am, Sverre  wrote:
> My cron tab looking like this
>
> #crontab
> */2 * * * *     root  *sys/test_cron
> @hourly          root  *applications/mm/cron/expire_sessions.py
>
> but this doesn' work. My test cron function is
>
> from time import ctime
> def test_cron():
>     db.dbg.insert(dbgmsg=ctime())
>     db.commit()
>     return "ready"
>
> If I trigger this function manually it's working. Web2Py is installed
> as a Windows Service. Is someone able to help?


[web2py] Re: CRON doesn't work

2010-11-10 Thread mdipierro
Please try the web2py nighlty built.

On Nov 10, 3:48 pm, Jonas Rundberg  wrote:
> Hi Sverre,
>
> I have the exact same issue. (Running web2py 1.87.3)
> Did you manage to get to work?
>
> / jonas
>
> On Nov 4, 11:10 am, Sverre  wrote:
>
> > My cron tab looking like this
>
> > #crontab
> > */2 * * * *     root  *sys/test_cron
> > @hourly          root  *applications/mm/cron/expire_sessions.py
>
> > but this doesn' work. My test cron function is
>
> > from time import ctime
> > def test_cron():
> >     db.dbg.insert(dbgmsg=ctime())
> >     db.commit()
> >     return "ready"
>
> > If I trigger this function manually it's working. Web2Py is installed
> > as a Windows Service. Is someone able to help?
>
>


[web2py] simple table div

2010-11-10 Thread Martin.Mulone
I decided to start to make my own implementation of table maker. The
diference with sqltable or TABLE(), it use div (more flexible), accept
web2py helpers as values and is very simple to use.

Example:

http://web2pytesting.appspot.com/tablediv/

Code:

table =
SIMPLE_TABLE_DIV(fixedwidth=True,maxwidth=500,name="simplet1",number_list=True)
table.add_header([{'caption':'Header 1', 'width': 200},
  {'caption':'Header 2', 'width': 100},
  {'caption':'Header 3', 'width':
100},
  ])
table.add_row(['Value 1','Value 2', 'Value 3'])
table.add_row(['Value 4','Value 5', 'Value 6'])
table.add_row(['Value 7','Value 8', 'Value 9'])

If anyone is interested in this or want to contribute, i will put in
bitbucket.


[web2py] Re: simple table div

2010-11-10 Thread Martín Mulone
this is the model

2010/11/10 Martin.Mulone 

> I decided to start to make my own implementation of table maker. The
> diference with sqltable or TABLE(), it use div (more flexible), accept
> web2py helpers as values and is very simple to use.
>
> Example:
>
> http://web2pytesting.appspot.com/tablediv/
>
> Code:
>
> table =
>
> SIMPLE_TABLE_DIV(fixedwidth=True,maxwidth=500,name="simplet1",number_list=True)
> table.add_header([{'caption':'Header 1', 'width': 200},
>  {'caption':'Header 2', 'width': 100},
>  {'caption':'Header 3', 'width':
> 100},
>  ])
> table.add_row(['Value 1','Value 2', 'Value 3'])
> table.add_row(['Value 4','Value 5', 'Value 6'])
> table.add_row(['Value 7','Value 8', 'Value 9'])
>
> If anyone is interested in this or want to contribute, i will put in
> bitbucket.
>



-- 
My blog: http://martin.tecnodoc.com.ar
My portfolio *spanish*: http://www.tecnodoc.com.ar
Checkout my last proyect instant-press: http://www.instant2press.com
# -*- coding: utf-8 -*- 

# SIMPLE_TABLE_DIV
#
# Build tables, without using table, this use divs
# Coldef and rowdef is not working now,
#

# EXAMPLE

#def index():
#
##Sample table
#table = SIMPLE_TABLE_DIV(fixedwidth=True,maxwidth=500,name="simplet1",number_list=True)
#table.add_header([{'caption':'Header 1', 'width': 200},
#  {'caption':'Header 2', 'width': 100},
#  {'caption':'Header 3', 'width': 100},  
#  ])
#table.add_row(['Value 1','Value 2', 'Value 3'])
#table.add_row(['Value 4','Value 5', 'Value 6'])
#table.add_row(['Value 7','Value 8', 'Value 9'])
#
#
##Sample table with HTML HELPERS
#table2 = SIMPLE_TABLE_DIV(fixedwidth=True,maxwidth=530,name="simplet2")
#table2.add_header([{'caption':'Name', 'width': 200},
#  {'caption':'Surname', 'width': 200},
#  {'caption':'Tel.', 'width': 100},  
#  ])
#table2.add_row(['Michael', A('Douglas',_href="#douglas"), '22-33'])
#table2.add_row(['Bill', A('Kid',_href="#kid"), '33--333'],highlight=True)
#table2.add_row(['Von',A('Durssen',_href="#durssen"), '-'])
#table2.add_row(['Don',A('Jhonson',_href="#durssen"), '-'])
#table2.add_row(['Brad',A('Pitt',_href="#durssen"), '-'])
#
#
##Sample table with HTML HELPERS AND ICONS
#url_edit = URL(request.application,'static','images/edit.png')
#url_apply = URL(request.application,'static','images/apply.png')
#url_disable = URL(request.application,'static','images/disable.png')
#
#table3 = SIMPLE_TABLE_DIV(fixedwidth=True,maxwidth=550,name="simplet3")
#table3.add_header([{'caption':'Name', 'width': 200},
#  {'caption':'Email', 'width': 200},
#  {'caption':'Edit', 'width': 30},
#  {'caption':'Appl.', 'width': 30},
#  {'caption':'Disa.', 'width': 30},
#  ])
#table3.add_row(['Michael Douglas', A('doug...@mail.com',_href="#"), IMG(_src=url_edit), IMG(_src=url_apply), IMG(_src=url_disable)])
#table3.add_row(['Paul Simon', A('p...@mail.com',_href="#"), IMG(_src=url_edit), IMG(_src=url_apply), IMG(_src=url_disable)])
#table3.add_row(['James Hetfield', A('ja...@mail.com',_href="#"), IMG(_src=url_edit), IMG(_src=url_apply), IMG(_src=url_disable)])
#
#return dict(table=table, table2=table2, table3=table3)

class SIMPLE_TABLE_COLUMN(object):

def __init__(self, name="", caption="", width=100, highlight=False ):

self.name = name
self.caption = caption
self.width = width
self.highlight = highlight

class SIMPLE_TABLE_ROW(object):

def __init__(self, values=[], header=None, highlight=False ):
   
self.values = values
self.header = header
self.highlight = highlight

 
class SIMPLE_TABLE_HEADER(object):

def __init__(self, coldef=[], default_width=100):

if not isinstance(coldef, list):
raise SyntaxError, 'something wrong in headers must be a list type'

if coldef != []: 
newcolumns=[]   
for col in coldef:

try:
caption = col['caption']
except KeyError:
raise KeyError, "Not a valid column caption, must contain a caption"

try:
name = col['name']
except KeyError:
name = caption #if there no name use caption

try:
width = int(col['width'])
except:
width = default_width #if there no name use caption

[web2py] Re: help us test new admin on windows....

2010-11-10 Thread mdipierro
OK, I think I understand and it is fixed. Can you try it again (from
trunk)?

On Nov 10, 3:43 pm, Anthony  wrote:
> According to Firebug, when I search for "gae", it is calling:
>
> http://127.0.0.1:8000/admin/default/search/welcome?keywords=gae
>
> and returning the following JSON response:
>
> {"files": ["models\\db.py"]}
>
> So, it appears to be working -- but the admin design page is not then
> displaying the output properly. Probably a problem with the javascript/
> jQuery code in the view.
>
> Anthony
>
> On Nov 10, 4:09 pm, mdipierro  wrote:
>
> > In admin/controllers/default.py|search(), can you add a print
> > statement to make sure it is being called and it is returning te
> > correct list of matching files?
>
> > On Nov 10, 2:49 pm, Anthony  wrote:
>
> > > > One thing that's a bit odd is the in file search, which doesn't seem
> > > > to have any effect on FF (I entered "index" and pressed enter). On IE
> > > > it's a bit different: "index" and [enter] collapsed all sections
> > > > (Models, Controllers, Views,...) and they couldn't be expanded again
> > > > after this. Only F5 solved this.
>
> > > Actually, I don't think running the search collapses the sections.
> > > Instead, I think it is supposed to hide everything except the files
> > > that match the search. The problem is, it appears to simply hide
> > > everything, including the files that match the search (so the files
> > > are hidden, not collapsed). F5 (or clicking the Edit button at the
> > > top) gets you back to the original page, without the search.
>
> > > Obviously we should fix the search. But once it's fixed, we should
> > > also make sure there's some UI indicator when there are no search
> > > results -- otherwise, the user is likely to be confused by what
> > > appears to be all of the sections collapsing.
>
> > > Anthony- Hide quoted text -
>
> > - Show quoted text -
>
>


Re: [web2py] flow charts

2010-11-10 Thread Michele Comitini
Hi mart,

Not a flowchart app, a library, but you can make very nice charts if
you need to show them with web2py:


http://morrisonpitt.com/jsPlumb/html/jquery/demo.html

mic

2010/11/10 mart :
> Hey,
>
> Anybody know of any relatively decent flow chart app out there that
> would be compatible with web2py?
>
> Thanks,
> Mart :)


[web2py] Re: Pyodbc error with web2py under Apache and mod_wsgi

2010-11-10 Thread azarkowsky
I just wanted to add that my new build of pyodbc using MinGW32 didn't
seem to work either.  I removed pyodbc from my Python site-packages
folder and after installing MingW and adding it to my PATH in the
pyodbc source folder I ran 'python setup.py build -c mingw32' followed
by 'python setup.py install'.  This seemed to yield the same result: I
can import pyodbc fine as long as I'm not running through mod_wsgi.

Dependency Walker states it is having trouble resolving several
libraries (MSVCR90.DLL, GPSVC.DLL, IESHIMS.DLL & LINKINFO.DLL) when I
open c:\python\lib\site-packages\PYODBC.PYD although I saw reference
to Dependency Walker erroneously reporting missing DLLs due to
something related to SideBySide Assembly.

Since DLLs and pretty far out of my realm of expertise and web2py
works quite well without mod_wsgi I may take another look at
mod_proxy.  Is it OK to use the built-in Rocket web server in a
production environment?  The only reference I saw to this in the
web2py book was that it's just not terribly configurable.  Would there
be any other reasons against it?

Thanks,
Adam

On Nov 10, 1:37 pm, azarkowsky  wrote:
> Hi Massimo,
>
> Thanks for your prompt response.  That was my first thought as well.
> The system I'm working on though is a pretty fresh build and searching
> the file system for 'site-packages' I only find results (as expected)
> within web2py and in my python installation folder, 'C:\python'.  So
> unless modwsgi (or some other installed software) ships with a copy of
> python I think it's using the correct version.
>
> I see in the Apache error.log file when starting Apache the following
> message:
> [Tue Nov 09 18:25:58 2010] [notice] Apache/2.2.17 (Win32) mod_ssl/
> 2.2.17 OpenSSL/0.9.8o mod_wsgi/3.3 Python/2.7 configured -- resuming
> normal operations
>
> Python 2.7 is what I installed, but I'm not sure how to have modwsgi
> verify the path to the specific python interpreter that it's using.  I
> added a few lines of debug in gluon.sql.py:
> sys.path returns:
> [Tue Nov 09 18:26:01 2010] [error] ['', 'C:web2pysite-
> packages', 'C:web2py', 'C:Windowssystem32\\\
> \python27.zip', 'C:PythonLib', 'C:PythonDLLs', 'C:\\\
> \PythonLiblib-tk', 'C:Program Files (x86)Apache
> Software FoundationApache2.2', 'C:Program Files (x86)\\\
> \Apache Software FoundationApache2.2bin', 'C:Python', 'C:\\
> \\Pythonlibsite-packages', '../gluon']
>
> Also, I printed the stack trace after it throws the exception trying
> to load pyodbc:
> [Tue Nov 09 18:26:01 2010] [error] Traceback (most recent call last):
> [Tue Nov 09 18:26:01 2010] [error]   File "C:\\web2py\\gluon\\sql.py",
> line 95, in 
> [Tue Nov 09 18:26:01 2010] [error]     import pyodbc
> [Tue Nov 09 18:26:01 2010] [error] ImportError: DLL load failed: The
> specified module could not be found.
>
> I did find a post regarding DLLs failing to load under mod_wsgi
> (http://groups.google.com/group/modwsgi/browse_thread/thread/
> 013b4a5faa962d77/107d04edc473d732?#107d04edc473d732) where the
> solution seemed to be using MinGWto compile psycopg2.  Since I used
> the "Windows Installer" version of pyodbc, I may go back and try to
> build pyodbc following these steps as well.
>
> I'm also wondering if this could be related to either a windows or
> Apache security issue since pyodbc works with web2py directly
> (bypassing Apache/mod_wsgi).  I'll work on building a fresh pyodbc on
> my system with MinGW, but if any of this additional info leads to any
> other suggestions I'm all ears, since I'm largely guessing at this
> point!  :)
>
> Thanks,
> Adam
>
> On Nov 9, 10:35 pm, mdipierro  wrote:
>
>
>
>
>
>
>
> > you may have different python versions installed. Check the one used
> > by modwsgi
>
> > On Nov 9, 3:02 pm, azarkowsky  wrote:
>
> > > Hi,
>
> > > I'm relatively new to web2py and am attempting to set up my production
> > > environment for the first time.  I'm running Apache2.2 with mod_wsgi,
> > > python 2.7, & web2py 1.88.2 on Win XP SP3.  If I run web2py without
> > > Apache by running:  'python web2py.py -a "" -i 127.0.0.1 -p
> > > 8000' I can access both my application and the admin interface without
> > > any problems.  Once I try to access my site running behind Apache
> > > though, I receive a ticket containing the following trackback:
>
> > > Traceback (most recent call last):
> > >   File "C:\web2py\gluon\restricted.py", line 188, in restricted
> > >     exec ccode in environment
> > >   File "C:/web2py/applications/lunch/models/db.py", line 11, in
> > > 
> > >     db = DAL('mssql://lunch:lu...@b1ts003/lunch1')
> > >   File "C:\web2py\gluon\sql.py", line 4048, in DAL
> > >     raise RuntimeError, "%s (tried 5 times)" % exception
> > > RuntimeError: global name 'pyodbc' is not defined (tried 5 times)
>
> > > If I run web2py in terminal mode and import pyodbc I don't receive any
> > > errors:
>
> > > C:\web2py>python web2py.py -S welcome -P
> > > No handlers 

Re: [web2py] simple table div

2010-11-10 Thread rochacbruno
Nice! I want to use it. 

I am thinking in a way to create a inline editable table. 

Enviado via iPhone

Em 10/11/2010, às 20:08, "Martin.Mulone"  escreveu:

> I decided to start to make my own implementation of table maker. The
> diference with sqltable or TABLE(), it use div (more flexible), accept
> web2py helpers as values and is very simple to use.
> 
> Example:
> 
> http://web2pytesting.appspot.com/tablediv/
> 
> Code:
> 
> table =
> SIMPLE_TABLE_DIV(fixedwidth=True,maxwidth=500,name="simplet1",number_list=True)
> table.add_header([{'caption':'Header 1', 'width': 200},
>  {'caption':'Header 2', 'width': 100},
>  {'caption':'Header 3', 'width':
> 100},
>  ])
> table.add_row(['Value 1','Value 2', 'Value 3'])
> table.add_row(['Value 4','Value 5', 'Value 6'])
> table.add_row(['Value 7','Value 8', 'Value 9'])
> 
> If anyone is interested in this or want to contribute, i will put in
> bitbucket.


[web2py] Re: Pagination [Web2py Utils] returns None

2010-11-10 Thread Andrew Evans
I just noticed the difference in URLs

https://127.0.0.1:8000/Working/display/product_wall/4056

above is the comments on the product notice the id.

below is the next link of the pagination

https://www.127.0.0.1:8000/Working/display/product_wall?p=5

it loses the 4056 which is the id of the product

I think it may have to do with response value. Any ideas?



On Wed, Nov 10, 2010 at 9:04 AM, Andrew Evans  wrote:

> Hello I am trying to create some pagination on my comments page everything
> seems to be working, however when I click the next link it goes to a page
> that all it says is None
>
> Anyone know why this is happening and how to fix it
>
> There are entries in the db.
>
> Thanks in Advance
>
> below is my code
>
> *cheers
>
>
> def product_wall():
> this_page = request.args(0)
> product=db(db.product.id == this_page).select(db.product.ALL)
> for products in product:
> #comments=db(db.comment.product ==
> this_page).select(db.comment.ALL)
> comments=db.comment.product == this_page
> orderby = ~db.comment.id
> pcache = (cache.ram, 15)
> stars = StarRatingWidget(single_vote=True)
> db.comment.rating.widget = stars.widget
>
> db.comment.product.default = products.id
> form = SQLFORM(db.comment)
> db.comment.product.id = products.id
> if form.accepts(request.vars,session):
> response.flash = 'Your Comment has been submitted'
> paginate =
> Pagination(db,comments,orderby,display_count=2,cache=pcache,r=request,res=response)
> rows=paginate.get_set(set_links=True)
> return dict(comments=rows,form=form,products=products)
> elif form.errors:
> response.flash = 'Please correct your error'
> paginate =
> Pagination(db,comments,orderby,display_count=2,cache=pcache,r=request,res=response)
> rows=paginate.get_set(set_links=True)
> return dict(comments=rows,form=form,products=products)
> else:
> paginate =
> Pagination(db,comments,orderby,display_count=2,cache=pcache,r=request,res=response)
> rows=paginate.get_set(set_links=True)
> return dict(comments=rows,form=form,products=products)
>
>
>


[web2py] Re: flow charts

2010-11-10 Thread mart
Mic, now that's what I'm talking about! That looks awesome! :)

Thanks for that!

Mart :)

On Nov 10, 5:33 pm, Michele Comitini 
wrote:
> Hi mart,
>
> Not a flowchart app, a library, but you can make very nice charts if
> you need to show them with web2py:
>
> http://morrisonpitt.com/jsPlumb/html/jquery/demo.html
>
> mic
>
> 2010/11/10 mart :
>
> > Hey,
>
> > Anybody know of any relatively decent flow chart app out there that
> > would be compatible with web2py?
>
> > Thanks,
> > Mart :)
>
>


[web2py] Re: medical data

2010-11-10 Thread mart
have you checked this page?

http://en.wikipedia.org/wiki/List_of_open_source_healthcare_software

Mart :)

On Nov 10, 5:44 pm, mdipierro  wrote:
> Does anybody know of a free database (xml or csv) of medical
> conditions and/or drugs?


[web2py] Re: plugin wiki on older aps?

2010-11-10 Thread mart
layout , eh? i"ll give it a go. I assume will be easier then better
then me trying the photoshop thing...

thanks again


Mart :)

On Nov 10, 2:10 pm, rochacbruno  wrote:
> You can try web2py.com/layouts
>
> Enviado via iPhone
>
> Em 10/11/2010, às 16:04, mart  escreveu:
>
> > Works great! double thanks! she'll be thrilled, now I just need to
> > change the blueish-green header/footer to purple, then I can walk
> > away :)
>
> > On Nov 10, 12:51 pm, mart  wrote:
> >> ah, i see it! :) Great! I must have declined the "replace file?" while
> >> dropping an updated filesset.
>
> >> thank you very much for that! :)
>
> >> On Nov 10, 12:35 pm, Bruno Rocha  wrote:
>
> >>> The newest 
> >>> versionhttp://code.google.com/p/web2py/source/browse/applications/welcome/vi...
>
> >>> 2010/11/10 Bruno Rocha 
>
>  You have to replace web2py_ajax.html to a new version.
>
>  web2py_components depends on some things in web2py_ajax.html!
>
>  2010/11/10 mart 
>
>  Hi,
>
> > Helping my daughter with a school project and she loves the look of
> > web2py in the "Example minimalist wiki with versioning and
> > authentication". She 's making a "memory game" (not sure how, but she
> > is ;) ).  Since she knows how to use the widget builder in
> > plugin_wiki, she installed it, has the pages menu item and everything
> > seem to be good.
>
> > But some of the widgets like "comments" and "action_load" just stay
> > seem to be stuck on "loading" (doesn't resolve to a widget).
>
> > Assuming something is  missing, would anybody know what that is ? I
> > added everything I could think of, but no go yet.
>
> > Thanks,
> > Mart :)
>
>  --
>
> http://rochacbruno.com.br
>
> >>> --
>
> >>>http://rochacbruno.com.br
>
>


[web2py] Re: Selecting from dropdown using Ajax

2010-11-10 Thread oneroler
Alex,

Thanks for all your help.  Yes, you were correct that the issue was
simply that the id value was not being passed in the ajax call.  Here
is my final code for reference if anyone is interested.

<>
def test():
firms = db(db.firm).select()
return dict(firms=firms)

def test_chg():
firm=request.vars.hdnSel
strats = db(db.firmstrat.firm_id==firm).select()
options=[]
for strat in strats:
options.append(strat.strat_id.name)
return DIV(*options).xml()

<>
{{extend 'layout.html'}}

{{=SELECT( _id='firmdrop', _onChange="$('#hdnSel').val(this.value);"
"ajax('test_chg',['hdnSel'],'target');",
*[OPTION(firms[i].name,_value=str(firms[i].id)) for i in
range(len(firms))]
)}}


On Nov 9, 9:27 pm, Alex  wrote:
> You are definitely correct.  I mis-read what you had, but what I put
> up, you can still use as well if you need to pass args via the URL.
>
> In any case, if I am understanding this correctly, it seems to be more
> of a problem of getting the selected value of the option, correct?
>
> There are probably several ways to do this (I actually think jQuery
> may provide an easy way to get at the selected option).  Off the top
> of my head, this is probably what I would do:
>
>   -  Create a hidden input variable in the form to hold the selected
> value
>   -  before the ajax call, populate the hidden input field with what
> selected option's value
>
> Something like this would need to be added to your code:
>
> In the View:
>
>   -  Add this onto your form:   name="hdnSel" value="">
>   -  Add this to the onChange event:  _onChange="$
> ('#hdnSel').val(this.value); ajax('test_chg',['hdnSel'],'target');",
>
> What this does is on the onChange event, it will populate the hidden
> input we added with the selected option's value.  This is then passed
> through the AJAX call.  Hopefully this helps.  Let me know :)
>
> On Nov 9, 8:28 pm, oneroler  wrote:
>
>
>
>
>
>
>
> > Alex,
>
> > Thanks.  I thought based on the book that the 2nd argument of ajax was
> > passing the values to request.vars.variable.  I pasted some of the
> > code from the book below for reference (http://web2py.com/book/default/
> > chapter/10?search=ajax#The-ajax-Function).  Based on this I originally
> > had the code below in test_chg.  Am I mistaken about what the 2nd
> > argument is?  Also, regarding your suggestion, could you tell me how
> > to identify the selected item so that I can pass as an args/vars in
> > the URL as you recommended?
>
> > def one():
> >     return dict()
>
> > def echo():
> >     return request.vars.name
>
> > {{extend 'layout.html'}}
> > 
> >    
> > 
> > 
>
> > def test_chg
> > firm=request.vars.firmdrop
> > strats = db(db.firmstrat.firm_id==firm).select()
> > options=[]
> > for strat in strats:
> >     options.append(strat.strat_id.name)
> > return DIV(*options).xml()
>
> > On Nov 8, 9:37 pm, Alex  wrote:
>
> > > How are you passing the value in the request.vars?
>
> > > I'm going to guess that on your AJAX call in the _onChange handler,
> > > you want to specify the parameters.  You can do something like:
>
> > >   - ajax( '{{=URL(c='controllerName',f='test_chg',
> > > args=request.args(0))}}', ['firmdrop'],'target' )
>
> > > You can pass whatever you want in args.  If you have values in
> > > request.vars, you should be able to access then like:
>
> > >  -  request.vars.variableName
>
> > > On Nov 7, 9:11 pm, oneroler  wrote:
>
> > > > I'm trying to learn to use the ajax functionality and am having
> > > > trouble getting it to work correctly.  I am trying to use a dropdown
> > > > of firms to show the related strategies.  Currently this doesn't
> > > > return anything to the div, but I do know that the onchange is
> > > > working.  It seems like the request.vars.values()[0] is not returning
> > > > anything.  Any help would be appreciated and also any pointers if
> > > > there is a way to do this better differently.  Below is my code.
>
> > > > I have based this on this 
> > > > messagehttp://groups.google.com/group/web2py/browse_thread/thread/4a6149ddcb
>
> > > > <>
> > > > def test():
> > > >     firms = db(db.firm).select()
> > > >     return dict(firms=firms)
>
> > > > def test_chg():
> > > >     firm=request.vars.values()[0]
> > > >     strats = db(db.firmstrat.firm_id==firm).select()
> > > >     options=[]
> > > >     for strat in strats:
> > > >         options.append(strat.strat_id.name)
> > > >     return DIV(*options).xml()
>
> > > > <>
> > > > {{extend 'layout.html'}}
> > > > {{=SELECT(_id='firmdrop',
> > > >     _onChange="ajax('test_chg',['firmdrop'],'target');",
> > > >     *[OPTION(firms[i].name,_value=str(firms[i].id)) for i in
> > > > range(len(firms))]
> > > >     )}}
> > > > 
>
> > > > Thanks,
> > > > Sam- Hide quoted text -
>
> > - Show quoted text -


[web2py] radio button issue

2010-11-10 Thread mattynoce
can anyone figure out something going wrong here?

i'm trying to get radio buttons that return True/False but show Yes/No
to the user. these buttons look good but no matter what you select,
they return True. this happens in appadmin, so there's nothing strange
in my view code.

Field('isComplete', 'boolean', default=None,
widget=SQLFORM.widgets.radio.widget,
requires=IS_NULL_OR(IS_IN_SET([True, False], ['Yes', 'No']))),

any thoughts?

thanks,

matt


[web2py] Re: medical data

2010-11-10 Thread mdipierro
Not quite what I am looking for. Not software but lists of conditions
and drugs.

On Nov 10, 6:23 pm, mart  wrote:
> have you checked this page?
>
> http://en.wikipedia.org/wiki/List_of_open_source_healthcare_software
>
> Mart :)
>
> On Nov 10, 5:44 pm, mdipierro  wrote:
>
> > Does anybody know of a free database (xml or csv) of medical
> > conditions and/or drugs?
>
>


[web2py] Help with "No such file or directory" error

2010-11-10 Thread CesarBustios
Hi, i'm trying to make a copy of an image inside my "uploads" folder. I
´m using the shutil module:

import shutil
shutil.copy(path, destination)

But i get "No such file or directory" error. Can anyone tell me the
correct path if my project is inside: /home/user/web2py/applications/
myproject/uploads/File.file.asdad89018239.128320.jpg

Thanks!


Re: [web2py] Re: Pagination [Web2py Utils] returns None

2010-11-10 Thread Thadeus Burgess
Its losing the args when it creates a new URL. It will require a patch on
set_links so you can pass custom args and vars to URL.

--
Thadeus




On Wed, Nov 10, 2010 at 4:36 PM, Andrew Evans  wrote:

> I just noticed the difference in URLs
>
> https://127.0.0.1:8000/Working/display/product_wall/4056
>
> above is the comments on the product notice the id.
>
> below is the next link of the pagination
>
> https://www.127.0.0.1:8000/Working/display/product_wall?p=5
>
> it loses the 4056 which is the id of the product
>
> I think it may have to do with response value. Any ideas?
>
>
>
> On Wed, Nov 10, 2010 at 9:04 AM, Andrew Evans  wrote:
>
>> Hello I am trying to create some pagination on my comments page everything
>> seems to be working, however when I click the next link it goes to a page
>> that all it says is None
>>
>> Anyone know why this is happening and how to fix it
>>
>> There are entries in the db.
>>
>> Thanks in Advance
>>
>> below is my code
>>
>> *cheers
>>
>>
>> def product_wall():
>> this_page = request.args(0)
>> product=db(db.product.id == this_page).select(db.product.ALL)
>> for products in product:
>> #comments=db(db.comment.product ==
>> this_page).select(db.comment.ALL)
>> comments=db.comment.product == this_page
>> orderby = ~db.comment.id
>> pcache = (cache.ram, 15)
>> stars = StarRatingWidget(single_vote=True)
>> db.comment.rating.widget = stars.widget
>>
>> db.comment.product.default = products.id
>> form = SQLFORM(db.comment)
>> db.comment.product.id = products.id
>> if form.accepts(request.vars,session):
>> response.flash = 'Your Comment has been submitted'
>> paginate =
>> Pagination(db,comments,orderby,display_count=2,cache=pcache,r=request,res=response)
>> rows=paginate.get_set(set_links=True)
>> return dict(comments=rows,form=form,products=products)
>> elif form.errors:
>> response.flash = 'Please correct your error'
>> paginate =
>> Pagination(db,comments,orderby,display_count=2,cache=pcache,r=request,res=response)
>> rows=paginate.get_set(set_links=True)
>> return dict(comments=rows,form=form,products=products)
>> else:
>> paginate =
>> Pagination(db,comments,orderby,display_count=2,cache=pcache,r=request,res=response)
>> rows=paginate.get_set(set_links=True)
>> return dict(comments=rows,form=form,products=products)
>>
>>
>>
>


[web2py] Re: help us test new admin on windows....

2010-11-10 Thread Anthony
Now I get a flash that says "Searching: 1 files" -- but it still
doesn't display the matching file.

On Nov 10, 5:26 pm, mdipierro  wrote:
> OK, I think I understand and it is fixed. Can you try it again (from
> trunk)?
>
> On Nov 10, 3:43 pm, Anthony  wrote:
>
>
>
> > According to Firebug, when I search for "gae", it is calling:
>
> >http://127.0.0.1:8000/admin/default/search/welcome?keywords=gae
>
> > and returning the following JSON response:
>
> > {"files": ["models\\db.py"]}
>
> > So, it appears to be working -- but the admin design page is not then
> > displaying the output properly. Probably a problem with the javascript/
> > jQuery code in the view.
>
> > Anthony
>
> > On Nov 10, 4:09 pm, mdipierro  wrote:
>
> > > In admin/controllers/default.py|search(), can you add a print
> > > statement to make sure it is being called and it is returning te
> > > correct list of matching files?
>
> > > On Nov 10, 2:49 pm, Anthony  wrote:
>
> > > > > One thing that's a bit odd is the in file search, which doesn't seem
> > > > > to have any effect on FF (I entered "index" and pressed enter). On IE
> > > > > it's a bit different: "index" and [enter] collapsed all sections
> > > > > (Models, Controllers, Views,...) and they couldn't be expanded again
> > > > > after this. Only F5 solved this.
>
> > > > Actually, I don't think running the search collapses the sections.
> > > > Instead, I think it is supposed to hide everything except the files
> > > > that match the search. The problem is, it appears to simply hide
> > > > everything, including the files that match the search (so the files
> > > > are hidden, not collapsed). F5 (or clicking the Edit button at the
> > > > top) gets you back to the original page, without the search.
>
> > > > Obviously we should fix the search. But once it's fixed, we should
> > > > also make sure there's some UI indicator when there are no search
> > > > results -- otherwise, the user is likely to be confused by what
> > > > appears to be all of the sections collapsing.
>
> > > > Anthony- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -


[web2py] Re: Error Installing Appliance

2010-11-10 Thread Anthony
On Nov 10, 4:26 pm, Syed  wrote:
> Nice. Thanks for the tip. If I'm completely new to python and web2py--
> and am most interested building web2py apps on GAE--should I just
> stick to official book for awhile? Will I need to delve into
> peculiarities of GAE anytime soon?

I haven't done anything with GAE, but I think you'll find the book
will serve you well. web2py can handle GAE pretty easily, though I
think there are a few special considerations when designing your app.
There are references to GAE throughout the book, and a whole section
in Chapter 11:

http://web2py.com/book/default/chapter/11#Google-App-Engine

Anthony


[web2py] Re: help us test new admin on windows....

2010-11-10 Thread mdipierro
Can you email the page source in html?

On Nov 10, 7:28 pm, Anthony  wrote:
> Now I get a flash that says "Searching: 1 files" -- but it still
> doesn't display the matching file.
>
> On Nov 10, 5:26 pm, mdipierro  wrote:
>
> > OK, I think I understand and it is fixed. Can you try it again (from
> > trunk)?
>
> > On Nov 10, 3:43 pm, Anthony  wrote:
>
> > > According to Firebug, when I search for "gae", it is calling:
>
> > >http://127.0.0.1:8000/admin/default/search/welcome?keywords=gae
>
> > > and returning the following JSON response:
>
> > > {"files": ["models\\db.py"]}
>
> > > So, it appears to be working -- but the admin design page is not then
> > > displaying the output properly. Probably a problem with the javascript/
> > > jQuery code in the view.
>
> > > Anthony
>
> > > On Nov 10, 4:09 pm, mdipierro  wrote:
>
> > > > In admin/controllers/default.py|search(), can you add a print
> > > > statement to make sure it is being called and it is returning te
> > > > correct list of matching files?
>
> > > > On Nov 10, 2:49 pm, Anthony  wrote:
>
> > > > > > One thing that's a bit odd is the in file search, which doesn't seem
> > > > > > to have any effect on FF (I entered "index" and pressed enter). On 
> > > > > > IE
> > > > > > it's a bit different: "index" and [enter] collapsed all sections
> > > > > > (Models, Controllers, Views,...) and they couldn't be expanded again
> > > > > > after this. Only F5 solved this.
>
> > > > > Actually, I don't think running the search collapses the sections.
> > > > > Instead, I think it is supposed to hide everything except the files
> > > > > that match the search. The problem is, it appears to simply hide
> > > > > everything, including the files that match the search (so the files
> > > > > are hidden, not collapsed). F5 (or clicking the Edit button at the
> > > > > top) gets you back to the original page, without the search.
>
> > > > > Obviously we should fix the search. But once it's fixed, we should
> > > > > also make sure there's some UI indicator when there are no search
> > > > > results -- otherwise, the user is likely to be confused by what
> > > > > appears to be all of the sections collapsing.
>
> > > > > Anthony- Hide quoted text -
>
> > > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -
>
>


[web2py] Re: medical data

2010-11-10 Thread DenesL
Try http://www.health.gov.on.ca/english/providers/program/drugs/edition_40.html

On Nov 10, 8:02 pm, mdipierro  wrote:
> Not quite what I am looking for. Not software but lists of conditions
> and drugs.
>
> On Nov 10, 6:23 pm, mart  wrote:
>
> > have you checked this page?
>
> >http://en.wikipedia.org/wiki/List_of_open_source_healthcare_software
>
> > Mart :)
>
> > On Nov 10, 5:44 pm, mdipierro  wrote:
>
> > > Does anybody know of a free database (xml or csv) of medical
> > > conditions and/or drugs?
>
>


[web2py] Re: flow charts

2010-11-10 Thread Alexandre Augusto
Hey Mart,

If you like visual appealing JavaScript  Framework you may also be
interested in Raphaël—JavaScript Library

What is it?
Raphaël is a small JavaScript library that should simplify your work
with vector graphics on the web. If you want to create your own
specific chart or image crop and rotate widget, for example, you can
achieve it simply and easily with this library.

Raphaël ['ræfeɪəl] uses the SVG W3C Recommendation and VML as a base
for creating graphics. This means every graphical object you create is
also a DOM object, so you can attach JavaScript event handlers or
modify them later. Raphaël’s goal is to provide an adapter that will
make drawing vector art compatible cross-browser and easy.

Raphaël currently supports Firefox 3.0+, Safari 3.0+, Chrome 5.0+,
Opera 9.5+ and Internet Explorer 6.0+.

http://raphaeljs.com/



On Nov 10, 10:14 pm, mart  wrote:
> Mic, now that's what I'm talking about! That looks awesome! :)
>
> Thanks for that!
>
> Mart :)
>
> On Nov 10, 5:33 pm, Michele Comitini 
> wrote:
>
> > Hi mart,
>
> > Not a flowchart app, a library, but you can make very nice charts if
> > you need to show them with web2py:
>
> >http://morrisonpitt.com/jsPlumb/html/jquery/demo.html
>
> > mic
>
> > 2010/11/10 mart :
>
> > > Hey,
>
> > > Anybody know of any relatively decent flow chart app out there that
> > > would be compatible with web2py?
>
> > > Thanks,
> > > Mart :)
>
>


[web2py] Custom JSON-RPC error codes

2010-11-10 Thread Matt
Hi there,

(This is probably more or a small request that a question.)

The JSON-RPC service by default always returns error codes of 100.

Can we possibly have this amended so that we could say raise a custom
JsonRpcException (from within our methods) provide a code, and message
and have that code and message returned instead?

Thoughts?
Matt


[web2py] Re: Learning Management System survey

2010-11-10 Thread rāma
Interesting thread glad I found it by searching the group because this
is what I am doing currently. However, the LMS is designed to be a
prototype trial though. I will be testing the beta LMS with a bunch of
students next week. I will be interested to help too in this project.

On Nov 8, 2:45 pm, mdipierro  wrote:
> At my school we have two systems:
>
> 1) peoplesoft (PS) which we use to manage accounting and class
> enrollments
> 2) the learning management system (LMS)
>
> The LMS gets enrollments from PS.
>
> This is because enrollments must be tied to accounting. There are
> rules on how students are billed, drop dates with full refunds, drop
> dates with partial refund, etc.
>
> Cloudcourse seems to do well that part that we now handle with PS but
> it is not an LMS and it not integrated with any accounting software.
>
> Enrollments must also have full revision history and I do not think
> cloudcourse does that. If a student changes its status, it must be
> possible to see what was its status at any moment in time.
>
> Massimo
>
> On Nov 8, 12:18 am, noel  wrote:
>
>
>
> > what do you think about google cloudcourse?
>
> > On Nov 5, 9:09 pm, Tom Atkins  wrote:
>
> > > I can volunteer time and input for the LMS idea.  I'm not experienced 
> > > enough
> > > with Python and web2py yet to contribute good code but can help with
> > > frontend UI, design, jQuery and documentation.
>
> > > Assuming the project would have a Free license?
>
> > > I'd be happy to register, host, set up and manage a dedicated site for the
> > > project.  The site could reference a bitbucket Hg repository (issue 
> > > tracking
> > > there), have a demo, download links (including plugins and themes), a 
> > > forum
> > > for users and developers (I'd be happy to moderate), documentation etc.
>
> > > In daydreaming time I have spent many hours trying to come up with a name
> > > for such a system. Because there is already 'desire2learn' in the market
> > > it's probably not good to use the '2' in the middle again like web2py. I 
> > > am
> > > fully behind Massimo's focus on the user.  As such the universally 
> > > accepted
> > > term 'Learning Management System' 
> > > (seehttp://en.wikipedia.org/wiki/Learning_management_system) is very 
> > > appropriate
> > > - so how about calling it 'elemes'? get it?!
>
> > > 'elemes.com' and 'elemes.org' are available.  I'd be happy to buy these 
> > > and
> > > provide hosting for a site for the project if people think this might be a
> > > good name? (You could change it later - but it'd get us started with a 
> > > place
> > > to discuss requirements, design criteria and goals away from the web2py
> > > list.)
>
> > > Thoughts?
>
> > > On 3 November 2010 22:35, mdipierro  wrote:
>
> > > > We need to assemble a team.


  1   2   >