mirror of
https://github.com/rembo10/headphones.git
synced 2026-05-15 16:19:28 +01:00
Fixed an issue with redirects to index page
This commit is contained in:
@@ -12,7 +12,7 @@ _header = '''
|
||||
<div class="container">'''
|
||||
|
||||
_logobar = '''
|
||||
<div class="logo"><a href=""><img src="data/images/headphoneslogo.png" border="0">headphones<a></div>
|
||||
<div class="logo"><a href="home"><img src="data/images/headphoneslogo.png" border="0">headphones<a></div>
|
||||
<div class="search"><form action="findArtist" method="GET">
|
||||
<input type="text" value="Add an artist" onfocus="if
|
||||
(this.value==this.defaultValue) this.value='';" name="name" />
|
||||
@@ -20,7 +20,7 @@ _logobar = '''
|
||||
'''
|
||||
|
||||
_nav = '''<div class="nav">
|
||||
<a href="">HOME</a>
|
||||
<a href="home">HOME</a>
|
||||
<a href="upcoming">UPCOMING</a>
|
||||
<a href="manage">MANAGE</a>
|
||||
<a href="history">HISTORY</a>
|
||||
|
||||
12
webServer.py
12
webServer.py
@@ -19,6 +19,10 @@ database = os.path.join(FULL_PATH, 'headphones.db')
|
||||
class Headphones:
|
||||
|
||||
def index(self):
|
||||
raise cherrypy.HTTPRedirect("home")
|
||||
index.exposed=True
|
||||
|
||||
def home(self):
|
||||
page = [templates._header]
|
||||
page.append(templates._logobar)
|
||||
page.append(templates._nav)
|
||||
@@ -66,7 +70,7 @@ class Headphones:
|
||||
else:
|
||||
page.append("""<div class="datanil">Add some artists to the database!</div>""")
|
||||
return page
|
||||
index.exposed = True
|
||||
home.exposed = True
|
||||
|
||||
|
||||
def artistPage(self, ArtistID):
|
||||
@@ -158,12 +162,12 @@ class Headphones:
|
||||
|
||||
page = [templates._header]
|
||||
if len(name) == 0 or name == 'Add an artist':
|
||||
raise cherrypy.HTTPRedirect("/")
|
||||
raise cherrypy.HTTPRedirect("home")
|
||||
else:
|
||||
artistResults = ws.Query().getArtists(ws.ArtistFilter(string.replace(name, '&', '%38'), limit=8))
|
||||
if len(artistResults) == 0:
|
||||
logger.log(u"No results found for " + name)
|
||||
page.append('''No results!<a class="blue" href="">Go back</a>''')
|
||||
page.append('''No results!<a class="blue" href="home">Go back</a>''')
|
||||
return page
|
||||
elif len(artistResults) > 1:
|
||||
page.append('''Search returned multiple artists. Click the artist you want to add:<br /><br />''')
|
||||
@@ -200,7 +204,7 @@ class Headphones:
|
||||
artistlist = c.fetchall()
|
||||
if any(artistid in x for x in artistlist):
|
||||
page = [templates._header]
|
||||
page.append('''%s has already been added. Go <a href="">back</a>.''' % artist.name)
|
||||
page.append('''%s has already been added. Go <a href="home">back</a>.''' % artist.name)
|
||||
logger.log(artist.name + u" is already in the database!", logger.WARNING)
|
||||
c.close()
|
||||
return page
|
||||
|
||||
Reference in New Issue
Block a user