need an ajax spreadsheet

83 views
Skip to first unread message

mdipierro

unread,
Jul 2, 2009, 10:16:11 PM7/2/09
to web2py Web Framework
Do you need to embed an ajax spreadsheet in you app. Now you have it:

http://www.vimeo.com/5432441
http://www.web2py.com/appliances/default/show/53

Please let know about bugs

Massimo
Message has been deleted

Hans Donner

unread,
Jul 2, 2009, 11:53:04 PM7/2/09
to web...@googlegroups.com
"Sorry, there is no page with that URL. Perhaps you meant to type
something similar?"

On Fri, Jul 3, 2009 at 4:43 AM, mdipierro<mdip...@cs.depaul.edu> wrote:
>
>
>
> On Jul 2, 9:16 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>> Do you need to embed an ajax spreadsheet in you app. Now you have it:
>>
>> http://www.vimeo.com/5432441http://www.web2py.com/appliances/default/show/53

Hans Donner

unread,
Jul 2, 2009, 11:53:49 PM7/2/09
to web...@googlegroups.com
but these work

Álvaro Justen [Turicas]

unread,
Jul 3, 2009, 12:38:00 AM7/3/09
to web...@googlegroups.com
On Fri, Jul 3, 2009 at 00:53, Hans Donner<hans....@pobox.com> wrote:
> "Sorry, there is no page with that URL. Perhaps you meant to type
> something similar?"

There are two URLs:

http://www.vimeo.com/5432441
http://www.web2py.com/appliances/default/show/53

--
Álvaro Justen
Peta5 - Telecomunicações e Software Livre
21 3021-6001 / 9898-0141
http://www.peta5.com.br/

Álvaro Justen [Turicas]

unread,
Jul 3, 2009, 12:41:38 AM7/3/09
to web...@googlegroups.com

Cool!
Are there options to save values that user entered (maybe in session)?
I was using some jQuery plugins (like jEditable[1]) to do something
like this (save user edited data from tables).

[1] http://www.appelsiini.net/projects/jeditable/default.html

Francois (Jersey)

unread,
Jul 3, 2009, 12:48:18 AM7/3/09
to web2py Web Framework

tried to install the spreadsheet application, but I have the following
error message: unable to install application spreadsheet.

It is possible to download the file, but I believe file is corrupt

mdipierro

unread,
Jul 3, 2009, 1:15:06 AM7/3/09
to web2py Web Framework
yes

say cell=sheet['cell_name']
when the cell is modified cell.onchange is called so you can point it
to a lambda that takes an action like storing it in the db. For
example:

cell.onchange=lambda cell=cell: db(db.cells.name==cell.name).update
(value=cell.computed_value)

Caveat: you must reset cell.onchange=None before the sheet is stored
in the session.

If other problems have problems downloading I will repost tomorrow.

Massimo

On Jul 2, 11:41 pm, Álvaro Justen [Turicas] <alvarojus...@gmail.com>
wrote:

Fran

unread,
Jul 3, 2009, 3:08:24 AM7/3/09
to web2py Web Framework
On Jul 3, 6:15 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
> If other problems have problems downloading I will repost tomorrow.

I get the same error - dl'ing in both FF3.5 & IE8
However the file un-tar's just fine & the appliance runs.
However the JS fails with formulae (FF3.5 & IE8 again)
Firebug shows 500 INTERNAL SERVER ERROR for the POSTs
Tickets generated show:
ImportError: No module named ations.spreadsheet.modules.sheet

This is bizarre as controllers\default.py correctly says "exec('from
applications.%s.modules.sheet import Sheet' % request.application)"

F

mdipierro

unread,
Jul 3, 2009, 9:44:17 AM7/3/09
to web2py Web Framework
Is it possible the app is called "spreadsheet" and you have
"Spreadsheet" in the URL? Capitalizaiton sometimes matters.

Fran

unread,
Jul 3, 2009, 10:23:54 AM7/3/09
to web2py Web Framework
On Jul 3, 2:44 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> Is it possible the app is called "spreadsheet" and you have
> "Spreadsheet" in the URL? Capitalizaiton sometimes matters.

No, not the issue.

Now I'm getting this error:
File "C:/Bin/web2py/applications/spreadsheet/controllers/
default.py", line 5, in index
sheet = Sheet.loads(session.psheet)
File "C:\Bin\web2py\applications\spreadsheet\modules\sheet.py", line
44, in loads
sheet=cPickle.loads(data)
TypeError: object cannot be interpreted as an index

I managed to get it to install by renaming as .w2p instead of .tar.
One time I named app as 'sheet' & get the error as:
File "C:/Bin/web2py/applications/sheet/controllers/default.py", line
5, in index
sheet = Sheet.loads(session.psheet)
File "C:\Bin\web2py\applications\sheet\modules\sheet.py", line 44,
in loads
sheet=cPickle.loads(data)
ImportError: No module named a

(Yes it truncates there in every ticket)

I added .w2p as 'spreadsheet' & it gives the 'index' error.

I think the download corruption could be a mime file-type issue...my
browser seems to think it's an XML document...

F

Álvaro Justen [Turicas]

unread,
Jul 3, 2009, 10:35:36 AM7/3/09
to web...@googlegroups.com

This error is shown when this block of code generates an exception:

try:
upfile = open(upname, 'wb')
upfile.write(fobj.read())
upfile.close()
path = apath(app, request)
os.mkdir(path)
did_mkdir = True
w2p_unpack(upname, path)
if extension != 'tar':
os.unlink(upname)
fix_newlines(path)

So, probably you don't have permission to open upname (file that was
uploaded), write in app file, mkdir to new app etc.

Yarko Tymciurak

unread,
Jul 3, 2009, 1:17:47 PM7/3/09
to web...@googlegroups.com
Here's what I found:

- this downloads a tar file;  web2py 1.65 is able to install it that way;

I just untarred, and moved to my web2py/appliances.- it runs; it edits;  (authentication wasn't enables, so login gave invalid function, but that's it.

I recall an issue w/ old Firefox's and incomplete downloads (Fedora just upgraded me to Firefox 3.5 the other day; I think it's just the release candidate)

My spreadsheet.tar is 65798 bytes;

Here are some checksums:


$ ls -l sp*
-rw-rw-r--. 1 yak007 yak007 65798 2009-07-02 22:09 spreadsheet.tar
$ sha1sum spreadsheet.tar
f0630cc59ea064783618cb5500fb65fc8b9c57cd  spreadsheet.tar
$ sha256sum spreadsheet.tar
b7cae50943cd5f8c02565b8be7b08bde003b4578a401b4afe83c28a4ca82d3f6  spreadsheet.tar
$

- Yarko

Yarko Tymciurak

unread,
Jul 3, 2009, 1:20:29 PM7/3/09
to web...@googlegroups.com
BTW - also renaming the download to spreadsheet.w2p works fine - web2py is able to install it, and it also runs no problems.

Massimo - talk about backwards compatibility - since appliances (still) generates *.tar files, why not have application install tolerate the *.tar files, as it has in the past?

mdipierro

unread,
Jul 3, 2009, 1:50:49 PM7/3/09
to web2py Web Framework
I got the problem. appliances is an old app and it sets the content
disposition to .tar even if the app is a .w2p. web2py can upload
both .tar and .w2p but, on some systems, it gets confused when the
extension is wrong. I think I fixed it in appliances.

Massimo

On Jul 3, 12:20 pm, Yarko Tymciurak <yark...@gmail.com> wrote:
> BTW - also renaming the download to spreadsheet.w2p works fine - web2py is
> able to install it, and it also runs no problems.
>
> Massimo - talk about backwards compatibility - since appliances (still)
> generates *.tar files, why not have application install tolerate the *.tar
> files, as it has in the past?
>
> On Fri, Jul 3, 2009 at 12:17 PM, Yarko Tymciurak <yark...@gmail.com> wrote:
> > Here's what I found:
>
> > - this downloads a tar file;  web2py 1.65 is able to install it that way;
>
> > I just untarred, and moved to my web2py/appliances.- it runs; it edits;
> > (authentication wasn't enables, so login gave invalid function, but that's
> > it.
>
> > I recall an issue w/ old Firefox's and incomplete downloads (Fedora just
> > upgraded me to Firefox 3.5 the other day; I think it's just the release
> > candidate)
>
> > My spreadsheet.tar is 65798 bytes;
>
> > Here are some checksums:
>
> > $ ls -l sp*
> > -rw-rw-r--. 1 yak007 yak007 65798 2009-07-02 22:09 spreadsheet.tar
> > $ sha1sum spreadsheet.tar
> > f0630cc59ea064783618cb5500fb65fc8b9c57cd  spreadsheet.tar
> > $ sha256sum spreadsheet.tar
> > b7cae50943cd5f8c02565b8be7b08bde003b4578a401b4afe83c28a4ca82d3f6
> > spreadsheet.tar
> > $
>
> > - Yarko
>

Hans

unread,
Jul 3, 2009, 3:47:09 PM7/3/09
to web2py Web Framework
great stuff massimo!!!

how can the size of the cells be adjusted? Basically I want wider
cells.

Thanks,
Hans

On Jul 3, 4:16 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
> Do you need to embed an ajax spreadsheet in you app. Now you have it:
>
> http://www.vimeo.com/5432441http://www.web2py.com/appliances/default/show/53

Fran

unread,
Jul 3, 2009, 4:19:14 PM7/3/09
to web2py Web Framework
On 3 July, 18:17, Yarko Tymciurak <yark...@gmail.com> wrote:
> My spreadsheet.tar is 65798 bytes;

Same here with fresh download (correct .w2p extension now)

> Here are some checksums:
> $ ls -l sp*
> -rw-rw-r--. 1 yak007 yak007 65798 2009-07-02 22:09 spreadsheet.tar
> $ sha1sum spreadsheet.tar
> f0630cc59ea064783618cb5500fb65fc8b9c57cd  spreadsheet.tar
> $ sha256sum spreadsheet.tar
> b7cae50943cd5f8c02565b8be7b08bde003b4578a401b4afe83c28a4ca82d3f6
> spreadsheet.tar

I only have md5sum:
6b86730634305c8bf7729395177175bd *web2py.app.spreadsheet.w2p

This time this is the error ticket I get on every POST - bizarre:
File "C:/Bin/web2py/applications/spreadsheet/controllers/default.py",
line 5, in index
sheet = Sheet.loads(session.psheet)
File "C:\Bin\web2py\applications\spreadsheet\modules\sheet.py", line
44, in loads
sheet=cPickle.loads(data)
UnpicklingError: could not find MARK

Yarko Tymciurak

unread,
Jul 3, 2009, 4:39:36 PM7/3/09
to web...@googlegroups.com
On Fri, Jul 3, 2009 at 3:19 PM, Fran <franc...@googlemail.com> wrote:

On 3 July, 18:17, Yarko Tymciurak <yark...@gmail.com> wrote:
> My spreadsheet.tar is 65798 bytes;

Same here with fresh download (correct .w2p extension now)

> Here are some checksums:
> $ ls -l sp*
> -rw-rw-r--. 1 yak007 yak007 65798 2009-07-02 22:09 spreadsheet.tar
> $ sha1sum spreadsheet.tar
> f0630cc59ea064783618cb5500fb65fc8b9c57cd  spreadsheet.tar
> $ sha256sum spreadsheet.tar
> b7cae50943cd5f8c02565b8be7b08bde003b4578a401b4afe83c28a4ca82d3f6
> spreadsheet.tar

I only have md5sum:
6b86730634305c8bf7729395177175bd *web2py.app.spreadsheet.w2p
looks like it matches:
    6b86730634305c8bf7729395177175bd  spreadsheet.w2p

I would grab a fresh web2py perhaps... see if that works for you;

 

mdipierro

unread,
Jul 3, 2009, 4:40:11 PM7/3/09
to web2py Web Framework
sheet['cell_name'].size=4 # is the default. You will have to change it
for every cell or change it in sheet.py
Here is a much better index html that makes it look more like Excel:

{{extend 'layout.html'}}

<style>
/*

the code in this page is here just to provide an example
none of the css markup and script is required for the sheet to
function
it is required to make it look good and can be further customized

*/
.sheet td {
text-align: left;
vertical-align: top;
padding: 0 0 0 0;
border: 0 0 0 0;
spacing: 0 0 0 0;
}
.sheet input {
border: 0;
}
td.colhead, td.rowhead {
background-color: #bbbbbb;
padding-left: 5px;
padding-right: 5px;
}
td.rowhead {
width: 30px;
text-align: right;
}
</style>

<form>
<div class="sheet">
<table>
<tr>
<td class="colhead" id="selected_cell"></td>
<td colspan="{{=sheet.cols}}">
<input readonly id="formula" size="{{=6*sheet.cols}}px"/>
</td>
</tr>
<tr>
<td class="colhead"></td>
{{for c in xrange(sheet.cols):}}
<td class="colhead">c{{=c}}</td>
{{pass}}
</tr>
{{for r in xrange(sheet.rows):}}
<tr>
<td class="rowhead">r{{=r}}</td>
{{for c in xrange(sheet.cols):}}
<td class="cells">
{{=XML(sheet.nodes['r%sc%s'%(r,c)].xml())}}
</td>
{{pass}}
</tr>
{{pass}}
</table>
</div>
</form>

<script>
function update_formula(t) {
if(t) {
jQuery('#selected_cell').html(jQuery(t).attr('id'));
jQuery('#formula').val(jQuery(t).val());
} else {
jQuery('#selected_cell').html('');
jQuery('#formula').val('');
}
};
jQuery('.cells input').focus(function(){update_formula(this);});
jQuery('.cells input').keyup(function(){update_formula(this);});
jQuery('.cells input').blur(function(){update_formula(null);});
</script>



On Jul 3, 2:47 pm, Hans <johann.scheibelho...@easytouch-edv.com>
wrote:
> great stuff massimo!!!
>
> how can the size of the cells be adjusted? Basically I want wider
> cells.
>
> Thanks,
> Hans
>
> On Jul 3, 4:16 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > Do you need to embed an ajax spreadsheet in you app. Now you have it:
>
> >http://www.vimeo.com/5432441http://www.web2py.com/appliances/default/...

mdipierro

unread,
Jul 3, 2009, 4:40:27 PM7/3/09
to web2py Web Framework
I do not know. It is a problem with download.

mdipierro

unread,
Jul 3, 2009, 4:48:36 PM7/3/09
to web2py Web Framework
with that looks like this: http://www.web2py.com/examples/spreadsheet

mdipierro

unread,
Jul 3, 2009, 5:21:06 PM7/3/09
to web2py Web Framework
please download it again. The first version I posted had a security
issue.

Jonathan Lundell

unread,
Jul 3, 2009, 7:17:44 PM7/3/09
to web...@googlegroups.com
On Jul 3, 2009, at 1:48 PM, mdipierro wrote:

>
> with that looks like this: http://www.web2py.com/examples/spreadsheet

I'm new to the web2py game, so pardon me if this is a settled question.

I'm wondering whether you wouldn't want to try to do stuff like this
in an (x)html-compliant manner. Neither an empty <form> nor an empty
<style> is permitted, for example.

I realize that web2py isn't entirely compliant anyway, but might we
not work in the direction of compliance?

mdipierro

unread,
Jul 3, 2009, 7:55:43 PM7/3/09
to web2py Web Framework
Actually we try be compliant. whete is the empty form? there should
not be any.

Jonathan Lundell

unread,
Jul 3, 2009, 8:19:46 PM7/3/09
to web...@googlegroups.com
On Jul 3, 2009, at 4:55 PM, mdipierro wrote:

>
> Actually we try be compliant. whete is the empty form? there should
> not be any.

Here's the entire report: http://validator.w3.org/check?uri=http://www.web2py.com/examples/spreadsheet

Among other things, the <style> tag requires a valid type, and the
<form> tag requires a (non-empty) action.

mdipierro

unread,
Jul 3, 2009, 8:26:06 PM7/3/09
to web2py Web Framework
Thank you. I will fix this as soon as I have time although this is not
a priority since it is only an example app BUT if you find other
similar problems in admin or examples or welcome and could submit a
patch that would be excellent.

Massimo

On Jul 3, 7:19 pm, Jonathan Lundell <jlund...@pobox.com> wrote:
> On Jul 3, 2009, at 4:55 PM, mdipierro wrote:
>
>
>
> > Actually we try be compliant. whete is the empty form? there should
> > not be any.
>
> Here's the entire report:http://validator.w3.org/check?uri=http://www.web2py.com/examples/spre...

Jonathan Lundell

unread,
Jul 3, 2009, 8:33:46 PM7/3/09
to web...@googlegroups.com
On Jul 3, 2009, at 5:26 PM, mdipierro wrote:

> Thank you. I will fix this as soon as I have time although this is not
> a priority since it is only an example app BUT if you find other
> similar problems in admin or examples or welcome and could submit a
> patch that would be excellent.

Glad to.

Do you have an established format and procedure for patches?

Also, I note that the issue of the empty form action <form action="">
for self-submission came up on this list back in IIRC January of this
year. It's too bad it's not legal, since interpretation as self-
submission would be reasonable, and in fact all browsers so interpret
it. But it won't verify.

mdipierro

unread,
Jul 3, 2009, 9:00:59 PM7/3/09
to web2py Web Framework


On Jul 3, 7:33 pm, Jonathan Lundell <jlund...@pobox.com> wrote:
> On Jul 3, 2009, at 5:26 PM, mdipierro wrote:
>
> > Thank you. I will fix this as soon as I have time although this is not
> > a priority since it is only an example app BUT if you find other
> > similar problems in admin or examples or welcome and could submit a
> > patch that would be excellent.
>
> Glad to.
>
> Do you have an established format and procedure for patches?

I can summarize the procedure this way:
0) check on the mailing list that a patch is necessary
1) email me the patch to save time
2) you there is no action in 24 posted it on google code

Hans

unread,
Jul 4, 2009, 9:31:15 AM7/4/09
to web2py Web Framework
very nice!

how can a cell be made a drop down selection with values from db ?

mdipierro

unread,
Jul 4, 2009, 11:49:14 AM7/4/09
to web2py Web Framework
At this time you cannot do select/option. You would have to register
an onfocus event that opens a popup and when you select a value it
copies it in the cell and informs the sever. Doable in about 10 lines
of code but a bit tricky. If you do it let me know.

On Jul 4, 8:31 am, Hans <johann.scheibelho...@easytouch-edv.com>
wrote:

Hans

unread,
Jul 4, 2009, 12:46:44 PM7/4/09
to web2py Web Framework
That would work for me.
Unfortunately I don't know how to register an event nor do I know how
to open a popup.

mdipierro

unread,
Jul 4, 2009, 1:12:27 PM7/4/09
to web2py Web Framework
something like

<select id="myoptions" style="position: absolute">
...
</select>
<script>
$(document).ready(funciton(){$('#myoptions').hide();});
$('#r0c0').focus(function(){$('#myoptions').show();});
$('#r0c0').blur(function(){$('#myoptions').hide();});
$('#myoptions').change(function(){$('#r0c0').val($('#myoptions').val
()); $('#r0c0').keyup();}) // not sure about this one
</script>


On Jul 4, 11:46 am, Hans <johann.scheibelho...@easytouch-edv.com>
wrote:

Francois (Jersey)

unread,
Jul 6, 2009, 1:51:50 AM7/6/09
to web2py Web Framework
Try to install from the following link
http://www.web2py.com/appliances/default/download/app.source.abebe92ece83f899.73686565742e773270.w2p,
and I still have an error message, Unable to install application
"spreadsheet".

Am I the only one in this case?

Francois

Yarko Tymciurak

unread,
Jul 6, 2009, 2:31:13 AM7/6/09
to web...@googlegroups.com
I just copy / pasted the link below into the URL of the admin page and it installed as "testme" just fine with latest web2py.

Can you give more information?

Are you downloading the app first, then installing it from local disk?
Are you installing from the url?
What O/S?  What browser / version?
Which web2py version (source or compiled)?

Yarko Tymciurak

unread,
Jul 6, 2009, 2:59:34 AM7/6/09
to web...@googlegroups.com
oh - I just checked, and I was running web2py 1.65.0 on Firefox 3.5 on Fedora-11 / 64;

I grabbed a clean clone of web2py 1.65.1, and repeated - also worked fine

(NOTE:  we need to think about the repository:  it took forever to get a branch - the .bzr directory is now at 486MB, mostrly from the one pack (I presume holding revisions)....   Are we keeping the tar files in there too?  That would make this H U G E...

We should think about cleaning it up.   In essence, the *.w2p files are derived files, and as such (like the *.pyc files) should not be under version control.

Fran

unread,
Jul 6, 2009, 3:20:18 AM7/6/09
to web2py Web Framework
On Jul 6, 7:59 am, Yarko Tymciurak <yark...@gmail.com> wrote:
> (NOTE:  we need to think about the repository:  it took forever to get a
> branch - the .bzr directory is now at 486MB, mostrly from the one pack (I
> presume holding revisions)....   Are we keeping the tar files in there too?
> That would make this H U G E...
>
> We should think about cleaning it up.   In essence, the *.w2p files are
> derived files, and as such (like the *.pyc files) should not be under
> version control.

Big +1!

F

Hans Donner

unread,
Jul 6, 2009, 3:20:20 AM7/6/09
to web...@googlegroups.com
the is now also acting as a kind of distribution. We might need to
split that and have
- source develop
- source stable
- distribution dev
- distribution stable

Yarko Tymciurak

unread,
Jul 6, 2009, 4:05:20 AM7/6/09
to web...@googlegroups.com
Well, it's not a distribution... the various executables and tarballs are distribution.

A clean clone today is out of whack to be called a distribution.  Here's tonight's clean checkout: size (I skip all the relatively uninteresting stuff):

[yak007@thynken web2py]$ du -h clean*
....
396K    clean-clone/doc/source
632K    clean-clone/doc
....
1.3M    clean-clone/gluon/contrib
2.6M    clean-clone/gluon
....
1.9M    clean-clone/applications/admin
....
780K    clean-clone/applications/examples
...
380K    clean-clone/applications/spreadsheet
...
300K    clean-clone/applications/welcome
3.3M    clean-clone/applications
48K    clean-clone/scripts
4.0K    clean-clone/.bzr/checkout/lock
152K    clean-clone/.bzr/checkout
4.0K    clean-clone/.bzr/repository/lock
4.0K    clean-clone/.bzr/repository/obsolete_packs
4.0K    clean-clone/.bzr/repository/upload
4.6M    clean-clone/.bzr/repository/indices
481M    clean-clone/.bzr/repository/packs
486M    clean-clone/.bzr/repository
4.0K    clean-clone/.bzr/branch/lock
20K    clean-clone/.bzr/branch
4.0K    clean-clone/.bzr/branch-lock
486M    clean-clone/.bzr
495M    clean-clone
16K    clean-clone.examples.patch
[yak007@thynken web2py]$

How is it that "welcome" has become 380K?  Static (144K) and views (44k).

But that 481MB (.bzr/repository/packs) is in ONE FILE.

One good result of Hans' general suggestion is that the release will have far fewer revisions in it's "packs", and thus be a better candidate for otehrs to checkout and get started contributing from.  (We should think thru how we would use the repositories, see how other porjects have them setup).
Reply all
Reply to author
Forward
0 new messages