[Dev] Error using parcel view...

D. John Anderson john at osafoundation.org
Tue Apr 22 09:47:29 PDT 2003


Hi Jesse:

Here's the story on those _Rep* files: They automatically store
persisted objects. However, when you change the format of the data (i.e.
the object's data format), and read in an "old style" object into a "new
style" object, some of the new data isn't there! It's the same as the
classic "file format" problem you may have run into when you had to
manually write code that does the same thing the object store does.

To handle this problem in general, you should store a version in your
objects and when the object is loaded (when __setstate__ is called) you
should update the format of your object. See Application.__setstate__
for an example.

John

-----Original Message-----
From: dev-admin at osafoundation.org [mailto:dev-admin at osafoundation.org]
On Behalf Of Jesse David Andrews
Sent: Tuesday, April 22, 2003 9:03 AM
To: john at osafoundation.org; dev at osafoundation.org
Subject: Re: RE: [Dev] Error using parcel view...


That fixed it.  I wonder if this means I should remove the _Rep* files
every time I make changes . . .  Cannot wait to get home tonight to
write a weather parcel!

ja

-----Original Message-----
From: "D. John Anderson" <john at osafoundation.org>
To: <jdandr2 at uky.edu>, <dev at osafoundation.org>
Date: Tue, 22 Apr 2003 08:55:55 -0700
Subject: RE: [Dev] Error using parcel view...

Hi Jesse:

I took a quick look at your problem. I tried it on Windows, since my
Linux environment is being rebuilt, and it worked for me. From the
traceback it looks like the problem isn't with your parcel, but with the
contacts parcel getting a key.

I'd suggest that you try to delete your repository (those _Repository*
files in the Chandler directory) to make sure it doesn't have any
incompatible data types stored from a previous version of FooView you
had worked on.

I will try to get my Linux box build in a few days and try it there if
you are still having problems.

John Anderson

-----Original Message-----
From: dev-admin at osafoundation.org [mailto:dev-admin at osafoundation.org]
On Behalf Of Jesse David Andrews
Sent: Monday, April 21, 2003 6:41 PM
To: dev at osafoundation.org
Subject: [Dev] Error using parcel view...


First off THANKS!

Second sorry, there really isn't a list for general development (such as
people who want to code parcels), so I hope this is the proper location.

I tried to follow the ViewerParcel tutorial but putting the code:

#############
#__init__.py#
#############

parcelClass = "FooView.FooView"

############
#FooView.py#
############

from application.Application import app
from application.ViewerParcel import *
 
class FooView(ViewerParcel):
  def __init__(self):
    self.displayName = _('Foo')
                      
class wxFooView(wxViewerParcel):
  def OnInit(self):
    EVT_MENU(self, XRCID('FirstFooMenuItem'), self.OnFirstFoo)
 
  def OnFirstFoo(self, event):
    pass

#############
#FooView.xrc#
#############

<?xml version="1.0" encoding="ISO-8859-1"?>
<resource version="2.4.0.0">
    <object class="wxPanel" subclass="parcels.foo.FooView.wxFooView"
name="FooView">
    </object>
    <object class="wxMenu" name="ViewerParcelMenu">
      <label>ViewerParcel</label>
        <object class="wxMenuItem" name="FirstFooMenuItem">
          <label>First Foo</label>
        </object>
    </object>
</resource>

in the parcels/foo directory results in:
% ./Chandler.sh
Traceback (most recent call last):
  File "/home/jdandr2/code/Chandler_linux_0.1/application/SideBar.py",
line 248, in OnItemExpanding
    entry = self.__GetSideBarURLTreeEntry(fields,
self.model.sideBarURLTree)
  File "/home/jdandr2/code/Chandler_linux_0.1/application/SideBar.py",
line 317, in __GetSideBarURLTreeEntry
    return dict[fields[0]]
  File
"/home/jdandr2/code/Chandler_linux_0.1/lib/python2.3/UserDict.py", line
19, in __getitem__
    def __getitem__(self, key): return self.data[key]
KeyError: 'Contacts'
./Chandler.sh: line 2: 10481 Segmentation fault LD_LIBRARY_PATH=./lib
./bin/python Chandler.py

Any ideas???  I am disecting other parcels, but the wiki may need
updated unless it is a dumb mistake on my end.

Looks great.  I cannot wait to code parcels!

Jesse


_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Open Source Applications Foundation "Dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/dev





_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Open Source Applications Foundation "Dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/dev




More information about the Dev mailing list