Skip to content. | Skip to navigation

Personal tools
Log in
Sections
You are here: Home Posts Plone Posts

Site News

Plone 4 Upgrade

by Nathan Van Gheem last modified May 15, 2010 05:40 PM
Thoughts on moving the server to Plone 4.

Last night I decided to take some time to move this site over to Plone 4. The repoze.zope2 build I had previously was buggy and I am starting to dislike Deliverance a bit.

Snags

  • the search didn't work because of this migration issue http://dev.plone.org/plone/ticket/10360
  • old file types aren't migrated to blob http://dev.plone.org/plone/ticket/10365
  • archetypes don't want to use the new add views--should probably report this
  • If you have the jquery UI package installed, it'll mess with some of Plone's JS for some reason--I just disabled it.
  • some other control panel entries and menu items were not fully migrated, still pointing to old templates

 

Benefits

  • FAST--running this on a linode with 512MB of ram. 2 zeo clients and with CacheSetup, this thing is very fast. Much faster than Plone 3.
  • Just more polished than Plone 3--with usability enhancements and a new theme, it's great.
  • I haven't found a product that wasn't compatible with Plone 4 yet--although, sometimes I needed to do some digging or use an svn checkout to get the compatible version

 

Using the zope debug console

by Nathan Van Gheem last modified Dec 22, 2010 06:10 PM
A short howto on using the zope debug console.

First off, go into your instance directory and issue a command like this,

./bin/instance debug

Things to Note

  • "app" is the zope root
  • You can access your Plone instances and other objects just by issuing the normal ways for traversing objects.  For instance,
    app.Plone
    app['Plone']

Login as user

from AccessControl.SecurityManagement import newSecurityManager
user = app.acl_users.getUser(user_name_or_id)
newSecurityManager(None, user.__of__(app.acl_users))

Editing Objects

So what do you do if you want to edit objects and make the changes persist?  Pretty much just treat objects like you'd normal do in a python script.  Just when you're done, make sure you issue the following commands.

import transaction
transaction.commit()
app._p_jar.sync()

Automatically Pack The ZODB

by Nathan Van Gheem last modified Dec 22, 2010 06:08 PM
This just goes over how you can automatically have the ZODB packed once a day. Does not use a cron job either.
  • Add Products.ClockServer to your egg section in buildout.cfg
  • Add something like this in your instance section
    zope-conf-additional = 
        <clock-server>
          method /pack_it_all
          period 86400
          user admin
          password password
          host localhost
       </clock-server>  
    
  • Re-run buildout
  • Start server
  • In the root of zope, create a "Script(Python)" with the id of "pack_it_all"
  • To the contents, add something like this,
    dbs=context.Control_Panel.Database
    names = dbs.getDatabaseNames()
    
    for name in names:
      if name != 'temporary':
        dbs[name].manage_pack(days=3)
        print "packed %s" % name
    
    return printed
  • This will pack all the databases you have in Zope once a day

Backing Up Plone

by Nathan Van Gheem last modified Dec 22, 2010 06:08 PM
Simple reference for backing up plone...

Installation

  • apt-get install rsync

Create SSH Keys

backup file

#!/bin/sh

#
# ZODB
#

PYTHON_DIR=/home/plone/Plone-3.1/Python-2.4/bin/python
REPOZO_FILE=/home/plone/Plone-3.1/zinstance/bin/repozo
ZODB_FILE=/home/plone/Plone-3.1/zinstance/var/filestorage/Data.fs

REMOTE_USER=nathan
REMOTE_HOST=76.222.67.149
REMOTE_PATH=/home/nathan/plonebackups/linode/datafs
LOCAL_PATH=/home/plone/Plone-3.1/zinstance/backups/

echo "backing up plone zodb"
$PYTHON_DIR $REPOZO_FILE -Bvz -r $LOCAL_PATH -f $ZODB_FILE
echo "using rsync to backup to home server"
rsync --delete -azvv -e ssh $LOCAL_PATH $REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH
echo "completed successfully"

#
# BUILDOUT
#
LOCAL_BUILDOUT=/home/plone/Plone-3.1/zinstance/buildout.cfg
REMOTE_BUILDOUT=/home/nathan/plonebackups/linode/settings/buildout.cfg

echo "backing up buildout"
rsync --delete -azvv -e ssh $LOCAL_BUILDOUT $REMOTE_USER@$REMOTE_HOST:$REMOTE_BUILDOUT

#
# PRODUCTS
#
LOCAL_PRODUCTS=/home/plone/Plone-3.1/zinstance/products
REMOTE_PRODUCTS=/home/nathan/plonebackups/linode/products

echo "backing up products"
rsync --delete -azvv -e ssh $LOCAL_PRODUCTS $REMOTE_USER@$REMOTE_HOST:$REMOTE_PRODUCTS

#
# eggs
#
LOCAL_EGGS=/home/plone/Plone-3.1/buildout-cache/eggs
REMOTE_EGGS=/home/nathan/plonebackups/linode/eggs

echo "backing up eggs"
rsync --delete -azvv -e ssh $LOCAL_EGGS $REMOTE_USER@$REMOTE_HOST:$REMOTE_EGGS

 

Cron Jobs

  • crontab -e
  • 0 3 * * * sh /path/to/script

Use Custom Fields in Smart Folders Plone 2.5

by Nathan Van Gheem last modified Sep 24, 2011 03:46 PM
This shows how you can add new columns/fields to sort by and retrieve in your smart folders for new content types. This is useful if you have custom content types that you want to still use smart folders with.

Content Type

You'll need to make changes to the fields in your content type.

StringField('firstName',
    widget=StringWidget(
        label="First Name",
    ),
    index='FieldIndex:schema',
);

The part in bold is what you'll need to do for your field in the content type.

Site Setup

Next you'll need to specify in site setup of your plone instance that you want smart folders to use it.

  1. Go to site setup
  2. Click "Smart Folder Settings"
  3. Select "smart folder metadata" tab
  4. Click "all fields"
  5. Find the field you just added and give it a new name(by default it uses its getter name)
  6. Save

AddFieldSmartFolder

 

Navigation