This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Meh | |
def match(self, items): | |
for each in items: | |
if each.match(self): | |
return each | |
# Is this supposed to reach the end? Is this a bug? | |
# Better | |
def match(self, items): | |
for each in items: |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------------------------------ | |
/usr/local/bin/pip run on Mon Jul 1 12:34:07 2013 | |
Downloading/unpacking lxml | |
Getting page https://pypi.python.org/simple/lxml/ | |
URLs to search for versions for lxml: | |
* https://pypi.python.org/simple/lxml/ | |
Analyzing links from page https://pypi.python.org/simple/lxml/ | |
Skipping link https://pypi.python.org/packages/2.4/l/lxml/lxml-1.3.4.win32-py2.4.exe#md5=3007a5b7556d5115e34da2e220630d1d (from https://pypi.python.org/simple/lxml/); unknown archive format: .exe | |
Skipping link https://pypi.python.org/packages/2.7/l/lxml/lxml-2.2.8-py2.7-win32.egg#md5=62180a1bf41e037cd2712957fa4acf62 (from https://pypi.python.org/simple/lxml/); unknown archive format: .egg |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------------------------------ | |
/usr/local/bin/pip run on Mon Jul 1 12:34:07 2013 | |
Downloading/unpacking lxml | |
Getting page https://pypi.python.org/simple/lxml/ | |
URLs to search for versions for lxml: | |
* https://pypi.python.org/simple/lxml/ | |
Analyzing links from page https://pypi.python.org/simple/lxml/ | |
Skipping link https://pypi.python.org/packages/2.4/l/lxml/lxml-1.3.4.win32-py2.4.exe#md5=3007a5b7556d5115e34da2e220630d1d (from https://pypi.python.org/simple/lxml/); unknown archive format: .exe | |
Skipping link https://pypi.python.org/packages/2.7/l/lxml/lxml-2.2.8-py2.7-win32.egg#md5=62180a1bf41e037cd2712957fa4acf62 (from https://pypi.python.org/simple/lxml/); unknown archive format: .egg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------------------------------ | |
/usr/local/bin/pip run on Mon Jul 1 12:47:31 2013 | |
Downloading/unpacking lxml | |
Running setup.py egg_info for package lxml | |
/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url' | |
warnings.warn(msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Searching for lxml | |
Reading http://pypi.python.org/simple/lxml/ | |
Best match: lxml 3.2.1 | |
Downloading http://pypi.python.org/packages/source/l/lxml/lxml-3.2.1.tar.gz#md5=d183ccd6bbd5ca139e9db9e9a675787e | |
Processing lxml-3.2.1.tar.gz | |
Writing /tmp/easy_install-Pg78um/lxml-3.2.1/setup.cfg | |
Running lxml-3.2.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-Pg78um/lxml-3.2.1/egg-dist-tmp-083BG0 | |
Building lxml version 3.2.1. | |
Building without Cython. | |
Using build configuration of libxslt 1.1.24 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night-Eighties.tmTheme", | |
"draw_white_space": "all", | |
"font_face": "Ubuntu Mono", | |
"font_options": | |
[ | |
"subpixel_antialias" | |
], | |
"bold_folder_labels": true, | |
"caret_style": "phase", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import render_template | |
from app import app, pages | |
@app.route('/') | |
def home(): | |
posts = [page for page in pages if 'date' in page.meta] | |
# Sort pages by date | |
sorted_posts = sorted(posts, reverse=True, | |
key=lambda page: page.meta['date']) | |
return render_template('index.html', pages=sorted_posts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from flask import Flask | |
from flask_flatpages import FlatPages | |
from flask_frozen import Freezer | |
app = Flask(__name__) | |
app.config.from_pyfile('settings.py') | |
pages = FlatPages(app) | |
freezer = Freezer(app) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import os | |
REPO_NAME = "flask-ghpages-example" # Used for FREEZER_BASE_URL | |
DEBUG = True | |
# Assumes the app is located in the same directory | |
# where this file resides | |
APP_DIR = os.path.dirname(os.path.abspath(__file__)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from project import main | |
if __name__ == '__main__': | |
main.freezer.freeze() |