blaf, poniedziałek 15 czerwca 2009 22:50:
> Here is a link to a bitbucket repo with an app showing how you can
> roughly integrate them.
>
> Have fun!
>
> http://bitbucket.org/blaf/pylonsfckeditor/
I think you should have made a "paster create -t pylons" result as an initial
commit - this would show the
required steps to integrate FCKEditor. Additional commit with an original
FCKEditor distribution would be
even better.
Anyway, let's not forget that FCKEditor ships with a WSGI connector.
To use it, you need to add its route:
diff --git a/pylonsapp/config/routing.py b/pylonsapp/config/routing.py
--- a/pylonsapp/config/routing.py
+++ b/pylonsapp/config/routing.py
@@ -22,6 +22,10 @@ def make_map():
# CUSTOM ROUTES HERE
+ # FCKEditor
+ map.connect('/fckeditor/editor/filemanager/connectors/py/*path_info',
+ controller='fckeditorfileman')
+
And add the controller itself:
diff --git a/pylonsapp/controllers/fckeditorfileman.py
b/pylonsapp/controllers/fckeditorfileman.py
new file mode 100644
index 0000000..38c74f8
--- /dev/null
+++ b/pylonsapp/controllers/fckeditorfileman.py
@@ -0,0 +1,9 @@
+import logging
+
+import pylonsapp.lib.fckeditor.wsgi as fck
+
+log = logging.getLogger(__name__)
+
+def FckeditorfilemanController(environ, start_response):
+ environ['SCRIPT_FILENAME'] = environ['SCRIPT_NAME'] =
environ['wsgiorg.routing_args'][1]['path_info']
+ return fck.App(environ, start_response)
I also had a problem with uploading files - their contents weren't passed
correctly to the connector. A
small hack was needed (is there a better way?)
diff --git a/pylonsapp/lib/fckeditor/fckcommands.py
b/pylonsapp/lib/fckeditor/fckcommands.py
index 2d24923..0b9e079 100644
--- a/pylonsapp/lib/fckeditor/fckcommands.py
+++ b/pylonsapp/lib/fckeditor/fckcommands.py
@@ -129,9 +129,9 @@ class UploadFileCommandMixin (object):
Purpose: command to upload files to server (same as FileUpload)
"""
errorNo = 0
- if self.request.has_key("NewFile"):
+ if 'NewFile' in self.environ['webob._parsed_post_vars'][0]:
# newFile has all the contents we need
- newFile = self.request.get("NewFile", "")
+ newFile =
self.environ['webob._parsed_post_vars'][0]['NewFile']
# Get the file name
newFileName = newFile.filename
newFileName = sanitizeFileName( newFileName )
.pk.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---