refactor:webpy022->web.py
This commit is contained in:
parent
f1cd5071da
commit
4882f5cb88
|
@ -33,10 +33,10 @@
|
|||
|
||||
import lib.newforms_plus as forms
|
||||
import page_decorators as deco
|
||||
import lib.webpy022 as web
|
||||
import web
|
||||
from webserver_common import ws, proxy, log
|
||||
from render import render
|
||||
from lib.webpy022.http import seeother
|
||||
from web import seeother
|
||||
import sys
|
||||
import os
|
||||
import utils
|
||||
|
|
|
@ -38,12 +38,14 @@ pretty_errors_cls = {
|
|||
}
|
||||
|
||||
import sys, urlparse, pprint
|
||||
from lib.webpy022.net import websafe
|
||||
from lib.webpy022.template import Template
|
||||
import lib.webpy022.webapi as web
|
||||
from web import websafe
|
||||
from web import template
|
||||
import web #import lib.webpy022.webapi as web
|
||||
import webserver_common as ws
|
||||
from traceback import format_tb
|
||||
|
||||
Template = template.Template
|
||||
|
||||
import os, os.path
|
||||
whereami = os.path.join(os.getcwd(), __file__)
|
||||
whereami = os.path.sep.join(whereami.split(os.path.sep)[:-1])
|
||||
|
|
|
@ -41,13 +41,18 @@ import config_tabs_webui #auto registers in ConfigUiManager
|
|||
import config_tabs_deluge #auto registers in ConfigUiManager
|
||||
import register_menu
|
||||
|
||||
#debugerror
|
||||
from debugerror import deluge_debugerror
|
||||
import web
|
||||
web.webapi.internalerror = deluge_debugerror
|
||||
|
||||
from webserver_common import ws #todo: remove ws.
|
||||
|
||||
|
||||
def create_webserver(urls, methods, middleware):
|
||||
from webserver_common import ws
|
||||
from lib.webpy022.request import webpyfunc
|
||||
from lib.webpy022 import webapi
|
||||
from web import webpyfunc
|
||||
from web import webapi
|
||||
from lib.gtk_cherrypy_wsgiserver import CherryPyWSGIServer
|
||||
import os
|
||||
|
||||
|
@ -63,7 +68,7 @@ def create_webserver(urls, methods, middleware):
|
|||
return server
|
||||
|
||||
def WebServer(debug = False):
|
||||
import lib.webpy022 as web
|
||||
import web
|
||||
from deluge import component
|
||||
if debug:
|
||||
middleware = [web.reloader]
|
||||
|
|
|
@ -41,7 +41,7 @@ from inspect import getargspec
|
|||
from utils import get_torrent_status,get_category_choosers, get_stats,filter_torrent_state,fsize,fspeed
|
||||
from page_decorators import remote
|
||||
from operator import attrgetter
|
||||
import lib.webpy022 as web
|
||||
import web
|
||||
from webserver_common import proxy, log
|
||||
|
||||
def to_json(obj):
|
||||
|
|
|
@ -10,13 +10,7 @@ from newforms.forms import BoundField
|
|||
|
||||
import sys, os
|
||||
|
||||
import webpy022 as web #todo:remove this dependency.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import web
|
||||
|
||||
#Form
|
||||
class FilteredForm(newforms.Form):
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
static fileserving for web.py
|
||||
without the need for wsgi wrapper magic.
|
||||
"""
|
||||
import webpy022 as web
|
||||
from webpy022.http import seeother, url
|
||||
import web
|
||||
from web import seeother, url
|
||||
|
||||
import posixpath
|
||||
import urlparse
|
||||
|
|
|
@ -7,9 +7,9 @@ from webserver_common import ws, log, proxy
|
|||
from utils import *
|
||||
#/relative
|
||||
|
||||
from lib.webpy022.webapi import cookies, setcookie as w_setcookie
|
||||
from lib.webpy022.http import seeother, url
|
||||
from lib.webpy022 import changequery as self_url
|
||||
from web import cookies, setcookie as w_setcookie
|
||||
from web import seeother, url
|
||||
from web import changequery as self_url
|
||||
|
||||
#deco's:
|
||||
def deluge_page_noauth(func):
|
||||
|
|
|
@ -45,12 +45,8 @@ from torrent_move import torrent_move
|
|||
|
||||
from deluge.common import get_pixmap
|
||||
|
||||
#debugerror
|
||||
from debugerror import deluge_debugerror
|
||||
web.webapi.internalerror = deluge_debugerror
|
||||
|
||||
import lib.webpy022 as web
|
||||
from lib.webpy022.http import seeother, url
|
||||
import web
|
||||
from web import seeother, url
|
||||
from lib.static_handler import static_handler
|
||||
from torrent_add import torrent_add
|
||||
|
||||
|
@ -62,7 +58,6 @@ page_manager = component.get("PageManager")
|
|||
|
||||
#from json_api import json_api #secuity leak, todo:fix
|
||||
|
||||
|
||||
#routing:
|
||||
urls = [
|
||||
"/login", "login",
|
||||
|
|
|
@ -53,7 +53,7 @@ class PluginManager(pluginmanagerbase.PluginManagerBase,
|
|||
self.disable_plugins()
|
||||
|
||||
def _on_get_enabled_plugins(self, enabled_plugins):
|
||||
log.debug("Core has these plugins enabled: %s", enabled_plugins)
|
||||
log.debug("Webui has these plugins enabled: %s", enabled_plugins)
|
||||
self.config["enabled_plugins"] = enabled_plugins
|
||||
|
||||
# Enable the plugins that are enabled in the config and core
|
||||
|
|
|
@ -34,7 +34,7 @@ from webserver_common import ws,REVNO,VERSION
|
|||
from utils import *
|
||||
#/relative
|
||||
from deluge import common
|
||||
from lib.webpy022 import changequery as self_url, template, Storage
|
||||
from web import changequery as self_url, template, Storage
|
||||
import os
|
||||
|
||||
class subclassed_render(object):
|
||||
|
|
|
@ -34,7 +34,7 @@ import utils
|
|||
from render import render, error_page
|
||||
import page_decorators as deco
|
||||
import lib.newforms_plus as forms
|
||||
import lib.webpy022 as web
|
||||
import web
|
||||
|
||||
class OptionsForm(forms.Form):
|
||||
download_location = forms.ServerFolder(_("Download Location"))
|
||||
|
|
|
@ -35,7 +35,7 @@ import utils
|
|||
from render import render
|
||||
import page_decorators as deco
|
||||
import lib.newforms_plus as forms
|
||||
import lib.webpy022 as web
|
||||
import web
|
||||
|
||||
#Too much boilerplate code here, todo : fix it.
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import utils
|
|||
from render import template
|
||||
import page_decorators as deco
|
||||
import lib.newforms_plus as forms
|
||||
import lib.webpy022 as web
|
||||
import web
|
||||
|
||||
class TorrentOptionsForm(forms.Form):
|
||||
|
||||
|
|
|
@ -30,12 +30,12 @@
|
|||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
import lib.webpy022 as web
|
||||
import web
|
||||
import os
|
||||
from lib.webpy022.webapi import cookies, setcookie as w_setcookie
|
||||
from lib.webpy022 import changequery as self_url, template
|
||||
from lib.webpy022.utils import Storage
|
||||
from lib.webpy022.http import seeother, url
|
||||
from web import cookies, setcookie as w_setcookie
|
||||
from web import changequery as self_url, template
|
||||
from web import Storage
|
||||
from web import seeother, url
|
||||
|
||||
from deluge.common import fsize,fspeed,ftime
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
#compatibility: use the included version/release of web.py.
|
||||
from lib.webpy022 import *
|
||||
print 'tpl=',template
|
||||
print list(sorted(globals().keys()))
|
Loading…
Reference in New Issue