Ejemplo n.º 1
0
def setup_models(db):
    return (
        model(db, "Post",
            pid = 'integer',
            time = 'datetime',
            text = 'string', # parsed message text with html
            plain = 'string', # plain message text
            reply = 'integer', # pid
            source = 'string',
            unread = 'boolean',
            service = 'string',
            user_id = 'string', # screen_name
            user_url = 'string',
            user_name = 'string',
            author_id = 'string',
            author_url = 'string',
            author_name = 'string',
            user_fgcolor = 'string',
            user_bgcolor = 'string',
            replied_user = '******',
            by_conversation = 'boolean', # all posts only reference by conversation (not by timeline)
            user_profile_url = 'string',
            profile_image_url = 'string',
            author_profile_url = 'string',
            ),
        model(db, "Cache",
            pid = "integer", # Post.id
            ),
        model(db, "Conversation",
            pid = 'integer',
            ids = 'string', # space seperated

            ),
        )
Ejemplo n.º 2
0
 def create(name, password, charclass):
     """ Создание нового пользователя (stub).
         str name - имя пользователя.
     """
     if db().user.find_one({"login": name.lower()}) == None:
         res = model(
             name=name,
             image=constants.char_class[charclass].avatar,
             login=name.lower(),
             password=md5(password),
             data={},
             online=False,
             last_action=now(),
             last_hp_update=0.0,
             admin=0,
             exp=0,
             level=1,
         )
         res_id = str(db().user.insert(res))
         return User(res_id, True, charclass)
     else:
         return None
Ejemplo n.º 3
0
from flask import Flask, flash, request, redirect, url_for, render_template, jsonify
from werkzeug.utils import secure_filename

import sys
import os
import json
import logging
import urllib
   
import location_analyzer
import suggester
import db
import precomputed

app = Flask(__name__, static_url_path='/static')
model = db.model(os.environ['PSQL_URI'])
 
######################################################################
### Constants

ALLOWED_EXTENSIONS = set(['json'])
app.config['UPLOAD_FOLDER'] = 'upload/'

######################################################################
### Routes

@app.route("/static/<path:path>")
def get_static(path):
    """
    Endpoint that serves static files
    """