simplified url generation to make it human-readable

master
Stefan Krulj 14 years ago
parent 6cf94d9b2a
commit 7aaff84d4f
  1. 10
      pylog.py
  2. 21
      pylog_action_impl.py
  3. 2
      pylog_config.py
  4. 18
      style.css

@ -223,6 +223,9 @@ script = sys.argv[0][sys.argv[0].rindex('/')+1:]
path = cfg.contentdir
if 'path' in form:
path=form['path'].value
elif 'disp' in form:
validdisp = get_valid_path(form['disp'].value)
path=os.path.dirname(validdisp)
path=get_valid_path(path)
@ -231,7 +234,7 @@ print '<html>'
print '<head>'
print '<meta charset="UTF-8">'
print ('<title>'+cfg.title+'</title>').encode(cfg.encoding)
print '<link rel="alternate" type="application/rss+xml" title="RSS" href="'+cfg.topurl+script+'"?rss=1 />'
print '<link rel="alternate" type="application/rss+xml" title="RSS" href="'+cfg.topurl+script+'?rss=1" />'
print cfg.header.encode(cfg.encoding)
comment_section.comments_init()
print '</head>'
@ -247,6 +250,8 @@ try:
validdisp = get_valid_path(form['disp'].value)
disp=os.path.basename(validdisp)
print "<!-- displaying: %s -->" % validdisp
if not os.path.isdir(disp):
if '.' in disp:
@ -269,7 +274,6 @@ try:
print '<div id="footer">'
print cfg.footer
comment_section.disp_comments(validdisp)
print '</div>'
else:
disp_list(path)
except OSError as ose:
@ -278,6 +282,8 @@ except OSError as ose:
print '<span style="color:#f00>-- [!]&nbsp;Error&nbsp;[!] --<br>'
print ose.strerror + '</span>'
print '</div>'
print '</body>'
print '</html>'

@ -24,7 +24,7 @@ def dir_link(name,f,depth,hidden):
if hidden:
print ' hidden',
print '">'
print ' <a class="menulink" href="'+script+'?'+ urllib.urlencode({'path': os.path.normpath(f)}).replace('&','&amp;') +'">'+name+'</a>'
print ' <a class="menulink" href="'+script+'?'+'path='+os.path.normpath(f)+'">'+name+'</a>'
print ' </li>'
def file_link(name,f,depth,hidden):
script = sys.argv[0][sys.argv[0].rindex('/')+1:]
@ -32,7 +32,7 @@ def file_link(name,f,depth,hidden):
if hidden:
print ' hidden',
print '">'
print ' <a class="menulink" href="'+script+'?'+ urllib.urlencode({'path': os.path.normpath(os.path.dirname(f)), 'disp':os.path.normpath(f)}).replace('&','&amp;') +'">'+name+'</a>'
print ' <a class="menulink" href="'+script+'?'+'disp='+os.path.normpath(f)+'">'+name+'</a>'
print ' </li>'
def disp_txt(path):
@ -68,7 +68,15 @@ class BodyParser(HTMLParser):
def handle_charref(self,ref):
if self.body:
self.src += '&'+ref+';'
# Legacy code used vim for syntax highlighting, as this could be usefull,
# I'll keep it here
# old disp_source using vim
#def disp_source(path):
# print '<div class="sourcecode">'
# print get_source_html(path).encode(cfg.encoding)
# #print source
# print '</div>'
def get_source_html(path):
tmpdir = os.path.join(tempfile.gettempdir(),"pylog")
cache=False
@ -137,13 +145,6 @@ def disp_source(path,lang,line_numbers):
f.close()
print '</div>'
# old disp_source using vim
#def disp_source(path):
# print '<div class="sourcecode">'
# print get_source_html(path).encode(cfg.encoding)
# #print source
# print '</div>'
def disp(path):
print '<div class="entrytext">'
f = codecs.open(path, mode="r", encoding=cfg.encoding)(path)

@ -27,7 +27,7 @@ numofposts=5
numfeed=5
# number of entries in the feed
topurl="http://n0g.at/~powertomato/pylog/"
topurl="http://89.22.98.13/pylog/"
# The URL which specifies the scripts location
# if someone knows how to obtain it using CGI
# please let me know

@ -1,5 +1,5 @@
#gallery_container {
position:absolute;
position:fixed;
top:0px; left:0px;
background-color:#aaaaaa;
background-image:url(_img/back2.png);
@ -17,7 +17,7 @@
}
#gallery_close {
position:absolute;
position:fixed;
right:30px;
}
@ -41,9 +41,12 @@
.hidden {
display: none
}
li {
ul li {
list-style-type:disc;
}
ol li {
list-style-type:decimal;
}
a {
color:#aa6735;
text-decoration:underline;
@ -182,6 +185,10 @@ h1 a {
text-decoration:none;
}
table, th, td, tr {
border: 1px solid black;
border-collapse:collapse;
}
div.entrytext h1:before, div.preview h1:before {
content: counter(kap) ' ';
@ -279,8 +286,3 @@ ul.gallery li img {
margin:2px;
}

Loading…
Cancel
Save