Change slash in folder to dots to avoid content server and template problems

This commit is contained in:
Charles Haley 2011-02-22 13:23:32 +00:00
parent 40af13276e
commit 1543ff5ea6
2 changed files with 8 additions and 9 deletions

View File

@ -605,8 +605,8 @@ class TagsModel(QAbstractItemModel): # {{{
else: else:
tt = _(u'The lookup/search name is "{0}"').format(r) tt = _(u'The lookup/search name is "{0}"').format(r)
if r.startswith('@') and r.find('/') >= 0: if r.startswith('@') and r.find('.') >= 0:
path_parts = [p.strip() for p in r.split('/') if p.strip()] path_parts = [p.strip() for p in r.split('.') if p.strip()]
path = '' path = ''
for i,p in enumerate(path_parts): for i,p in enumerate(path_parts):
path += p path += p
@ -621,7 +621,7 @@ class TagsModel(QAbstractItemModel): # {{{
self.category_nodes.append(node) self.category_nodes.append(node)
else: else:
last_category_node = category_node_map[path] last_category_node = category_node_map[path]
path += '/' path += '.'
else: else:
node = TagTreeItem(parent=self.root_item, node = TagTreeItem(parent=self.root_item,
data=self.categories[i], data=self.categories[i],
@ -784,10 +784,10 @@ class TagsModel(QAbstractItemModel): # {{{
while True: while True:
try: try:
tb_cats.add_user_category(label=cat_name, name=user_cat) tb_cats.add_user_category(label=cat_name, name=user_cat)
slash = cat_name.rfind('/') dot = cat_name.rfind('.')
if slash < 0: if dot < 0:
break break
cat_name = cat_name[:slash] cat_name = cat_name[:dot]
except ValueError: except ValueError:
break break

View File

@ -168,7 +168,7 @@ def get_category_items(category, items, restriction, datatype, prefix): # {{{
q = i.category q = i.category
if not q: if not q:
q = category q = category
href = '/browse/matches/%s/%s'%(quote(q.replace('/', '&#47;')), quote(id_)) href = '/browse/matches/%s/%s'%(quote(q), quote(id_))
return templ.format(xml(name), rating, return templ.format(xml(name), rating,
xml(desc), xml(href, True), rstring, prefix) xml(desc), xml(href, True), rstring, prefix)
@ -367,7 +367,7 @@ class BrowseServer(object):
u'<img src="{3}{src}" alt="{0}" />' u'<img src="{3}{src}" alt="{0}" />'
u'<span class="label">{0}</span>' u'<span class="label">{0}</span>'
u'</li>') u'</li>')
.format(xml(x, True), xml(quote(y.replace('/', '&#47;'))), xml(_('Browse books by')), .format(xml(x, True), xml(quote(y)), xml(_('Browse books by')),
self.opts.url_prefix, src='/browse/icon/'+z) self.opts.url_prefix, src='/browse/icon/'+z)
for x, y, z in cats] for x, y, z in cats]
@ -387,7 +387,6 @@ class BrowseServer(object):
return sort return sort
def browse_category(self, category, sort): def browse_category(self, category, sort):
category = category.replace('&#47;', '/')
categories = self.categories_cache() categories = self.categories_cache()
if category not in categories: if category not in categories:
raise cherrypy.HTTPError(404, 'category not found') raise cherrypy.HTTPError(404, 'category not found')