~alexharrington/xibo/pyclient-1.1.0a22

« back to all changes in this revision

Viewing changes to server/lib/fckeditor/editor/filemanager/connectors/py/wsgi.py

  • Committer: Dan Garner
  • Date: 2008-12-14 14:42:52 UTC
  • mto: (1.1.80 Xibo)
  • mto: This revision was merged to the branch mainline in revision 2.
  • Revision ID: mail@dangarner.co.uk-20081214144252-8dosaegtfwvv0dsl
Moved 3rd Party libraries to their own folder.
Updated jQuery to the latest revision and now use jQuery UI instead of individual plugins.

Tabs are not currently working

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
 
3
 
"""
4
 
FCKeditor - The text editor for Internet - http://www.fckeditor.net
5
 
Copyright (C) 2003-2007 Frederico Caldeira Knabben
6
 
 
7
 
== BEGIN LICENSE ==
8
 
 
9
 
Licensed under the terms of any of the following licenses at your
10
 
choice:
11
 
 
12
 
 - GNU General Public License Version 2 or later (the "GPL")
13
 
   http://www.gnu.org/licenses/gpl.html
14
 
 
15
 
 - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
16
 
   http://www.gnu.org/licenses/lgpl.html
17
 
 
18
 
 - Mozilla Public License Version 1.1 or later (the "MPL")
19
 
   http://www.mozilla.org/MPL/MPL-1.1.html
20
 
 
21
 
== END LICENSE ==
22
 
 
23
 
Connector/QuickUpload for Python (WSGI wrapper).
24
 
 
25
 
See config.py for configuration settings
26
 
 
27
 
"""
28
 
 
29
 
from connector import FCKeditorConnector
30
 
from upload import FCKeditorQuickUpload
31
 
 
32
 
import cgitb
33
 
from cStringIO import StringIO
34
 
 
35
 
# Running from WSGI capable server (recomended)
36
 
def App(environ, start_response): 
37
 
        "WSGI entry point. Run the connector"
38
 
        if environ['SCRIPT_NAME'].endswith("connector.py"):
39
 
                conn = FCKeditorConnector(environ)
40
 
        elif environ['SCRIPT_NAME'].endswith("upload.py"):
41
 
                conn = FCKeditorQuickUpload(environ)
42
 
        else:
43
 
                start_response ("200 Ok", [('Content-Type','text/html')])
44
 
                yield "Unknown page requested: "
45
 
                yield environ['SCRIPT_NAME']
46
 
                return
47
 
        try:
48
 
                # run the connector
49
 
                data = conn.doResponse()
50
 
                # Start WSGI response:
51
 
                start_response ("200 Ok", conn.headers)
52
 
                # Send response text
53
 
                yield data
54
 
        except:
55
 
                start_response("500 Internal Server Error",[("Content-type","text/html")])
56
 
                file = StringIO()
57
 
                cgitb.Hook(file = file).handle()    
58
 
                yield file.getvalue()