예제 #1
0
파일: base.py 프로젝트: lover2668/stemsible
    def __init__(self, name='Stemsible - Learning, Growth, and Well-Being '
                 'for Kids'):
        HtmlPage.__init__(self, name, include_form_tag=0)
        self.set_metadata()
        self.conf = conf.getInstance()

        self.style_sheets = [
            'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/' \
                'bootstrap.min.css',
            'css/main.css',
            'css/header.css']

        self.javascript_src.extend([
                'https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/' \
                    'jquery.min.js',
                'https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/' \
                    'jquery-ui.min.js',
                'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/' \
                    'bootstrap.min.js',
                'js/googleanalytics.js',
                'js/header.js',
                ])

        self.debug_cgi = 0
        self.reset_pw_msg = None
        self.require_login = True
        self.user_msg = ''
        self.search = None
        self.school_id = None
예제 #2
0
    def __init__(self):
        Base.__init__(self)
        #self.style_sheets.extend(['css/home.css'])

        self.conf = conf.getInstance()
        self.verified_user = None
        self.require_login = False
예제 #3
0
파일: feed.py 프로젝트: lover2668/stemsible
    def __init__(self, page):
        self.page = page
        self.conf = conf.getInstance()
        messageLikes_addHeaders(page)
        messageComments_addHeaders(page)

        self.messages = Messages()
        self.scroll_pos = 0
        self.num_messages = None
        self.url_preview_html = unicode(open('url_preview.html').read())
예제 #4
0
    def __init__(self):
        Base.__init__(self)
        self.conf = conf.getInstance()
        self.feed = Feed(self)
        self.schoolInfo = SchoolInfo()
        self.style_sheets.extend(['css/profile.css', 'css/feed.css'])
        self.style_sheets.extend(self.schoolInfo.getCssFile())
        self.javascript_src.extend(
            ['js/profile.js', 'js/signup.js', 'js/tags.js', 'js/feed.js'])
        self.javascript_src.extend(self.schoolInfo.getJsFile())
        self.cannot_read_profile = 0

        self.missing_fields = []
        self.pw_error_msg = ''
        self.pw_updated = 0

        self.debug_cgi = 0
예제 #5
0
def getUsers():
    conf_ = conf.getInstance()
    users = Users()
    if request.method == 'POST':
        data = dict((k, request.form[k]) for k in request.form.keys())
        return jsonify(users.add(data))
    else:
        users.setColumns([
            'id', 'concat_ws(" ", first_name, last_name) as fullname',
            'created'
        ])
        users.setOrderBy('id')
        results = users.getTable()
        data = {
            'users': [{
                'id': r['id'],
                'fullname': r['fullname'],
                'created': r['created'],
                'uri': 'http://%s/users/%s' % (conf_.serverurl, r['id']),
            } for r in results]
        }
        return jsonify(data)
예제 #6
0
 def __init__(self):
     DataTable.__init__(self, db.getInstance(), 'schools')
     self.conf = conf.getInstance()
예제 #7
0
    def __init__(self, message):
        self.conf = conf.getInstance()
        self.db = db.getInstance()

        self.message = message
        self._likes = None
예제 #8
0
 def __init__(self):
     self.conf = conf.getInstance()
     self.db = db.getInstance()
     self.logger = logger.getLogger(self.__class__.__name__)
예제 #9
0
 def __init__(self):
     self.db = db.getInstance()
     self.conf = conf.getInstance()
     self.serializer = Serializer(self.SECRET, expires_in=self.EXPIRATION)
예제 #10
0
import os
from PIL import Image
from vlib import conf
from encryptint import encrypt_int

THUMBNAIL_SIZE = (200, 200)
config = conf.getInstance()


def _getImageFile(user_id):
    filename = '{}.jpg'.format(encrypt_int(user_id))
    path = os.path.join(config.basedir, 'web', 'uploads', filename)
    return filename, path


def getUserImage(user_id):
    filename, path = _getImageFile(user_id)
    if os.path.exists(path):
        return 'uploads/{}'.format(filename)
    return 'images/generic_icon.png'


def saveUserImage(user_id, image_file):
    filename, path = _getImageFile(user_id)
    image = Image.open(image_file)
    image.thumbnail(THUMBNAIL_SIZE)
    image.save(path, 'JPEG', quality=85)
예제 #11
0
 def __init__(self):
     self.conf = conf.getInstance()
     self.db = db.getInstance()
     self.users = Users()
     self.messages = Messages()
     self.email = Emails()
예제 #12
0
 def __init__(self, id):
     self.db = db.getInstance()
     self.conf = conf.getInstance()
     Record.__init__(self, self.db, 'messages', id)
예제 #13
0
 def __init__(self):
     self.db = db.getInstance()
     self.conf = conf.getInstance()
     self.activity_notifications = ActivityNotifications()
     DataTable.__init__(self, db.getInstance(), 'messages')
예제 #14
0
 def __init__(self):
     self.db = db.getInstance()
     self.conf = conf.getInstance()