示例#1
0
# Base System
import os
import logging
try:
    import simplejson as json
except ImportError:
    import json
# Dropbox
from dropbox import auth, client
# Ours
from db import SQLite as db
import files

define("port", default=8000, help="run on the given port", type=int)

Users = db.userDB()
#auth.HTTP_DEBUG_LEVEL=10

config = auth.Authenticator.load_config("config/config.ini")
config.update(auth.Authenticator.load_config("config/apikeys.ini"))
tokens = {}
user_tokens = {}


class dbAuth(object):
    """docstring for dbAuth"""
    def __init__(self):
        super(dbAuth, self).__init__()
        self.dba = auth.Authenticator(config)
        self.baseToken = self.dba.obtain_request_token()
示例#2
0
        Files.updateItems()
        return status

    #GET actions
    def GET(self, name):
        if name == "token":
            Files.getToken(web.input()['oauth_token'])
            UserDB.addUser()
            raise web.seeother('/')  #web.input()['oauth_token'])
            #and 'oauth_token' in web.input():
        if Files.access_token == False:
            raise web.seeother(Files.authURL)
        if not name:
            return self.makeIndex()
        name = self.__preflight(name)
        f = Files.getFile(name)
        content = f.read()
        return render.page(name, content)

    def makeIndex(self):
        #Files.updateItems()
        #return render.blank(Files.listDir('/'))
        return render.index(Files.listDir(''))


Files = files.FileModel()

UserDB = db.userDB()

if __name__ == "__main__":
    app.run()
示例#3
0
import cStringIO
import subprocess
import urllib
import time
import re
import markdown
# Dropbox
from dropbox import auth, client
# Ours
from db import SQLite as db
import bundles
import cipher

define("port", default=8000, help="run on the given port", type=int)

Users = db.userDB() 
#auth.HTTP_DEBUG_LEVEL=10

config = auth.Authenticator.load_config("config/config.ini")
config.update(auth.Authenticator.load_config("config/apikeys.ini"))
tokens = {}
user_tokens = {}

c = cipher.Cipher()

class dbAuth(object):
    """docstring for dbAuth"""
    def __init__(self):
        super(dbAuth, self).__init__()
        self.dba = auth.Authenticator(config)
        self.baseToken = self.dba.obtain_request_token()
        status = f.rename(newName)
        Files.updateItems()
        return status
    
    #GET actions
    def GET(self, name):
        if name == "token":
            Files.getToken(web.input()['oauth_token'])
            UserDB.addUser()
            raise web.seeother('/')#web.input()['oauth_token'])
            #and 'oauth_token' in web.input():
        if Files.access_token == False:
            raise web.seeother(Files.authURL)
        if not name:
            return self.makeIndex()
        name = self.__preflight(name)
        f = Files.getFile(name)
        content = f.read()
        return render.page(name,content)
    
    def makeIndex(self):
        #Files.updateItems()
        #return render.blank(Files.listDir('/'))
        return render.index(Files.listDir(''))

Files = files.FileModel()

UserDB = db.userDB()

if __name__ == "__main__":
    app.run()