Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PG_USER=gutenberg
ASSET_DIR=gutenbergsite/gutenberg
PICS_DIR=gutenbergsite/pics
DEV_BASE_PATH=https://dev.gutenberg.org
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "gutenbergsite"]
path = gutenbergsite
url = git@github.com:gutenbergtools/gutenbergsite.git
4 changes: 4 additions & 0 deletions BaseSearcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from __future__ import unicode_literals
from __future__ import division

from os import environ
import datetime
import logging

Expand Down Expand Up @@ -381,6 +382,9 @@ class OpenSearch(object):
}

def __init__(self):
self.assetdir = environ.get('ASSET_DIR')
self.picsdir = environ.get('PICS_DIR')
self.dev_base_path = environ.get('DEV_BASE_PATH')
self.format = None
self.page = None
self.template = None
Expand Down
5 changes: 4 additions & 1 deletion CherryPy.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ server.thread_pool_max: 20
pghost: 'localhost'
pgport: 5432
pgdatabase: 'gutenberg'
pguser: 'postgres'

host: 'www.gutenberg.org'
host_https: 1
Expand Down Expand Up @@ -81,6 +80,10 @@ tools.expires.on: True
tools.expires.secs: 0
tools.expires.force: True

[/gutenbergsite]
tools.staticdir.on: True
tools.staticdir.dir: CherryPyApp.install_dir + "/gutenbergsite"

[/index.html]
tools.staticfile.on: True
tools.staticfile.filename: CherryPyApp.install_dir + '/test/index.html'
Expand Down
5 changes: 4 additions & 1 deletion Page.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
Base class for all pages.

"""

from __future__ import unicode_literals

from os import environ
import logging

import cherrypy
Expand All @@ -31,6 +31,9 @@ class Page(object):

def __init__(self):
self.supported_book_mediatypes = [ mt.epub, mt.mobi ]
self.assetdir = environ.get('ASSET_DIR')
self.dev_base_path = environ.get('DEV_BASE_PATH')
self.picsdir = environ.get('PICS_DIR')


@staticmethod
Expand Down
1 change: 1 addition & 0 deletions gutenbergsite
Submodule gutenbergsite added at 31bdcc
2 changes: 1 addition & 1 deletion templates/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
</ul>

<a href="https://www.ibiblio.org/" title="Project Gutenberg is hosted by ibiblio">
<img src="/gutenberg/ibiblio-logo.png" alt="ibiblio" width="110" height="32" />
<img src="/${os.assetdir}/ibiblio-logo.png" alt="ibiblio" width="110" height="32" />
</a>
</footer>
4 changes: 2 additions & 2 deletions templates/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</a>

<a id="main_logo" href="/" class="no-hover">
<img src="/gutenberg/pg-logo-129x80.png" alt="Project Gutenberg" draggable="false" />
<img src="/${os.assetdir}/pg-logo-129x80.png" alt="Project Gutenberg" draggable="false" />
</a>
</div>

Expand Down Expand Up @@ -65,7 +65,7 @@
<input
class="donbtn"
type="image"
src="/pics/en_US.gif"
src="/${os.picsdir}/en_US.gif"
name="submit"
alt="Donate via PayPal"
/>
Expand Down
2 changes: 1 addition & 1 deletion templates/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ <h2 class="padded">${e.header}</h2>
<span class="icon icon_${e.icon}" />
</span>
<img py:if="e.thumb_url"
class="cover-thumb" src="${e.thumb_url}" alt="" />
class="cover-thumb" src="${os.dev_base_path}${e.thumb_url}" alt="" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're writing a script to pull assets into static, why not do the same for the other assets? (note that some of the _includes files come from the dev autocat3 like this:
/usr/bin/wget --quiet -O ${BUILD}/_includes/popular_covers.html "http://[autocat3]:8000/covers/medium/popular/10"
(jekyll script in ebookconverter repo)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far, this is more-or-less just linking static assets from gutenbergsite to autocat. Definitely would be interesting to pull other assets in as well. But right now there is no script involved. Everything will work when submodules are fetched.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically, it's a base url, not a path. And why only "dev"?

</span>
<span class="cell content">
<span py:if="e.title" class="title">${e.title}</span>
Expand Down
8 changes: 4 additions & 4 deletions templates/site-layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
.page_content a.subtle_link:hover {color:#003366}
</style>

<link rel="stylesheet" type="text/css" href="/gutenberg/pg-desktop-one.css?v=1.1" />
<link rel="stylesheet" type="text/css" href="/gutenberg/style2.css?v=1.6"/>
<link rel="stylesheet" type="text/css" href="/gutenberg/new_nav.css?v=1.6"/>
<link rel="stylesheet" type="text/css" href="/gutenberg/search_options.css?v=1" />
<link rel="stylesheet" type="text/css" href="/${os.assetdir}/pg-desktop-one.css?v=1.1" />
<link rel="stylesheet" type="text/css" href="/${os.assetdir}/style2.css?v=1.6"/>
<link rel="stylesheet" type="text/css" href="/${os.assetdir}/new_nav.css?v=1.6"/>
<link rel="stylesheet" type="text/css" href="/${os.assetdir}/search_options.css?v=1" />

<!--! IE8 does not recognize application/javascript -->
<script>//<![CDATA[
Expand Down