[Zope-dev] Zope 2.2.0b4: Congrats on a job well done + Tips for upgrading

T.J. Mannos MannosTJ@slcc.edu
Thu, 13 Jul 2000 10:29:10 -0600


Hi, there,

I'd just like to announce that I've installed Zope 2.2.0b4 via CVS and done
a complete run-through of my site.  It seems to work flawlessly now, and
I've gone ahead and installed it on my main port for a trial period.  I hope
to launch the site using the final version of 2.2.0 (so hurry up,
developers!!)  :)

Anyway, upgrading wasn't without its problems, so let me share with you some
tips that will help those in my situation upgrade more successfully.  Note
that I've skipped some steps, with the assumption that since your upgrading
an existing Zope version, you already know how to install Zope.

Directories cited:
    Original installation:
        /usr/Zope-2.1.6
    Fresh install of 2.1.6 (for diff'ing changes I made in the python
modules):
        /temp/Zope-2.1.6
    New CVS install of Zope-2.2.0b4:
        /usr/local/Zope2 (I moved it to the /usr/local volume because I had
more space there).

Products installed:
    SQLSession
    SiteAccess
    TinyTable
    ZMySQLDA
    (your product list may vary)

FIRST, I like to hack the source a lot.  I have my own special comment tags,
such as <!--#c ... --> instead of <dtml-comment> ... </dtml-comment>, and I
have my own special <dtml-var> modifier, js_friendly, which quotes all
special characters so I can use them in JavaScript code.  On a tip from
Shane, I started using CVS to download the Zope source code so that it would
merge the changes made in each upgrades with the changes I've made to the
source.  (Do a search for "CVS" on Zope.org).  However, this was my first
CVS, so I still needed to bring over the changes I'd previously made.
So.......

    cd /usr/local/Zope2
    diff -rc /temp/Zope-2.1.6/lib/python /usr/Zope-2.1.6/lib/python
>MyChanges.diff
    patch -p3 <MyChanges.diff

    NOTE: Results may vary.

By the way, incase you don't want to mess around with CVS (or you're like me
and can't figure out how it works), the above commands should achieve the
same effect, although you might get a few failed hunks and have to fix them
manually.  If you don't modify the Zope source, you can skip this step.

SECOND, I had all my data, external methods, and installed products on my
old installation.  I didn't want to lose them.  Now, don't be tempted to
just copy all your Products over from the lib/python/Products folder.  Some
of them, such as SiteAccess and SQLSession, if you have them, WON'T WORK.
(Furthermore, they'll break your installation, and you won't even be able to
get to a management screen).  Here's what you do:

    1. Back up your new var directory (incase something goes terribly wrong)
and copy the old data over.
        cd /usr/local/Zope2
        mv var var.bak
        cp -R /usr/Zope-2.1.6/var .

    2. Copy your external methods over.
        cp -R /usr/Zope-2.1.6/Extensions

    3. Copy *some* (not all) of your Products over.
        cd lib/python/Products
        cp -R /usr/Zope-2.1.6/lib/python/Products/TinyTable .
        cp -R /usr/Zope-2.1.6/lib/python/Products/ZMySQLDA .

    4. Start Zope (you may have to modify the startup script and the
superuser password) and load the management interface.  Delete all your
SiteRoots and SQLSessions.  You'll have to re-create them.

    5. If you're like me, you created all your 2.1.6 objects using the
superuser account.  You can't do that in 2.2.0.  So, go to your acl_users
folder and create a new account having Manager and Owner privileges.

    6. Download and install new versions of SQLSession, SiteAccess, and
possibly ZMySQLDA, if you have it.
        (Be warned, though, you may have to re-create all of your database
connections and SQL methods!)

    7. Re-start Zope and log in as the new account you just created.  Take
ownership of your root directory.  (Click "Ownership" tab, then "Take
Ownership").

    8. Re-create your SQLSessions and SiteRoots.  Check your database folder
to make sure your SQL sessions are all intact.  (If not, you have no
sympathy from me.  I had to re-create all 40 of mine when I tried beta 2).

    9. Check for bugs -- I'm sure you'll find plenty!  If you're getting a
lot of Unauthorized errors using external methods, check all your external
methods and make sure each class has the property
"__allow_access_to_unprotected_subobjects__" set equal to "1".  For
instance, I had a bunch of simple objects created this way:

            class simpleClass:
                 pass

        Under 2.2, I had to do it this way:

            class simpleClass:
                __allow_access_to_unprotected_subobjects__=1
                 pass

THIRD, I'm waiting for the next release of Zope so that I can test out this
CVS feature.  I'm excited!  Upgrading is such a pain, and I'm hoping CVS can
help to automate that somewhat.  I'll let you know how it goes.  One very
wise thing to do before every CVS checkout, though, is a complete backup of
the Zope directory!  After four failed upgrades (including the alpha), I
don't want to take my chances.

Thanks, Zope developers, for an excellent product!
- T.J. Mannos
- Salt Lake Community College