Anton's Blog
2008-12-03
Test post
Testing topics - why don't they show up in ScribeFire?
I've added some new topics to this blog, but the ScribeFire list doesn't show them. So I thought I'd see whether its being fed by the unique values in the catalog. So nothing to see here, move along please.
2008-11-05
First impressions of nginx with Plone
OMG! Where have you been all my life? It took 5 minutes!
# sudo apt-get install nginx
# sudo vi /etc/nginx/sites-available/default
Setting up a virtual host for Zope takes *5 lines*:
server {
server_name alt-option.net altoption;
location / {
proxy_pass http://127.0.0.1:8071/VirtualHostBase/http/altoption:80/foo/VirtualHostRoot/;
}
}
# sudo /etc/init.d/nginx start
Done! And the performance seems better - I got into this whole mess because I couldn't run buildout to set up a new plone3 instance at the same time as running zope/apache2 dovecot and postfix. But just managed to do it (so, anecdotal evidence only).
# sudo apt-get purge apache2 apache2-common
2008-10-05
If in doubt...
import pdb; pdb.set_trace()
bin/zopectl fg
r (return from current function)
n (next)
list (show where in the code you are)
c (continue)
Do it!
2008-06-18
One line search and replace with perl
perl -p -i -e 's/oldstring/newstring/g' `grep -ril oldstring *`There are more varieties available, but this one is definitely my favourite.
2008-03-16
Quills: Can't pickle objects in acquisition wrappers
2007-01-08
Rebuilding plone's catalog by walking the site's content
powered by performancing firefox
2006-12-16
Moodle installation docs
2006-10-30
Developing Plone Products Using Z3 Technologies
2006-10-23
Setting content dates
obj.setModificationDate(date)
obj.setCreationDate(date)
obj.setEffectiveDate(date)
obj.reindexObject()
So next, I just have to add it to the migration script I posted to this blog recently
powered by performancing firefox
2006-10-05
Graffletopia
http://graffletopia.com
2006-10-04
Migration script - thanks Andreas :)
- Add support for additional types
- Synchronise ownership, creation date, etc on copy
- Replace the local copy stuff with an XML-RPC invocation
Here's the script (in case I forget where I put it):
# a cp -r implementation for Plone (basic functionality)
import os
import transaction
srcDefault = '/OK/teaching/test/WS06'
destDefault = '/OK/teaching/test/ws06new'
typesD = {
'Folder' : 'Folder',
'File' : 'File',
'Document' : 'Document',
}
def _c(s):
try:
return unicode(s, 'iso-8859-15').encode('utf-8')
except:
return s
def createDirStructure(root, dest_path):
current = root
for id in [p for p in dest_path.split('/')[:-1] if p]:
o = getattr(current.aq_inner.aq_base, id, None)
if o is None:
current.invokeFactory('Folder', id=id)
current = current[id]
return current
def cloneTree(self, srcPath=srcDefault, destPath=destDefault):
src = self.restrictedTraverse(srcPath)
dest = self.restrictedTraverse(destPath)
root = self.restrictedTraverse('/')
unhandled = []
if len(dest.objectIds()) != 0:
raise RuntimeError('Destination folder must be empty')
for i, (path, obj) in enumerate(self.ZopeFind(src, search_sub=1)):
print '-'*80
portal_type = obj.portal_type
if not portal_type in typesD.keys():
print 'Omiting %s at %s' % (portal_type, path)
continue
rel_path = path.replace(srcPath, '')
dest_path = os.path.join(destDefault, rel_path)
print i, path, portal_type, obj.absolute_url(1), '->', dest_path
print 'Creator', obj.Creator()
destFolder = createDirStructure(root, dest_path)
destFolder.invokeFactory(typesD[portal_type], id=obj.getId())
newObj = destFolder[obj.getId()]
print 'New %s created at %s' % (typesD[portal_type], newObj.absolute_url(1))
# common fields
newObj.setTitle(_c(obj.Title()))
newObj.setDescription(_c(obj.Description()))
# newObj.setSubject(obj.Subject())
if portal_type == 'File':
newObj.setFile(str(obj.data))
elif portal_type == 'Document':
newObj.setText(_c(obj.text))
format = obj.text_format
if format == 'html':
newObj.setFormat('text/html')
elif format == 'plain':
newObj.setFormat('text/plain')
else:
newObj.setFormat('text/structured')
else:
unhandled.append((portal_type, path))
if i % 10 == 0:
transaction.commit(1)
print '='*80
print 'Unhandled objects'
for pt, path in unhandled:
print pt, path
print 'Finished'
return 'Finished'
2006-09-06
Plain Blue
A simple CSS & XHTML web template focusing on whitespace and its importance (from oswd.org)
How To Configure LDAP on Linux
There's a walkthrough here (http://www.howtoforge.com/linux_ldap_authentication) which describes the process of setting up LDAP on a linux box. Must try and get it working and test out PlonePAS with it :)