Changesets can be listed by changeset number.
The Git repository is here.
Changeset 145
Updated to place public components in 'public' folder. The script
has been extended with various new configuration options and a new
configuration file added. Designed to be integrated with RCVSweb
from Changeset #144.
- Comitted by: adh
- Date: Tuesday November 14 22:39:56 2006 (over 17 years ago)
Affected files:
- rool/python/cvslog2web/trunk/public/Atom.css (from rool/python/cvslog2web/trunk/Atom.css:143)
- rool/python/cvslog2web/trunk/public/atom_feed.png (from rool/python/cvslog2web/trunk/atom_feed.png:143)
- rool/python/cvslog2web/trunk/public/cvslog2web.css (from rool/python/cvslog2web/trunk/cvslog2web.css:143)
- rool/python/cvslog2web/trunk/public/feed_icon.png (from rool/python/cvslog2web/trunk/feed_icon.png:143)
- rool/python/cvslog2web/trunk/public/nav_next.gif (from rool/python/cvslog2web/trunk/nav_next.gif:143)
- rool/python/cvslog2web/trunk/public/nav_prev.gif (from rool/python/cvslog2web/trunk/nav_prev.gif:143)
- rool/python/cvslog2web/trunk/config.py
- rool/python/cvslog2web/trunk/cvslog2web.py (diff)
rool/python/cvslog2web/trunk/cvslog2web.py:
prev. | current | |
1 | ||
1 | #!/bin/env python | |
# cvslog2web by Ethan Tira-Thompson | ||
# Released under the GPL (http://www.gnu.org/copyleft/gpl.html) | ||
... | ... | |
HTMLOUT_MESSAGE=True # set to False to skip the log body | ||
HTMLOUT_FILELIST=True # set to False to skip the file list (also skipped if ENTRYTITLE==TITLE_FILE_LIST ) | ||
HTMLOUT_MAXHISTORY=10 | ||
145 | # Prefix author list with the given string in a nested SPAN of class | |
146 | # 'cvslog2web_authorsprefix' and don't use brackets around names? | |
147 | # Works best if CSS drops Authors span onto separate line, e.g. | |
148 | # by setting 'display: block'. If the string is empty, uses brackets | |
149 | # around the comma-separated names with no prefix span. | |
150 | HTMLOUT_AUTHORSPREFIX="" | |
151 | # HTMLOUT_ORDER allows you to define the order of items in the summary | |
152 | HO_TITLE,HO_AUTHORS,HO_TIMESTAMP,HO_MESSAGE,HO_FILELIST=range(5) | |
153 | HTMLOUT_ORDER=[HO_TITLE,HO_AUTHORS,HO_MESSAGE,HO_FILELIST] | |
154 | # Timestamp format if the HL_TIMESTAMP section is included (see above) | |
155 | # according to 'strftime'. A space and a timezone indication is always | |
156 | # appended to the string regardless of format; avoid '%Z' in the string. | |
157 | HTMLOUT_TIMESTAMPFORMAT="%a. %B %d, %Y at %I:%M:%S %p" | |
158 | # Optional prefix string, under class 'cvslog2web_timestampprefix' within | |
159 | # the timestamp DIV. | |
160 | HTMLOUT_TIMESTAMPPREFIX="Commited " | |
161 | # Outer encapsulating DIV class for each entry in the list | |
162 | HTMLOUT_OUTERCLASS="cvslog2web_entry" | |
# This will be used as the 'target' attribute for all links on the page. | ||
# (Handy if using the HTML output within a frame on your site, and you want the | ||
... | ... | |
# Put any directory structure in PERMALINK_STRUCTURE, not here | ||
# Only fill this in if you are specifying an absolute URL (i.e. starts with http://) | ||
PERMALINK_URL_PREFIX="" | ||
176 | # Prefix for images; normally they reside in the same place as the permalinks | |
177 | PERMALINK_IMG_PREFIX=PERMALINK_URL_PREFIX | |
# strftime format string for permalink files -- can spread among subdirs with '/' | ||
# In a post-processing stage, microseconds are available via '%%(us)d' (with normal printf-style formatting, e.g. %%(us)06d) | ||
PERMALINK_STRUCTURE="commits/%Y/%m/commit-%d-%H-%M-%S-%%(us)06d.html" | ||
... | ... | |
# If it starts with any other character it is escaped as plain text. It is | ||
# not possible to have incomplete tags which span built-in elements. | ||
PERMALINK_ORDER.insert(0,"<h1><a href=\""+FEEDHOMELINK+"\">Visit Project Homepage</a></h1>") | ||
198 | # As with HTMLOUT_STANDALONE - should permalink pages be full HTML documents | |
199 | # or just fragments for inclusion in a wider page template? | |
200 | PERMALINK_STANDALONE=True | |
201 | # No JavaScript in Permalink pages - standard HTML links cover most cases but | |
202 | # an onClick attribute directing the window location to the same URL is added | |
203 | # for "belt and braces", unless overridden. | |
204 | PERMALINK_ADDJS=True | |
205 | # Outer encapsulating class for each permalink file's main content | |
206 | PERMALINK_OUTERCLASS="cvslog2web_entry" | |
207 | # If defined as an array of three strings, each string is taken to be the URL | |
208 | # of an image to use in place of the "A" (first array entry), "M" (second array | |
209 | # entry) and "R" (third and last array entry) letters, which indicate where files | |
210 | # are added, modified or removed respectively in permalink pages. If an empty | |
211 | # array, the letters are used. | |
212 | PERMALINK_STATUSICONS=[] | |
################ LOAD EXTERNAL ################ | ||
# load overrides from optional external configuration file (if specified) | ||
... | ... | |
################################################################################ | ||
################ INPUT PARSING ################ | ||
################################################################################ | ||
217 | ||
252 | # You don't want to change much below here... | |
# It's icky code from here on out. | ||
import re, pickle, time, datetime, pwd | ||
... | ... | |
else: | ||
# args (set from command line) is a string with a series of filename,oldvers,newvers values | ||
# this regular expression parses the string into a list of tuples | ||
269 | | |
304 | # This RE is smart enough to handle filenames with spaces or commas in them! | |
files=re.findall("(.*?),([0-9.]+|NONE),([0-9.]+|NONE) "," ".join(args)+" ") | ||
imported=False | ||
... | ... | |
else: | ||
t=GHOST | ||
return (ov,nv,t) | ||
439 | | |
474 | ||
for k,v in paths.iteritems(): | ||
if history[0][PATH].setdefault(k,v)!=v: | ||
history[0][PATH][k]=merge(history[0][PATH][k],v) | ||
history[0][TIMESTAMP]=curtime_str | ||
history[0][AUTHORS][user]=CONTACT.get(user,(user_name,user+"@"+DOMAIN)) | ||
445 | | |
480 | ||
else: # push paths as a new entry on its own | ||
authors={user:CONTACT.get(user,(user,user+"@"+DOMAIN))} | ||
history.insert(0,[paths,curtime,curtime_str,authors,message,importedFiles,importedTag]) | ||
... | ... | |
doc.insertBefore(doc.createProcessingInstruction("xml-stylesheet",'href="Atom.css" type="text/css"'),feed) | ||
feed.setAttribute("xmlns","http://www.w3.org/2005/Atom") | ||
feed.appendChild(doc.createTextNode("\n")) | ||
619 | | |
654 | ||
# feed header tags | ||
appendTextualTag(feed,"id",FEEDID) | ||
appendTextualTag(feed,"title",FEEDTITLE) | ||
... | ... | |
generator.setAttribute("version",SCRIPT_VERSION) | ||
generator.appendChild(doc.createTextNode("cvslog2web")) | ||
feed.appendChild(doc.createTextNode("\n")) | ||
645 | | |
680 | ||
for (entry,files,links) in zip(history,histFiles,histLinks)[:FEED_MAXHISTORY]: | ||
msg=entry[MESSAGE].splitlines() | ||
... | ... | |
else: | ||
linknode.setAttribute("href",(VIEWLINKFORMAT % l).replace(" ","%20")) | ||
linknode.setAttribute("type","text/html") | ||
684 | | |
719 | ||
# CONTENT section | ||
content=node.appendChild(doc.createElement("content")) | ||
content.setAttribute("type","xhtml") | ||
... | ... | |
continue | ||
appendTextualTag(content,"div",m).setAttribute("style","padding:.25em 0;") | ||
# End of message embedding | ||
696 | | |
731 | ||
#now add links to content | ||
filelist=content.appendChild(doc.createElement("div")) | ||
if len(msg)>1: | ||
... | ... | |
diffs.appendChild(doc.createTextNode("}")) | ||
firstSet=False | ||
filelist.appendChild(doc.createTextNode("\n")) | ||
727 | | |
762 | ||
#end of content | ||
node.appendChild(doc.createTextNode("\n")) | ||
730 | | |
765 | ||
f=open(FEEDOUT,"wb") | ||
doc.writexml(f) | ||
f.close() | ||
... | ... | |
rootdiv.setAttribute("class","cvslog2web_index") | ||
else: | ||
doc,rootdiv=HTMLHeader(dom,HTMLTITLE,HTMLOUT_CSS,"cvslog2web_index") | ||
815 | | |
850 | ||
for (entry,files,links) in zip(history,histFiles,histLinks)[:HTMLOUT_MAXHISTORY]: | ||
msg=entry[MESSAGE].splitlines() | ||
# entry header tags | ||
node=rootdiv.appendChild(doc.createElement("div")) | ||
821 | | |
856 | node.setAttribute("class",HTMLOUT_OUTERCLASS) | |
node.appendChild(doc.createTextNode("\n")) | ||
823 | | |
824 | | |
825 | | |
826 | | |
827 | | |
828 | | |
829 | | |
830 | | |
831 | | |
832 | | |
833 | | |
834 | | |
835 | | |
836 | | |
837 | | |
838 | | |
839 | | |
840 | | |
841 | | |
842 | | |
843 | | |
844 | | |
845 | | |
846 | | |
847 | | |
848 | | |
849 | | |
850 | | |
851 | | |
852 | | |
853 | | |
854 | | |
855 | | |
856 | | |
857 | | |
858 | | |
859 | | |
860 | | |
861 | | |
862 | | |
858 | ||
859 | for section in HTMLOUT_ORDER: | |
860 | if section==HO_TITLE: | |
861 | # Title section | |
862 | titlenode=node.appendChild(doc.createElement("div")) | |
863 | titlenode.setAttribute("class","cvslog2web_title") | |
864 | if PERMALINKDIR: | |
865 | a=appendTextualTag(titlenode,"a",HTMLOUT_ENTRYPREFIX) | |
866 | if HTMLOUT_TARGET: | |
867 | a.setAttribute("target",HTMLOUT_TARGET) | |
868 | a.setAttribute("href",genPermalink(entry[DATETIME])) | |
869 | if ENTRYTITLE==TITLE_MESSAGE_FIRST_LINE and len(msg)>0: appendTextualTag(a,"span",msg[0]).setAttribute("class","cvslog2web_message") | |
870 | elif ENTRYTITLE==TITLE_FILE_LIST or len(msg)==0: appendTextualTag(a,"span",files).setAttribute("class","cvslog2web_filelist") | |
871 | else: sys.exit("cvslog2web: bad ENTRYTITLE setting") | |
872 | else: | |
873 | titlenode.appendChild(doc.createTextNode(HTMLOUT_ENTRYPREFIX)) | |
874 | if ENTRYTITLE==TITLE_MESSAGE_FIRST_LINE: appendTextualTag(titlenode,"span",msg[0]).setAttribute("class","cvslog2web_message") | |
875 | elif ENTRYTITLE==TITLE_FILE_LIST: appendTextualTag(titlenode,"span",files).setAttribute("class","cvslog2web_filelist") | |
876 | else: sys.exit("cvslog2web: bad ENTRYTITLE setting") | |
877 | titlenode.appendChild(doc.createTextNode(" ")) | |
878 | ||
879 | elif section==HO_AUTHORS: | |
880 | # Authors section | |
881 | authors=titlenode.appendChild(doc.createElement("span")) | |
882 | authors.setAttribute("class","cvslog2web_authors") | |
883 | if HTMLOUT_AUTHORSPREFIX: | |
884 | authorsprefix=authors.appendChild(doc.createElement("span")) | |
885 | authorsprefix.setAttribute("class","cvslog2web_authorsprefix") | |
886 | authorsprefix.appendChild(doc.createTextNode(HTMLOUT_AUTHORSPREFIX)) | |
887 | authors.appendChild(doc.createTextNode(",".join([k for k,n in entry[AUTHORS].iteritems()]))) | |
888 | else: | |
889 | authors.appendChild(doc.createTextNode("("+",".join([k for k,n in entry[AUTHORS].iteritems()])+")")) | |
890 | ||
891 | elif section==HO_TIMESTAMP: | |
892 | # Commit date and time | |
893 | if time.daylight: | |
894 | t=entry[DATETIME]-datetime.timedelta(seconds=time.altzone) | |
895 | tz=time.tzname[1] | |
896 | else: | |
897 | t=entry[DATETIME]-datetime.timedelta(seconds=time.timezone) | |
898 | tz=time.tzname[0] | |
899 | timestampstr=t.strftime(HTMLOUT_TIMESTAMPFORMAT+" "+tz) | |
900 | timestamp=node.appendChild(doc.createElement("div")) | |
901 | timestamp.setAttribute("class","cvslog2web_timestamp") | |
902 | if HTMLOUT_TIMESTAMPPREFIX: | |
903 | timestampprefix=timestamp.appendChild(doc.createElement("span")) | |
904 | timestampprefix.setAttribute("class","cvslog2web_timestampprefix") | |
905 | timestampprefix.appendChild(doc.createTextNode(HTMLOUT_TIMESTAMPPREFIX)) | |
906 | timestamp.appendChild(doc.createTextNode(timestampstr)) | |
907 | ||
908 | elif section==HO_MESSAGE: | |
909 | # Content section | |
910 | if HTMLOUT_MESSAGE: | |
911 | content=node.appendChild(doc.createElement("div")) | |
912 | content.setAttribute("class","cvslog2web_message") | |
913 | content.appendChild(doc.createTextNode("\n")) | |
914 | for i,m in enumerate(msg): | |
915 | if i==0 and ENTRYTITLE==TITLE_MESSAGE_FIRST_LINE and (REPEAT_FIRST_LINE==REPEAT_NEVER or REPEAT_FIRST_LINE==REPEAT_WHEN_MULTIPLE and len(msg)==1): | |
916 | continue | |
917 | appendTextualTag(content,"p",m) | |
918 | if len(msg)==1 and ENTRYTITLE==TITLE_MESSAGE_FIRST_LINE and (REPEAT_FIRST_LINE==REPEAT_NEVER or REPEAT_FIRST_LINE==REPEAT_WHEN_MULTIPLE): | |
919 | node.removeChild(content) | |
920 | ||
921 | elif section==HO_FILELIST: | |
922 | if len(links)>0 and HTMLOUT_FILELIST and ENTRYTITLE!=TITLE_FILE_LIST: | |
923 | #now add links to content | |
924 | filelist=node.appendChild(doc.createElement("div")) | |
925 | filelist.setAttribute("class","cvslog2web_filelist") | |
926 | filelist.appendChild(doc.createTextNode("\n")) | |
927 | for pre,l in links.iteritems(): | |
928 | appendLinks(filelist,pre,l) | |
929 | ||
#end of content | ||
node.appendChild(doc.createTextNode("\n")) | ||
865 | | |
932 | ||
gen=rootdiv.appendChild(doc.createElement("div")) | ||
gen.setAttribute("class","cvslog2web_credit") | ||
gen.appendChild(doc.createTextNode("Generated by ")) | ||
... | ... | |
a.setAttribute("target","_top") | ||
a.setAttribute("href",SCRIPT_URL) | ||
gen.appendChild(doc.createTextNode(SCRIPT_VERSION)) | ||
873 | | |
940 | ||
f=open(HTMLOUT,"wb") | ||
if HTMLOUT_STANDALONE or "createDocumentFragment" in dir(dom): | ||
doc.writexml(f) | ||
... | ... | |
return "../"*PERMALINK_STRUCTURE.count("/")+link | ||
return link | ||
962 | def permalinkStatusIcon(node,index,alt): | |
963 | i=node.appendChild(doc.createElement("img")) | |
964 | i.setAttribute("src",normalizeLink(PERMALINK_STATUSICONS[index])) | |
965 | i.setAttribute("alt",alt) | |
966 | ||
def writePermalink(entry,files,links,prevLink="",nextLink=""): | ||
if prevLink: prevLink=normalizeLink(prevLink) | ||
if nextLink: nextLink=normalizeLink(nextLink) | ||
898 | | |
970 | ||
permalink=genPermalink(entry[DATETIME]) | ||
permafile=genPermafile(entry[DATETIME]) | ||
permdir=os.path.dirname(permafile) | ||
... | ... | |
if not os.path.isdir(permdir): sys.exit("cvslog2web: file blocking PERMALINKDIR "+permdir) | ||
else: | ||
os.makedirs(permdir) | ||
906 | | |
978 | ||
msg=entry[MESSAGE].splitlines() | ||
# entry header tags | ||
... | ... | |
title=FEEDENTRYPREFIX+files | ||
else: | ||
sys.exit("cvslog2web: bad ENTRYTITLE setting") | ||
916 | | |
988 | ||
989 | dom=xml.dom.getDOMImplementation() | |
990 | if not PERMALINK_STANDALONE: | |
991 | if "createDocumentFragment" in dir(dom): | |
992 | doc=dom.createDocumentFragment() | |
993 | else: | |
994 | doc=dom.createDocument(None,None,None) | |
995 | rootdiv=doc.appendChild(doc.createElement("div")) | |
996 | rootdiv.setAttribute("xmlns","http://www.w3.org/1999/xhtml") | |
997 | rootdiv.appendChild(doc.createTextNode("\n")) | |
998 | rootdiv.setAttribute("class","cvslog2web_permalink") | |
999 | else: | |
1000 | doc,rootdiv=HTMLHeader(dom,title,PERMALINK_CSS,"cvslog2web_permalink") | |
1001 | ||
node=rootdiv.appendChild(doc.createElement("div")) | ||
918 | | |
1003 | node.setAttribute("class",PERMALINK_OUTERCLASS) | |
node.appendChild(doc.createTextNode("\n")) | ||
920 | | |
1005 | ||
for section in PERMALINK_ORDER: | ||
# Previous link | ||
if section==PL_PREVLINK: | ||
n=node.appendChild(doc.createElement("div")) | ||
if prevLink: | ||
n.setAttribute("class","cvslog2web_nav_prev") | ||
927 | | |
1012 | if PERMALINK_ADDJS: n.setAttribute("onClick","window.location.href='"+prevLink+"'") | |
a=n.appendChild(doc.createElement("a")) | ||
a.setAttribute("href",prevLink) | ||
a.appendChild(doc.createTextNode(PL_PREVTEXT)) | ||
else: | ||
n.setAttribute("class","cvslog2web_nav_prev_disabled") | ||
n.appendChild(doc.createTextNode(PL_PREVTEXT)) | ||
934 | | |
1019 | ||
# Previous link | ||
elif section==PL_NEXTLINK: | ||
n=node.appendChild(doc.createElement("div")) | ||
if nextLink: | ||
n.setAttribute("class","cvslog2web_nav_next") | ||
940 | | |
1025 | if PERMALINK_ADDJS: n.setAttribute("onClick","window.location.href='"+nextLink+"'") | |
a=n.appendChild(doc.createElement("a")) | ||
a.setAttribute("href",nextLink) | ||
a.appendChild(doc.createTextNode(PL_NEXTTEXT)) | ||
else: | ||
n.setAttribute("class","cvslog2web_nav_next_disabled") | ||
n.appendChild(doc.createTextNode(PL_NEXTTEXT)) | ||
947 | | |
1032 | ||
# Feed link | ||
elif section==PL_FEEDLINK and FEEDOUT and FEEDSELFLINK: | ||
n=node.appendChild(doc.createElement("div")) | ||
... | ... | |
a=n.appendChild(doc.createElement("a")) | ||
a.setAttribute("href",FEEDSELFLINK) | ||
i=a.appendChild(doc.createElement("img")) | ||
955 | | |
1040 | i.setAttribute("src",normalizeLink(PERMALINK_IMG_PREFIX+"atom_feed.png")) | |
i.setAttribute("width","84") | ||
i.setAttribute("height","15") | ||
1043 | i.setAttribute("alt","Atom") | |
a.appendChild(doc.createTextNode(" ")) | ||
i=a.appendChild(doc.createElement("img")) | ||
960 | | |
1046 | i.setAttribute("src",normalizeLink(PERMALINK_IMG_PREFIX+"feed_icon.png")) | |
i.setAttribute("width","15") | ||
i.setAttribute("height","15") | ||
963 | | |
1049 | i.setAttribute("alt","RSS") | |
1050 | ||
# Title (Timestamp) | ||
elif section==PL_TIMESTAMP: | ||
if time.daylight: | ||
... | ... | |
tz=time.tzname[0] | ||
title=t.strftime("Commited %a. %B %d, %Y at %I:%M:%S %p "+tz) | ||
appendTextualTag(node,"div",title).setAttribute("class","cvslog2web_timestamp") | ||
974 | | |
1061 | ||
# Authors | ||
elif section==PL_AUTHORS: | ||
authors=node.appendChild(doc.createElement("div")) | ||
... | ... | |
else: authors.appendChild(doc.createTextNode(", ")) | ||
l=appendTextualTag(authors,"a",n[0]) | ||
l.setAttribute("href","mailto:"+n[1]) | ||
986 | | |
1073 | ||
# Message | ||
elif section==PL_MESSAGE: | ||
content=node.appendChild(doc.createElement("div")) | ||
... | ... | |
content.appendChild(doc.createTextNode("\n"+m)) | ||
content.appendChild(doc.createElement("br")) | ||
content.appendChild(doc.createTextNode("\n")) | ||
995 | | |
1082 | ||
# Links | ||
elif section==PL_FILELIST: | ||
links=node.appendChild(doc.createElement("div")) | ||
... | ... | |
info=entry[PATH][path] | ||
status=links.appendChild(doc.createElement("span")) | ||
status.setAttribute("class","cvslog2web_filestatus") | ||
1007 | | |
1008 | | |
1009 | | |
1010 | | |
1094 | if len(PERMALINK_STATUSICONS)==3: | |
1095 | if info[2]==ADDED: permalinkStatusIcon(status, 0, "A") | |
1096 | elif info[2]==MODIFIED: permalinkStatusIcon(status, 1, "M") | |
1097 | elif info[2]==REMOVED: permalinkStatusIcon(status, 2, "R") | |
1098 | else: sys.exit("cvslog2web: bad entry[PATH] status flag") | |
1099 | else: | |
1100 | if info[2]==ADDED: status.appendChild(doc.createTextNode("A")) | |
1101 | elif info[2]==MODIFIED: status.appendChild(doc.createTextNode("M")) | |
1102 | elif info[2]==REMOVED: status.appendChild(doc.createTextNode("R")) | |
1103 | else: sys.exit("cvslog2web: bad entry[PATH] status flag") | |
a=links.appendChild(doc.createElement("a")) | ||
lid=dict(path=path,filename=os.path.basename(path),oldversion=vers2str(info[0]),newversion=vers2str(info[1])) | ||
if lid["oldversion"] and lid["newversion"]: | ||
... | ... | |
a.appendChild(doc.createTextNode(dropModules(f[1]))) | ||
links.appendChild(doc.createElement("br")) | ||
links.appendChild(doc.createTextNode("\n")) | ||
1031 | | |
1124 | ||
# Special content (user defined string?) | ||
elif section.__class__=="".__class__: | ||
if not section.strip().startswith("<"): | ||
... | ... | |
for n in subdoc.childNodes: | ||
node.appendChild(subdoc.removeChild(n)) | ||
subdoc.unlink() | ||
1044 | | |
1137 | ||
#put a return in the source after eact section | ||
node.appendChild(doc.createTextNode("\n")) | ||
1048 | | |
1141 | if PERMALINK_STANDALONE: | |
1142 | gen=rootdiv.parentNode.appendChild(doc.createElement("div")) | |
1143 | else: | |
1144 | gen=rootdiv.appendChild(doc.createElement("div")) | |
1145 | ||
gen.setAttribute("class","cvslog2web_credit") | ||
gen.appendChild(doc.createTextNode("Generated by ")) | ||
a=appendTextualTag(gen,"a","cvslog2web") | ||
a.setAttribute("target","_top") | ||
a.setAttribute("href",SCRIPT_URL) | ||
gen.appendChild(doc.createTextNode(SCRIPT_VERSION)) | ||
1055 | | |
1152 | ||
f=open(permafile,"wb") | ||
1057 | | |
1154 | if PERMALINK_STANDALONE or "createDocumentFragment" in dir(dom): | |
1155 | doc.writexml(f) | |
1156 | else: | |
1157 | # createDocumentFragment unavailable, hack it and strip the xml processing instruction | |
1158 | s=doc.toxml() | |
1159 | s=s[s.find("\n")+1:] | |
1160 | f.write(s) | |
f.close() | ||
doc.unlink() | ||
1164 | if VERBOSE: | |
1165 | print "Permalink generated:", genPermalink(entry[DATETIME]) | |
1166 | ||
def genPermalinkEntry(i): | ||
if i<len(history): return genPermalink(history[i][DATETIME]) | ||
return None | ||
... | ... | |
else: | ||
i=len(history)-1 | ||
writePermalink(history[i],histFiles[i],histLinks[i],genPermalink(droppedHistory[-1][DATETIME]),genPermalinkEntry(i-1)) | ||
1079 | | |
1080 | | |
else: | ||
writePermalink(history[0],histFiles[0],histLinks[0],genPermalinkEntry(1)) | ||
curpl=genPermalinkEntry(0) | ||
if len(history)>1: | ||
writePermalink(history[1],histFiles[1],histLinks[1],genPermalinkEntry(2),curpl) | ||
1086 | | |
1087 | | |
1088 |