-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
316 changed files
with
74,805 additions
and
35,952 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,7 @@ | |
|
||
# fabfile caches | ||
.coffeecache | ||
.minifycache | ||
.minifycache | ||
|
||
# Symbolic link Files | ||
config.py |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
Copyright (c) 2013 Leonardo Zizzamia, Gianluca Bargelli. See AUTHORS for more details. | ||
Copyright (c) 2014 Leonardo Zizzamia. See AUTHORS for more details. | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Zizzamia
Author
Member
|
||
|
||
All rights reserved. | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
pymongo | ||
fabric | ||
simplejson | ||
flask | ||
werkzeug | ||
requests | ||
PIL | ||
oauth | ||
recaptcha-client | ||
yuicompressor | ||
pymongo==2.6.3 | ||
Fabric==1.4.2 | ||
simplejson==2.5.0 | ||
Flask==0.8 | ||
Werkzeug==0.8.3 | ||
requests==0.13.3 | ||
yuicompressor==2.4.7 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Bombolone | ||
~~~~~~~~~~~~~~~~~~~~~ | ||
Bombolone is a tasty Content Management System for Python based on Flask, | ||
MongoDB, AngularJS, Sass and Bootstrap. It's designed to be a simple, | ||
flexible toolset for projects of any size. | ||
:copyright: (c) 2014 by @zizzamia | ||
:license: BSD (See LICENSE for details) | ||
""" | ||
|
||
__title__ = 'bombolone' | ||
__version__ = '0.3.0' | ||
__author__ = '@zizzamia' | ||
__copyright__ = 'Copyright 2014 Bombolone' |
0
app/admin/__init__.py → api/__init__.py
100755 → 100644
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
api.account.py | ||
~~~~~~ | ||
:copyright: (c) 2014 by @zizzamia | ||
:license: BSD (See LICENSE for details) | ||
""" | ||
from flask import Blueprint, request, g, url_for, redirect, abort | ||
from werkzeug import secure_filename | ||
|
||
# Imports inside Bombolone | ||
from config import UP_AVATARS_TMP_FOLDER | ||
from core import users | ||
from core.utils import ensure_objectid, jsonify | ||
from decorators import authentication, get_hash, check_rank | ||
|
||
api_account = Blueprint('api_account', __name__) | ||
|
||
@api_account.route('/api/1.0/account/update.json', methods=['POST']) | ||
@authentication | ||
@check_rank(10) | ||
@get_hash('users') | ||
def update(): | ||
""" | ||
""" | ||
params = request.json | ||
user_id = params["_id"] | ||
data = users.update(user_id=user_id, params=params) | ||
return jsonify(data) | ||
|
||
@api_account.route('/api/1.0/account/update_profile.json', methods=['POST']) | ||
@authentication | ||
@get_hash('users') | ||
def update_profile(): | ||
""" | ||
""" | ||
params = request.json | ||
user_id = g.my['_id'] | ||
data = users.update_profile(user_id=user_id, params=params) | ||
return jsonify(data) | ||
|
||
@api_account.route('/api/1.0/account/update_account.json', methods=['POST']) | ||
@authentication | ||
@get_hash('users') | ||
def update_account(): | ||
""" | ||
""" | ||
params = request.json | ||
user_id = g.my['_id'] | ||
data = users.update_account(user_id=user_id, params=params) | ||
return jsonify(data) | ||
|
||
@api_account.route('/api/1.0/account/update_password.json', methods=['POST']) | ||
@authentication | ||
@get_hash('users') | ||
def update_password(): | ||
""" | ||
""" | ||
params = request.json | ||
user_id = g.my['_id'] | ||
data = users.update_password(user_id=user_id, params=params) | ||
return jsonify(data) | ||
|
||
@api_account.route('/api/1.0/account/upload_avatar.json', methods=['POST']) | ||
@authentication | ||
@get_hash('users') | ||
def upload_avatar(): | ||
""" """ | ||
name = secure_filename(request.headers.get('X-File-Name')) | ||
data = users.upload_avatar(name=name) | ||
return jsonify(data) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
api.hash_table.py | ||
~~~~~~ | ||
The Hash Table allows you to store multiple Hash Map, | ||
each of which has an Name Map and an Hash useful to | ||
write the content for use on the web site. | ||
:copyright: (c) 2014 by @zizzamia | ||
:license: BSD (See LICENSE for details) | ||
""" | ||
from flask import Blueprint, request | ||
|
||
# Imports inside Bombolone | ||
from core import hash_table | ||
from core.utils import jsonify, ensure_objectid | ||
from decorators import get_hash, authentication, check_rank | ||
|
||
MODULE_DIR = 'admin/hash_table' | ||
api_hash_table = Blueprint('api_hash_table', __name__) | ||
|
||
@api_hash_table.route('/api/1.0/hash_table/list.json') | ||
@authentication | ||
@check_rank(10) | ||
@get_hash('hash_table') | ||
def overview(): | ||
""" List all the documents, each has a name | ||
that identifies it, and an hash map. """ | ||
data = hash_table.get_list() | ||
return jsonify(data) | ||
|
||
@api_hash_table.route('/api/1.0/hash_table/get.json') | ||
@authentication | ||
@check_rank(10) | ||
@get_hash('hash_table') | ||
def get(): | ||
""" """ | ||
_id = request.args.get("_id", None) | ||
data = hash_table.get(_id) | ||
return jsonify(data) | ||
|
||
@api_hash_table.route('/api/1.0/hash_table/new.json', methods=['POST']) | ||
@authentication | ||
@check_rank(10) | ||
@get_hash('hash_table') | ||
def new(): | ||
""" Create a new document within the hash table. """ | ||
params = request.json | ||
data = hash_table.new(params=params) | ||
return jsonify(data) | ||
|
||
@api_hash_table.route('/api/1.0/hash_table/remove.json', methods=['DELETE']) | ||
@authentication | ||
@check_rank(10) | ||
def remove(): | ||
""" This method removes an hash map""" | ||
_id = request.args.get("_id", None) | ||
data = hash_table.remove(_id=_id) | ||
return jsonify(data) | ||
|
||
@api_hash_table.route('/api/1.0/hash_table/update.json', methods=['POST']) | ||
@authentication | ||
@check_rank(10) | ||
@get_hash('hash_table') | ||
def update(): | ||
""" """ | ||
params = request.json | ||
data = hash_table.update(params=params) | ||
return jsonify(data) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
api.languages.py | ||
~~~~~~ | ||
:copyright: (c) 2014 by @zizzamia | ||
:license: BSD (See LICENSE for details) | ||
""" | ||
import os | ||
import json | ||
from flask import Blueprint, request, session, g, redirect, abort | ||
|
||
# Imports inside Bombolone | ||
from core import languages | ||
from core.utils import jsonify | ||
|
||
api_languages = Blueprint('api_languages', __name__) | ||
|
||
@api_languages.route('/api/1.0/languages/', methods=['GET', 'POST', 'PUT', 'DELETE']) | ||
def api(): | ||
""" """ | ||
if request.method == "GET": | ||
data = languages.show() | ||
elif request.method == "POST": | ||
data = languages.new() | ||
elif request.method == "PUT": | ||
data = languages.update() | ||
elif request.method == "DELETE": | ||
data = languages.remove() | ||
return jsonify(data) | ||
|
||
@api_languages.route('/api/1.0/languages/change.json') | ||
def change(): | ||
""" | ||
Change language | ||
""" | ||
lang = request.args.get("lang", None) | ||
my_id = None | ||
if hasattr(g, 'my') and g.my: | ||
my_id = g.my['_id'] | ||
data = languages.change(lang=lang, my_id=my_id) | ||
return jsonify(data) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
api.login.py | ||
~~~~~~ | ||
:copyright: (c) 2014 by @zizzamia | ||
:license: BSD (See LICENSE for details) | ||
""" | ||
import re | ||
from flask import Blueprint, request, g, render_template | ||
|
||
# Imports inside Bombolone | ||
from decorators import get_hash | ||
from core.utils import jsonify | ||
|
||
api_login = Blueprint('api_login', __name__) | ||
|
||
@api_login.route('/api/1.0/login') | ||
def index(): | ||
""" | ||
""" | ||
data = { | ||
} | ||
return jsonify(data) | ||
|
||
@api_login.route('/api/1.0/login/join') | ||
def join(): | ||
""" | ||
""" | ||
data = { | ||
} | ||
return jsonify(data) | ||
|
||
@api_login.route('/api/1.0/logout') | ||
def logout(): | ||
""" | ||
""" | ||
data = { | ||
} | ||
return jsonify(data) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
api.rank.py | ||
~~~~~~ | ||
:copyright: (c) 2014 by @zizzamia | ||
:license: BSD (See LICENSE for details) | ||
""" | ||
from flask import Blueprint, g, request | ||
|
||
# Imports inside Bombolone | ||
import core.rank | ||
from core.utils import jsonify, set_message | ||
from decorators import authentication, check_rank, get_hash | ||
|
||
api_rank = Blueprint('api_rank', __name__) | ||
|
||
@api_rank.route('/api/1.0/rank/show.json') | ||
@authentication | ||
@get_hash('rank') | ||
def show(): | ||
""" """ | ||
rank_id = request.args.get("rank-id", None) | ||
data = core.rank.show(rank_id=rank_id) | ||
data = set_message(data) | ||
return jsonify(data) | ||
|
||
@api_rank.route('/api/1.0/rank/create.json', methods=['POST']) | ||
@authentication | ||
@check_rank(10) | ||
@get_hash('rank') | ||
def create(): | ||
""" """ | ||
name = request.json.get("name", None) | ||
rank = request.json.get("rank", None) | ||
data = core.rank.create(name=name, rank=rank) | ||
data = set_message(data) | ||
return jsonify(data) | ||
|
||
@api_rank.route('/api/1.0/rank/update.json', methods=['POST']) | ||
@authentication | ||
@check_rank(10) | ||
@get_hash('rank') | ||
def update(): | ||
""" """ | ||
rank_id = request.json.get("rank-id", None) | ||
name = request.json.get("name", None) | ||
rank = request.json.get("rank", None) | ||
data = core.rank.update(rank_id=rank_id, name=name, rank=rank) | ||
data = set_message(data) | ||
return jsonify(data) | ||
|
||
@api_rank.route('/api/1.0/rank/remove.json', methods=['DELETE']) | ||
@authentication | ||
@check_rank(10) | ||
@get_hash('rank') | ||
def remove(): | ||
""" """ | ||
rank_id = request.args.get("_id", None) | ||
data = core.rank.remove(rank_id=rank_id, my_rank=g.my['rank']) | ||
data = set_message(data) | ||
return jsonify(data) |
Oops, something went wrong.
Nice Dude :) No more Gianluca!