mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Change slash in folder to dots to avoid content server and template problems
This commit is contained in:
parent
40af13276e
commit
1543ff5ea6
@ -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
|
||||||
|
|
||||||
|
@ -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('/', '/')), 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('/', '/'))), 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('/', '/')
|
|
||||||
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')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user