# Contributor(s):
# mxey <mxey@ghosthacking.net>
# uzbl_config path now honors XDG_CONFIG_HOME if it exists.
+#
+# Romain Bignon <romain@peerfuse.org>
+# Fix for session restoration code.
# Configuration:
config[key] = os.path.expandvars(config[key])
-def rmkdir(path):
- '''Recursively make directories.
- I.e. `mkdir -p /some/nonexistant/path/`'''
-
- path, sep = os.path.realpath(path), os.path.sep
- dirs = path.split(sep)
- for i in range(2,len(dirs)+1):
- dir = os.path.join(sep,sep.join(dirs[:i]))
- if not os.path.exists(dir):
- os.mkdir(dir)
-
-
def counter():
'''To infinity and beyond!'''
yield i
+def escape(s):
+ '''Replaces html markup in tab titles that screw around with pango.'''
+
+ for (split, glue) in [('&','&'), ('<', '<'), ('>', '>')]:
+ s = s.replace(split, glue)
+ return s
+
+
def gen_endmarker():
'''Generates a random md5 for socket message-termination endmarkers.'''
else:
basedir = os.path.dirname(self.fifo_socket)
if not os.path.exists(basedir):
- rmkdir(basedir)
+ os.makedirs(basedir)
+
os.mkfifo(self.fifo_socket)
print "Listening on %s" % self.fifo_socket
(tabc, textc) = style
if tab_titles:
- pango += tab_format % (tabc, index, textc, tabtitle)
+ pango += tab_format % (tabc, index, textc,\
+ escape(tabtitle))
else:
pango += tab_format % (tabc, textc, index)
if not os.path.isfile(session_file):
dirname = os.path.dirname(session_file)
if not os.path.isdir(dirname):
- # Recursive mkdir not rmdir.
- rmkdir(dirname)
+ os.makedirs(dirname)
sessionstr = '\n'.join(self._tabsuris)
h = open(session_file, 'w')
uzbl.new_tab(line, False)
if not len(urls):
- self.new_tab()
+ uzbl.new_tab()
else:
uzbl.new_tab()