$def with (change) $if change.author: $ who = '%s' % (change.author.key, change.author.displayname or change.author.key) $else: $ who = None $ doc = change.get_changes()[0] $if doc.type.key in ['/type/edition', '/type/work']: $ what = doc.title or doc.key $elif doc.type.key == '/type/author': $ what = doc.name or doc.key $else: $ what = doc.key $ what = '%s' % (doc.key, what[:100]) $ when = datestr(change.timestamp) $if doc.revision == 1: $ action = "created" $else: $ action = "updated" $if doc.revision == 1 and change.author and change.author.key == doc.key: $:who $_('opened a new Open Library account!') $elif who: $:who $action $:what $else: $:what was $action anonymously $when $if doc.type.key == '/type/delete': $var ignore = True