Personal tools
You are here: Home Weblog Categories Web publishing
« March 2010 »
Su Mo Tu We Th Fr Sa
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
About this blog
Jonathan's weblog
Recent entries
Multilingual Faculty/Staff Directory jonathan_lewis 2010-01-25
SVN for social scientists jonathan_lewis 2009-12-08
Working on the Global Studies Consortium website jonathan_lewis 2009-12-08
Plagiarism detection jonathan_lewis 2009-11-20
Fujitsu moving into SAAS jonathan_lewis 2009-04-04
Recent comments
Re:Goodnight, And Good Luck aasenjo 2006-05-16
Re:Hanging out in Tønsberg aasenjo 2006-04-24
 
Document Actions

Web publishing

Up one level
Mostly related to Zope and Plone

Document Actions

Moving my blog to Plone

by jonathan posted at 2005-12-10 08:02 last modified 2005-12-10 08:08

All being well, I shall be writing my weblog here from now on.

All being even better, I shall be able to import previous entries from the Zope-only version of Coreblog.

And the world would be perfect if I would then actually write some  every once in a while.

Category(s)
Web publishing
The URL to Trackback this entry is:
http://www.lewis.soc.hit-u.ac.jp/weblog/moving-my-blog-to-plone/tbping

Getting PIL to work on MacOS X

by jonathan posted at 2006-01-06 23:49 last modified 2006-01-27 00:42

(Updated for Plone 2.1.2 while attending the Plone Kenkyukai in Yurakucho)

Many people running Plone on MacOS X seem to have difficulties installing the Python Imaging Library (PIL). Plone 2.1 by default calls PIL to display uploaded pictures at an appropriate size, so it's definitely worth installing.


Here's what I did to get it working, including installation of Python, Zope and Plone (on my local server for now, I expect on this production server when I go to the university next week).


1. Environment: MacOS X 10.4.4 (with XTools 2), Fink 0.8.0 and FinkCommander 0.5.4.  The aim is to install Python 2.3.5, Zope 2.8.5-final and Plone 2.1.2 with PIL

2. Create a folder for Python and Zope e.g. /Applications/Zope In the following this folder is referred to as $INSTALLDIR


3. Install Python

    - [ ] Download Python 2.3.5, expand into a temporary folder
- [ ] change the configure script as follows (This if from a useful page by Marc Petitmermet)
          problem: python-2.3.5 does not correctly compile
          out-of-the-box on Tiger
          because it does not recognize 10.4 which is "Darwin 8.0.0".
          fix: add "Darwin/8*" in the configure script to the following
          lines (tip from fink):
          line 1501: FreeBSD/4.8* | Darwin/6* | Darwin/8* )
          line 13360: SunOS/5.8 | Darwin/8* )
- [ ] create folder $INSTALLDIR/Python
- [ ] create folder $INSTALLDIR/Python/Python-2.3.5
- [ ] cd to the temporary folder and do the following commands
    - [ ] ./configure --prefix=$INSTALLDIR/Python/Python-2.3.5
    - [ ] make
    - [ ] sudo make install

4. Set up PIL

- [ ] in FinkCommander, select libjpeg and click Install Binary Packages
- [ ] Download Imaging-1.1.5  from the Python Imaging Library page and expand to a temporary folder; then cd to
      that folder
- [ ] in setup.py of Imaging-1.1.5, change JPEG_ROOT = None to
      JPEG_ROOT = libinclude("/sw/lib") (this tells setup.py to use the libjpeg files just installed with FinkCommander)
    - [ ] $INSTALLDIR/Python/Python-2.3.5/bin/python setup.py build_ext  -i
    - [ ] $INSTALLDIR/Python/Python-2.3.5/bin/python selftest.py
        - [ ] make sure all 55 tests are passed
    - [ ] sudo $INSTALLDIR/Python/Python-2.3.5/bin/python setup.py install

5. Set up Zope 2.8.5-final (using the Python we just installed)

- [ ] expand Zope-2.8.5-final to a temporary folder and cd to that
      folder
- [ ] ./configure --prefix=$INSTALLDIR/Zope-2.8.5-final --with-python=$INSTALLDIR/Python/Python-2.3.5/bin/python

(this creates a Zope-2.8.5-final folder inside the $INSTALLDIR folder

- [ ] make
- [ ] sudo make install
- [ ] i did the following because they were in mpetit's compilation
      instructions linked to above
    - [ ] cd $INSTALLDIR/Zope/Zope-2.8.5-final/bin
    - [ ] sudo rm python
    - [ ] sudo ln -s ../../Python/Python-2.3.5/bin/python python
- [ ] Create an instance; run:
    - [ ] /Applications/Zope/Zope-2.8.5-final/bin/mkzopeinstance.py
- [ ] and enter the instance home e.g.:
    - [ ] /Users/jonathan/Documents/Zope285Instances/Test212-1

6. Set up Plone 2.1.2

- [ ] Expand Plone-2.1.2 and drag all the contents to the Products
      folder in the new instance home
- [ ] Starts up OK; add a Plone site and view

7. Test PIL; try to add an image
    - [ ] should display a thumbnail that you can click for a
          full-sized image, and do rotation and other PIL tricks.

Category(s)
Web publishing
The URL to Trackback this entry is:
http://www.lewis.soc.hit-u.ac.jp/weblog/a-bitter-pil/tbping

First entry from new computer

by jonathan posted at 2006-01-13 23:57 last modified 2006-01-13 23:57

I have got my hands on Panasonic's smallest notebook computer, a Let's Note CF-R4. Although the keyboard is at the limit of my fat fingers' typing ability, almost everything else so far has been very positive. The only poor thing is the documentation, which seems designed to dissipate the user's excitement at getting a new machine. You have, for example, to read a page about the danger of having data stolen from the hard disk of a discarded computer, which finishes with a recommendation to take a strong magnet and/or a crowbar to your computer.

The next challenge is to install Linux.

Category(s)
Web publishing
The URL to Trackback this entry is:
http://www.lewis.soc.hit-u.ac.jp/weblog/first-entry-from-new-computer/tbping

Multilingual code documentation

by jonathan posted at 2006-03-17 02:33 last modified 2006-04-03 21:19

This morning I walked with Maho to the Japanese Cultural Centre in order to pick up a letter of introduction for her to the National Archives of India. I left her at the entrance to the Archives and came back to the hotel to continue working on tomorrow's lecture.

Thinking again about the Plone sprint two weekends ago, I think there is a need for computer code documentation to be made multilingual. At the moment user interfaces are multilingual, but anyone who wants to read code or write it is assumed to be able to use English. Of course it's cool if the programmer does read English, but a lot of people can't. So if comments could be written in whichever language and then a programme such as i18ndude could prepare comments for translation, code itself could be made much more accessible. It would encourage more users to read code, and more coders to publish their code in the confidence that someone else can  translate it into English for them.

I'd be surprised if somebody isn't already working on this. Or perhaps there's a good reason why they aren't.

Category(s)
Web publishing
The URL to Trackback this entry is:
http://www.lewis.soc.hit-u.ac.jp/weblog/day2inIndia/tbping

Softlinking to products in Zope or Plone

by jonathan posted at 2006-03-31 15:35 last modified 2006-04-03 21:18
In order to avoid proliferating copies of product folders, a particular danger when developing a product and testing it on a number of instances, it's convenient to create a folder containing softlinks or symlinks to a single product folder somewhere on the hard disk.

(This is for MacOS X 10.4.5. And no, just making an alias of the whole product folder didn't work.)

Say, for example, that the actual files for a product MyProduct are in a folder at /Users/someuser/Documents/ProductDev/MyProduct

We want to use this product in a Zope instance at /Users/someuser/Documents/MyZopeInstance

Create a normal, empty folder MyProduct inside the Products folder inside the MyZopeInstance folder

In Terminal do:

ln -fs /Users/someuser/Documents/ProductDev/MyProduct/* /Users/someuser/Documents/MyZopeInstance/Products/MyProduct

However, ArchGenXML rewrites files with every build, breaking the symlinks. I therefore have two Terminal windows open when I'm using ArchGenXML, one for the archgenxml command and one for the ln command. I just have to hit up-arrow then enter to repeat the archgenxml command, then hit up-arrow and enter in the ln command window.

Doubtless there are much smarter solutions, but these work for me.



Category(s)
Web publishing
The URL to Trackback this entry is:
http://www.lewis.soc.hit-u.ac.jp/weblog/2006-03-31/tbping

Setting the view action using ArchGenXML

by jonathan posted at 2006-04-02 15:52 last modified 2006-04-03 21:17

Having made a Plone product using ArchGenXML, it wasn't clear to me how to get Plone to display objects using a view of my own creation rather than the default list of all the fields. The excellent Tutorial says "To create a method in your class, add a method to the UML diagram, with the desired parameters." and "ArchGenXML can generate actions and forms for you: Just define a method without any parameters and set its stereotype to one of the following three: <<action>>... <<view>>... <<form>>"

I didn't know how to add a method to my UML diagram. Finally, I found some class notes for a compsci class at UBC in Canada which told me to add a new operation to the bottom compartment of the class box containing my class. It looks a bit messy (see the two screenshots of the UML diagram in Poseidon) but ArchGenXML does generate the desired code i.e.

    actions =  (


       {'action': "string:${object_url}/cner_event_view",
        'category': "object",
        'id': 'view',
        'name': 'View',
        'permissions': (CMFCorePermissions.View,),
        'condition': 'python:1'
       },


    )

adding view action 1
adding view action 2

Category(s)
Web publishing
The URL to Trackback this entry is:
http://www.lewis.soc.hit-u.ac.jp/weblog/2006-04-02/tbping

Using multilingual vocabularies in Plone

by jonathan posted at 2006-04-03 21:16 last modified 2006-04-03 21:17

In the process of rebuilding the Centre for New European Research website I have been recreating an event product using ArchGenXML and ATVocabularyManager (atvm).  Atvm has worked spendidly  as far as  adding and editing  vocabularies and entries in different languages is concerned, but I couldn't find any documentation on how to display vocabulary entries in page templates. Due perhaps to beginner's luck rather than a correct understanding of the atvm code, I have got display to work. In the absence of a more authoritative statement on the correct way to display vocabulary items in a multilingual Plone site, here's what I do.

(My setup: Plone 2.1.2, LinguaPlone 0.9, ATVocabularyManager  1.0.0-beta2.)

I've created a product with a string field "city" whose vocabulary is selected from an atvm simple vocabulary called "cities". The atvm vocabulary has been translated into German, then each of the vocabulary items has been translated.


Now to display the field I have written the following accessor, with comments denoting what data gets returned from each line.

def formattedCity(self):
    if hasattr(self, 'city'):
        this_object =  self.city
        # returns "tokyo"
        if this_object != "": # we get an error if it's empty
            vocab_tool = getToolByName(self, 'portal_vocabularies')
            vocab=vocab_tool.getVocabularyByName("cities")
            # returns "<SimpleVocabulary at cities>"
            vocabdict = vocab.getVocabularyDict(self)
            # returns {'tokyo': 'Tokyo'} if getLanguage='en'
            # returns {'tokyo': 'Tokio'} if getLanguage='de'
            return vocabdict[this_object]
            # returns "Tokyo" if getLanguage='en'
            # returns "Tokio" if getLanguage='de'
        else:
            return ""
    else:
        return ""
One must remember to add "from Products.CMFCore.utils import getToolByName" in the module-header of the class file (cnerEvent.py in my case). In many cases one will want to set the field's LanguageIndependent attribute to True; this ensures that by selecting the data in the canonical (original) version it appears correctly translated in all translations.

Category(s)
Web publishing
The URL to Trackback this entry is:
http://www.lewis.soc.hit-u.ac.jp/weblog/2006-04-03/tbping

Better automatic URLs for Japanese pages

by jonathan posted at 2006-04-10 12:05 last modified 2006-04-10 12:05

A recent version of Plone introduced automatic generation of URLs, replacing the previous ugly numerical URLs with ones generated out of the object's title. This is good for English—as long as the title isn't too long, in which case it can be trimmed manually—but results in URLs for Japanese, Arabic and other non-romaji languages that are even uglier than those generated in previous versions.

It might be worth using Kakasi, a simple program for transliterating kanji and kana into roman characters, to create better URLs for Japanese objects.

Should be a fun project one evening...
Category(s)
Web publishing
The URL to Trackback this entry is:
http://www.lewis.soc.hit-u.ac.jp/weblog/2005-04-04/tbping

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: