More About Plugins
Example Plugin
import sys, time def verify_installation(request): # No configuration parameters return 1 def cb_story(args): entry = args['entry'] time_tuple = entry['timetuple'] try: import datetime import US dt = datetime.datetime.fromtimestamp(entry['mtime'], US.Pacific) entry['w3cdate'] = dt.isoformat() except ImportError: pass try: import xml.utils.iso8601 tzoffset = time.timezone # if is_dst flag set, adjust for daylight savings time if time_tuple[8] == 1: tzoffset = time.altzone entry['w3cdate'] = xml.utils.iso8601.tostring(time.mktime(time_tuple),tzoffset) except ImportError: pass
Show how the $w3cdate variable is used in the gray story template.
[22:59] | [] | #-permalink-#