| @@ -5,6 +5,7 @@ Module to contain all the project's Flask server plumbing. | |||||
| from flask import Flask | from flask import Flask | ||||
| from flask import render_template, session | from flask import render_template, session | ||||
| from bitshift.database import Database | |||||
| from bitshift.query import parse_query | from bitshift.query import parse_query | ||||
| app = Flask(__name__) | app = Flask(__name__) | ||||
| @@ -12,7 +13,9 @@ app.config.from_object("bitshift.config") | |||||
| app_env = app.jinja_env | app_env = app.jinja_env | ||||
| app_env.line_statement_prefix = "=" | app_env.line_statement_prefix = "=" | ||||
| app_env.globals.update(assets = assets) | |||||
| app_env.globals.update(assets=assets) | |||||
| database = Database() | |||||
| @app.route("/") | @app.route("/") | ||||
| def index(): | def index(): | ||||
| @@ -20,8 +23,8 @@ def index(): | |||||
| @app.route("/search/<query>") | @app.route("/search/<query>") | ||||
| def search(query): | def search(query): | ||||
| ## tree = parse_query(query) | |||||
| ## database.search(tree) | |||||
| tree = parse_query(query) | |||||
| database.search(tree) | |||||
| pass | pass | ||||
| if __name__ == "__main__": | if __name__ == "__main__": | ||||
| @@ -16,3 +16,24 @@ class Database(object): | |||||
| def _create(self): | def _create(self): | ||||
| pass | pass | ||||
| def search(self, query): | |||||
| """ | |||||
| Search the database. | |||||
| :param query: The query to search for. | |||||
| :type query: :py:class:`~.query.tree.Tree` | |||||
| :return: A list of search results. | |||||
| :rtype: list of :py:class:`.Codelet`\ s | |||||
| """ | |||||
| pass | |||||
| def insert(self, codelet): | |||||
| """ | |||||
| Insert a codelet into the database. | |||||
| :param codelet: The codelet to insert. | |||||
| :type codelet: :py:class:`.Codelet` | |||||
| """ | |||||
| pass | |||||
| @@ -5,7 +5,7 @@ setup( | |||||
| version = "0.1", | version = "0.1", | ||||
| packages = find_packages(), | packages = find_packages(), | ||||
| install_requires = ["Flask>=0.10.1", "pygments>=1.6", "requests>=2.2.0", | install_requires = ["Flask>=0.10.1", "pygments>=1.6", "requests>=2.2.0", | ||||
| "BeautifulSoup>=3.2.1"], | |||||
| "BeautifulSoup>=3.2.1", "oursql>=0.9.3.1"], | |||||
| author = "Benjamin Attal, Ben Kurtovic, Severyn Kozak", | author = "Benjamin Attal, Ben Kurtovic, Severyn Kozak", | ||||
| license = "MIT", | license = "MIT", | ||||
| url = "https://github.com/earwig/bitshift" | url = "https://github.com/earwig/bitshift" | ||||