[Z3lab-checkins] r3156 - azax/branches/kss2

2006-05-17 Thread bree
Author: bree
Date: Wed May 17 16:27:36 2006
New Revision: 3156

Removed:
   azax/branches/kss2/

Log:

-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r3155 - azax/branches/kss2

2006-05-17 Thread bree
Author: bree
Date: Wed May 17 16:26:11 2006
New Revision: 3155

Added:
   azax/branches/kss2/

Log:

-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r3154 - azax/trunk

2006-05-17 Thread bree
Author: bree
Date: Wed May 17 16:11:35 2006
New Revision: 3154

Modified:
   azax/trunk/INSTALL.txt

Log:
Test...

Modified: azax/trunk/INSTALL.txt
==
--- azax/trunk/INSTALL.txt  (original)
+++ azax/trunk/INSTALL.txt  Wed May 17 16:11:35 2006
@@ -60,3 +60,4 @@
 Copy the product azaxdemo that's inside demos in your instance,
 and look at its own README.txt
 
+
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r3120 - azax/trunk/plugins/json

2006-05-13 Thread bree
Author: bree
Date: Sat May 13 14:25:22 2006
New Revision: 3120

Modified:
   azax/trunk/plugins/json/interfaces.py

Log:
Adapt to merge trunk of jsonserver

Modified: azax/trunk/plugins/json/interfaces.py
==
--- azax/trunk/plugins/json/interfaces.py   (original)
+++ azax/trunk/plugins/json/interfaces.py   Sat May 13 14:25:22 2006
@@ -23,7 +23,10 @@
 from zope.interface import Interface
 
 if HAS_JSON:
-from Products.jsonserver.interfaces import IJsonRequest
+try:
+from Products.jsonserver.interfaces import IJsonRequest
+except ImportError:
+from Products.jsonserver.z2_compatibility.interfaces import 
IJsonRequest
 from Products.jsonserver.minjson.interfaces import IJSONStreamWriteable, 
IJSONWriter
 else:
 # If jsonserver is not present, we just define interfaces
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r3104 - azax/trunk/plugins/json/browser

2006-05-12 Thread bree
Author: bree
Date: Fri May 12 11:16:04 2006
New Revision: 3104

Modified:
   azax/trunk/plugins/json/browser/jsonkukit.js

Log:
Clean up instantiation of JSONMethod

Modified: azax/trunk/plugins/json/browser/jsonkukit.js
==
--- azax/trunk/plugins/json/browser/jsonkukit.js(original)
+++ azax/trunk/plugins/json/browser/jsonkukit.jsFri May 12 11:16:04 2006
@@ -22,7 +22,7 @@
// default timeout is 4 sec... a sane choice
timeout = 4000;
}
-return makeJSONRPCMethod(url, methodName, kukit.jsonCallback, 
kukit.jsonError,
+return new JSONRPCMethod(url, methodName, kukit.jsonCallback, 
kukit.jsonError,
4000, null, null, kukit.requestManager);
 }
 
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r3102 - azax/trunk/plugins/json/browser

2006-05-12 Thread bree
Author: bree
Date: Fri May 12 09:40:08 2006
New Revision: 3102

Modified:
   azax/trunk/plugins/json/browser/jsonkukit.js

Log:
jsonserver support: use method call of JSON-RPC 1.1 proposal

Modified: azax/trunk/plugins/json/browser/jsonkukit.js
==
--- azax/trunk/plugins/json/browser/jsonkukit.js(original)
+++ azax/trunk/plugins/json/browser/jsonkukit.jsFri May 12 09:40:08 2006
@@ -31,7 +31,7 @@
 // sending form, with standard form parameters.
 var form_data = kukit.extractFormQuery(target).toDict();
 var method = kukit.makeJSONKukitMethod(url, null);
-   method(PythonKw(form_data));
+   method(form_data);
 }
 
 kukit.jsonCallback = function(result) {
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r3072 - in azax/trunk: . demos/azaxdemo demos/azaxdemo/browser

2006-05-07 Thread bree
Author: bree
Date: Sun May  7 22:29:57 2006
New Revision: 3072

Added:
   azax/trunk/demos/azaxdemo/browser/azax_demo.kss
Modified:
   azax/trunk/configure.zcml
   azax/trunk/demos/azaxdemo/browser/azax_demo.pt
   azax/trunk/demos/azaxdemo/configure.zcml

Log:
Making kss to work; transform 1st demo

Modified: azax/trunk/configure.zcml
==
--- azax/trunk/configure.zcml   (original)
+++ azax/trunk/configure.zcml   Sun May  7 22:29:57 2006
@@ -11,7 +11,16 @@
   />
 
   
 

Added: azax/trunk/demos/azaxdemo/browser/azax_demo.kss
==
--- (empty file)
+++ azax/trunk/demos/azaxdemo/browser/azax_demo.kss Sun May  7 22:29:57 2006
@@ -0,0 +1,23 @@
+ 
+button#copyFrom:click {
+remote: copyFromDivContent;
+}
+
+button#copyTo:click {
+remote: copyToDivContent;
+}
+
+button#moveTo:click {
+remote: moveToDivContent;
+}
+
+button#clear:click {
+remote: clearDivContent;
+}
+
+button#change:click {
+remote: getDivContent;
+log: "WE LOG from getDivContent";
+/*alert: "WE LOG from getDivContent"; */
+}
+

Modified: azax/trunk/demos/azaxdemo/browser/azax_demo.pt
==
--- azax/trunk/demos/azaxdemo/browser/azax_demo.pt  (original)
+++ azax/trunk/demos/azaxdemo/browser/azax_demo.pt  Sun May  7 22:29:57 2006
@@ -1,7 +1,9 @@
 
   
-
+
+
 
   
   

Modified: azax/trunk/demos/azaxdemo/configure.zcml
==
--- azax/trunk/demos/azaxdemo/configure.zcml(original)
+++ azax/trunk/demos/azaxdemo/configure.zcmlSun May  7 22:29:57 2006
@@ -53,6 +53,12 @@
 file="browser/azax_demo.kukit"
 name="azax_demo.kukit"
 />
+   
+  
+
 
   http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r3053 - azax/trunk/plugins

2006-05-06 Thread bree
Author: bree
Date: Sat May  6 14:40:33 2006
New Revision: 3053

Modified:
   azax/trunk/plugins/registry.py

Log:
Fix excess replication of addon files

Modified: azax/trunk/plugins/registry.py
==
--- azax/trunk/plugins/registry.py  (original)
+++ azax/trunk/plugins/registry.py  Sat May  6 14:40:33 2006
@@ -81,5 +81,5 @@
 except AttributeError:
 # Lazy setup of addon files
 self._addon_files = files = getJsonAddonFiles()
-files.extend(self.jsfiles.keys())
+files.extend(self.jsfiles.keys())
 return files
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r3024 - azax/trunk

2006-05-02 Thread bree
Author: bree
Date: Tue May  2 16:17:17 2006
New Revision: 3024

Modified:
   azax/trunk/   (props changed)
   azax/trunk/EXTERNALS.TXT
Log:
Promote plugin branch

Modified: azax/trunk/EXTERNALS.TXT
==
--- azax/trunk/EXTERNALS.TXT(original)
+++ azax/trunk/EXTERNALS.TXTTue May  2 16:17:17 2006
@@ -5,4 +5,4 @@
 # You can update your working dir by: 
 # svn propset svn:externals -F EXTERNALS.TXT .
 #
-kukit http://codespeak.net/svn/kukit/branch/plugin
+kukit http://codespeak.net/svn/kukit/trunk
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r3023 - in azax: branches/plugin trunk

2006-05-02 Thread bree
Author: bree
Date: Tue May  2 16:15:49 2006
New Revision: 3023

Added:
   azax/trunk/
  - copied from r3022, azax/branches/plugin/
Removed:
   azax/branches/plugin/
Log:
Promote plugin branch
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r3022 - azax/trunk

2006-05-02 Thread bree
Author: bree
Date: Tue May  2 16:15:32 2006
New Revision: 3022

Removed:
   azax/trunk/
Log:
Promote plugin branch
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r2959 - azax/branches/plugin

2006-04-24 Thread bree
Author: bree
Date: Mon Apr 24 13:52:37 2006
New Revision: 2959

Modified:
   azax/branches/plugin/commands.py
Log:
Fix

Modified: azax/branches/plugin/commands.py
==
--- azax/branches/plugin/commands.py(original)
+++ azax/branches/plugin/commands.pyMon Apr 24 13:52:37 2006
@@ -106,8 +106,9 @@
 self.request.debug = None
 
 # Force parameters content to be unicode
-for param in self.getParams():
-param.force_content_unicode()
+for command in context:
+for param in command.getParams():
+param.force_content_unicode()
 
 # XML output gets rendered via a page template
 # XXX note: barefoot rendering, use python: only after zope2.9
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r2923 - azax/branches/plugin

2006-04-21 Thread bree
Author: bree
Date: Fri Apr 21 13:40:50 2006
New Revision: 2923

Modified:
   azax/branches/plugin/commands.py
Log:
Parameter value should restrict to string only later, this way it can be 
avoided with the new style transport

Modified: azax/branches/plugin/commands.py
==
--- azax/branches/plugin/commands.py(original)
+++ azax/branches/plugin/commands.pyFri Apr 21 13:40:50 2006
@@ -39,8 +39,11 @@
 
 def __init__(self, name, content=''):
 self.name = name
+self.content = content
+
+def force_content_unicode(self):
 # Content must be str with ascii encoding, or unicode!
-self.content = force_unicode(content)
+self.content = force_unicode(self.content)
 
 def getName(self):
 return self.name
@@ -101,6 +104,10 @@
 # is available from the page template.
 if not hasattr(self.request, 'debug'):
 self.request.debug = None
+
+# Force parameters content to be unicode
+for param in self.getParams():
+param.force_content_unicode()
 
 # XML output gets rendered via a page template
 # XXX note: barefoot rendering, use python: only after zope2.9
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r2911 - in azax/branches/plugin: . browser

2006-04-20 Thread bree
Author: bree
Date: Thu Apr 20 12:15:56 2006
New Revision: 2911

Modified:
   azax/branches/plugin/browser/kukitresponse.pt
   azax/branches/plugin/commands.py
Log:
Fix (XML) rendering of the commands for Zope2.9

Note: We don't use proper views for Five. As our context object
is not even a proper Zope content. There would be a way to:

- use ZopeTwoPageTemplateFile
- and, make the object to be proper zope content.

This would be two much ado for nothing, so we just use barefoot
rendering but as a consequence no path expression, only python:
is available from the page template.

I also needed to set up manually request.debug, this could
probably have been avoided if I use the proper view class
or the proper page template class.


Modified: azax/branches/plugin/browser/kukitresponse.pt
==
--- azax/branches/plugin/browser/kukitresponse.pt   (original)
+++ azax/branches/plugin/browser/kukitresponse.pt   Thu Apr 20 12:15:56 2006
@@ -5,15 +5,15 @@
   xmlns:metal="http://xml.zope.org/namespaces/metal";
   xmlns:i18n="http://xml.zope.org/namespaces/i18n";>
 
-   
-   http://www.w3.org/1999/xhtml";>it worked
-   
+ selector="div#demo" name="setHtmlAsChild" 
+ selectorType=""
+ tal:attributes="selector python: command.getSelector();
+ name python: command.getName();
+ selectorType python: command.getSelectorType()">
+
+http://www.w3.org/1999/xhtml";>it worked
+
 
 

Modified: azax/branches/plugin/commands.py
==
--- azax/branches/plugin/commands.py(original)
+++ azax/branches/plugin/commands.pyThu Apr 20 12:15:56 2006
@@ -89,8 +89,21 @@
 def __init__(self, context, request):
 self.context = context
 self.request = request
+# XXX From Zope2.9 we need this.
+# Note: We don't use proper views for Five. As our context object
+# is not even a proper Zope content. There would be a way to:
+#
+# - use ZopeTwoPageTemplateFile
+# - and, make the object to be proper zope content.
+#
+# This would be two much ado for nothing, so we just use barefoot
+# rendering but as a consequence no path expression, only python:
+# is available from the page template.
+if not hasattr(self.request, 'debug'):
+self.request.debug = None
 
 # XML output gets rendered via a page template
+# XXX note: barefoot rendering, use python: only after zope2.9
 render = ViewPageTemplateFile('browser/kukitresponse.pt', 
content_type='text/xml;charset=utf-8')
 
 #def render(self):
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r2910 - azax/branches/plugin/plugins/json

2006-04-20 Thread bree
Author: bree
Date: Thu Apr 20 12:13:58 2006
New Revision: 2910

Modified:
   azax/branches/plugin/plugins/json/interfaces.py
   azax/branches/plugin/plugins/json/utils.py
Log:
Fix bugs

Modified: azax/branches/plugin/plugins/json/interfaces.py
==
--- azax/branches/plugin/plugins/json/interfaces.py (original)
+++ azax/branches/plugin/plugins/json/interfaces.py Thu Apr 20 12:13:58 2006
@@ -38,5 +38,5 @@
 class IJSONStreamWriteable(Interface):
 'Interface never to be implemented'
 
-class IJsonWriter(Interface):
+class IJSONWriter(Interface):
 'Interface never to be implemented'

Modified: azax/branches/plugin/plugins/json/utils.py
==
--- azax/branches/plugin/plugins/json/utils.py  (original)
+++ azax/branches/plugin/plugins/json/utils.py  Thu Apr 20 12:13:58 2006
@@ -16,6 +16,7 @@
 # Add the jsonserver files
 request = TestRequest()
 # use the files already registered to that concat resource
+# XXX TODO DEPREC warning. Change this to getAdapter.
 jsonrpc = zope.component.getResource('jsonrpc.js', request)
 files.extend(jsonrpc.context.context.getPathList())
 # add the json kukit support file
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r2906 - in azax/branches/plugin: demos/azaxdemo/browser plugins

2006-04-19 Thread bree
Author: bree
Date: Wed Apr 19 23:03:52 2006
New Revision: 2906

Modified:
   azax/branches/plugin/demos/azaxdemo/browser/azax_demo.kukit
   azax/branches/plugin/plugins/configure.zcml
Log:
Add sample action types for logging

Modified: azax/branches/plugin/demos/azaxdemo/browser/azax_demo.kukit
==
--- azax/branches/plugin/demos/azaxdemo/browser/azax_demo.kukit (original)
+++ azax/branches/plugin/demos/azaxdemo/browser/azax_demo.kukit Wed Apr 19 
23:03:52 2006
@@ -19,6 +19,8 @@
 
 
getDivContent
+   
+   

   
 

Modified: azax/branches/plugin/plugins/configure.zcml
==
--- azax/branches/plugin/plugins/configure.zcml (original)
+++ azax/branches/plugin/plugins/configure.zcml Wed Apr 19 23:03:52 2006
@@ -75,7 +75,7 @@
   name="executeCode"
   />
   
- 
+ 
 
 
 
+ 
+
 
 
+
+
+
+
+
+
 
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r2905 - in azax/branches/plugin: demos/azaxdemo/browser plugins tests

2006-04-19 Thread bree
Author: bree
Date: Wed Apr 19 22:26:59 2006
New Revision: 2905

Added:
   azax/branches/plugin/plugins/event_action.py
   azax/branches/plugin/plugins/event_type.py
Modified:
   azax/branches/plugin/demos/azaxdemo/browser/azax_demo.kukit
   azax/branches/plugin/demos/azaxdemo/browser/azax_three_autoupdate.kukit
   azax/branches/plugin/demos/azaxdemo/browser/cancel_submit.kukit
   azax/branches/plugin/plugins/__init__.py
   azax/branches/plugin/plugins/configure.py
   azax/branches/plugin/plugins/configure.zcml
   azax/branches/plugin/plugins/directives.py
   azax/branches/plugin/plugins/meta.zcml
   azax/branches/plugin/tests/test_azaxview.py
Log:
Extend registry with events/actions; fix tests

Modified: azax/branches/plugin/demos/azaxdemo/browser/azax_demo.kukit
==
--- azax/branches/plugin/demos/azaxdemo/browser/azax_demo.kukit (original)
+++ azax/branches/plugin/demos/azaxdemo/browser/azax_demo.kukit Wed Apr 19 
22:26:59 2006
@@ -10,9 +10,15 @@
 moveToDivContent
   
   
-clearDivContent
+
+   
+   clearDivContent
+   
   
   
-getDivContent
+
+
+   getDivContent
+   
   
 

Modified: 
azax/branches/plugin/demos/azaxdemo/browser/azax_three_autoupdate.kukit
==
--- azax/branches/plugin/demos/azaxdemo/browser/azax_three_autoupdate.kukit 
(original)
+++ azax/branches/plugin/demos/azaxdemo/browser/azax_three_autoupdate.kukit 
Wed Apr 19 22:26:59 2006
@@ -1,9 +1,15 @@
 
 
   
-getCurrentTime 2000
+
+
+   getCurrentTime
+   
   
   
-getAutoupdateMarkup
+
+
+   getAutoupdateMarkup
+   
   
 

Modified: azax/branches/plugin/demos/azaxdemo/browser/cancel_submit.kukit
==
--- azax/branches/plugin/demos/azaxdemo/browser/cancel_submit.kukit 
(original)
+++ azax/branches/plugin/demos/azaxdemo/browser/cancel_submit.kukit Wed Apr 
19 22:26:59 2006
@@ -1,6 +1,9 @@
 
 
   
-save
+
+
+   save
+   
   
 

Modified: azax/branches/plugin/plugins/__init__.py
==
--- azax/branches/plugin/plugins/__init__.py(original)
+++ azax/branches/plugin/plugins/__init__.pyWed Apr 19 22:26:59 2006
@@ -5,3 +5,5 @@
 from registry import AzaxPluginError
 from plugin import registerPlugin
 from command import Command
+from event_type import EventType
+from event_action import EventAction

Modified: azax/branches/plugin/plugins/configure.py
==
--- azax/branches/plugin/plugins/configure.py   (original)
+++ azax/branches/plugin/plugins/configure.py   Wed Apr 19 22:26:59 2006
@@ -1,6 +1,8 @@
 
 import os.path
 from command import Command
+from event_type import EventType
+from event_action import EventAction
 from plugin import registerPlugin
 
 #class AzaxConfigurationError(Exception):
@@ -18,3 +20,29 @@
 callable = registerPlugin,
 args = (Command, name, jsfile),
 )
+
+def registerEventType(_context, name, jsfile=None):
+'Directive that registers an event type' 
+
+# check to see if the file exists
+if jsfile is not None:
+file(jsfile, 'rb').close()
+
+_context.action(
+discriminator = ('registerAzaxEventType', name, jsfile),
+callable = registerPlugin,
+args = (EventType, name, jsfile),
+)
+ 
+def registerEventAction(_context, name, jsfile=None):
+'Directive that registers an event action' 
+
+# check to see if the file exists
+if jsfile is not None:
+file(jsfile, 'rb').close()
+
+_context.action(
+discriminator = ('registerAzaxEventAction', name, jsfile),
+callable = registerPlugin,
+args = (EventAction, name, jsfile),
+)

Modified: azax/branches/plugin/plugins/configure.zcml
==
--- azax/branches/plugin/plugins/configure.zcml (original)
+++ azax/branches/plugin/plugins/configure.zcml Wed Apr 19 22:26:59 2006
@@ -14,6 +14,16 @@
   name="myCustomCommand"
   jsfile="browser/my_plugins.js"
   />
+  
+  
+  
+  
   
  -->
 
@@ -65,4 +75,22 @@
   name="executeCode"
   />
   
+ 
+
+
+  
+
+
+
+
+
+
 

Modified: azax/branches/plugin/plugins/directives.py
==
--- azax/branches/plugin/plugins/directives.py  (original)
+++ azax/branches/plugin/plugins/directives.py  Wed Apr 19 22:26:59 2006
@@ -16,3 +16,33 @@

[Z3lab-checkins] r2875 - azax/branches/plugin/plugins/json/browser

2006-04-18 Thread bree
Author: bree
Date: Tue Apr 18 19:05:38 2006
New Revision: 2875

Modified:
   azax/branches/plugin/plugins/json/browser/jsonkukit.js
Log:
Implement registry for new style command plugins

Modified: azax/branches/plugin/plugins/json/browser/jsonkukit.js
==
--- azax/branches/plugin/plugins/json/browser/jsonkukit.js  (original)
+++ azax/branches/plugin/plugins/json/browser/jsonkukit.js  Tue Apr 18 
19:05:38 2006
@@ -4,16 +4,33 @@
 *
 * This gets included when json plugins are registered.
 *
-* We overwrite notifyServer and at one point we return to the
-* normal execution chain (after results are received)
+* This transparently replaces the normal transport with JSON.
+* To do this, we overwrite notifyServer and at one point we 
+* return to the normal execution chain (after results are received).
+* (We need to do this because even an old style event plugin may
+* invoke new style command plugins as a response.)
+*
+* To manually call the server from an event plugin, the
+* makeJSONKukitMethod function should be used to create a
+* proxy method.
 */
 
+kukit.makeJSONKukitMethod = function(url, methodName, timeout) {
+   // url and methodName can be used, 
+   // or methodName can be set to null and url will be used as a full url.
+   if (typeof(timeout) == 'undefined' || timeout == null) {
+   // default timeout is 4 sec... a sane choice
+   timeout = 4000;
+   }
+return makeJSONRPCMethod(url, methodName, kukit.jsonCallback, 
kukit.jsonError,
+   4000, null, null, kukit.requestManager);
+}
+
+// OVERWRITE kukit.js
 kukit.notifyServer = function(url, target) {
-// sending form
+// sending form, with standard form parameters.
 var form_data = kukit.extractFormQuery(target).toDict();
-// XXX set a standard 4 sec timeout... a sane choice
-var method = makeJSONRPCMethod(url, '', kukit.jsonCallback, 
kukit.jsonError,
-   4000, null, null, kukit.requestManager);
+var method = kukit.makeJSONKukitMethod(url, null);
method(PythonKw(form_data));
 }
 
@@ -29,51 +46,89 @@
 
 /* Command execution */
 
+// OVERWRITE kukit.js
 kukit.CommandProcessor.prototype.parseCommand = function(command) {
-// For the sake of old commands compatibility, we need to convert
-// all the commands to DOM.
-var new_params = {};
-for (var name in command.params) {
-var param = command.params[name];
-
-   //
-// now convert to dom
-   //
-   
-   //param = 
"test_xmlentitytictac toe";
-   // ***BROKEN*** param = 
"test_htmlentitytictac toe";
-   //param = 
"test_utf8tictacűtoe";
-
-   // This is a good solution since it does not do magic to
-   // our html - BUT html is parsed as xml
-   // so we currently preprocess it to remove html entities
-   // from it.
-   //
-   var root_txt = 'http://www.w3.org/1999/xhtml";>' + param + '';
-   var doc = (new DOMParser()).parseFromString(root_txt, "text/xml");
-   var root = doc.getElementsByTagName('div')[0];
-
-   // This would be the perfect solution: insert our stuff
-   // into the main document that is, since it is html,
-   // will parse html in correctly. But the problem is
-   // that is also sensitive to context which we have not
-   // at this point yet. So:  will not work since
-   // we have no embedding select, etc...
-   // -->> gets broken with both MOZILLA and IE
-   //
-   //var root = document.createElement('html');
-   //root.innerHTML = param;
-   //
-   // XXX Sarissa bug; html docs would not have a
-   // working serialize, and so importNodes would fail on them.
-   // XXX Fixed in: Revision 1.23  - Sun Jul 10 18:53:53 2005 UTC
-   // use at least 0.9.6.1
-   
-new_params[name] = root;
-   //alert(Sarissa.serialize(root));
-}
-command.params = new_params;
 // Add the command.
 this.addCommand(command);
 } 
 
+kukit.CommandRegistry.prototype.forceJsonRegistry = function() {
+   if (typeof(this.jsonContent) == 'undefined') {
+   this.jsonContent = {};
+   this.jsonNr = 0; 
+   }
+}
+
+kukit.CommandRegistry.prototype.registerJson = function(name, func) {
+   this.forceJsonRegistry();
+   // Register a new style (json) command.
+   if (this.jsonContent[name] || this.content[name]) {
+// Do not allow redefinition
+kukit.logError('Error : redefinition attempt of command ' + 

[Z3lab-checkins] r2868 - azax/branches/plugin/plugins/json/browser

2006-04-18 Thread bree
Author: bree
Date: Tue Apr 18 17:08:13 2006
New Revision: 2868

Modified:
   azax/branches/plugin/plugins/json/browser/jsonkukit.js
Log:
modified the usage of the request manager for json style plugins

Modified: azax/branches/plugin/plugins/json/browser/jsonkukit.js
==
--- azax/branches/plugin/plugins/json/browser/jsonkukit.js  (original)
+++ azax/branches/plugin/plugins/json/browser/jsonkukit.js  Tue Apr 18 
17:08:13 2006
@@ -8,37 +8,23 @@
 * normal execution chain (after results are received)
 */
 
-kukit.makeJsonMethod = function(url, callback, error, timeout) {
-// Constructing a json method call handler.
-// It is more steps because the input is not in the form
-// how the JSON-RPC logic would require it.
-var pieces = url.split('/');
-var methodName = pieces.pop();
-var base = pieces.join('/');
-var proxy = new JSONRPC(base);
-proxy.addMethod(methodName, callback, error, timeout);
-return proxy[methodName];
-}
-
 kukit.notifyServer = function(url, target) {
 // sending form
 var form_data = kukit.extractFormQuery(target).toDict();
 // XXX set a standard 4 sec timeout... a sane choice
-var method = kukit.makeJsonMethod(url, jsonCallback, jsonError, 4000);
-   var method_with_parms = partial(method, PythonKw(form_data));
-kukit.requestManager.notifyServer(method_with_parms, url);
+var method = makeJSONRPCMethod(url, '', kukit.jsonCallback, 
kukit.jsonError,
+   4000, null, null, kukit.requestManager);
+   method(PythonKw(form_data));
 }
 
-function jsonCallback(result) {
-kukit.requestManager.receivedResult();
+kukit.jsonCallback = function(result) {
 var command_processor = new kukit.CommandProcessor();
 command_processor.parseCommands(result);
 command_processor.executeCommands();
 }
 
-function jsonError(result) {
-kukit.requestManager.receivedResult();
-alert('ERROR ' + result); 
+kukit.jsonError = function(result) {
+kukit.logError('JSON call failed: ' + result); 
 }
 
 /* Command execution */
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r2861 - azax/branches/json

2006-04-17 Thread bree
Author: bree
Date: Mon Apr 17 17:17:39 2006
New Revision: 2861

Removed:
   azax/branches/json/
Log:
Deleted now obsolete and useless json branch
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r2860 - in azax/branches/plugin/plugins: . json json/browser

2006-04-17 Thread bree
Author: bree
Date: Mon Apr 17 16:57:53 2006
New Revision: 2860

Added:
   azax/branches/plugin/plugins/json/
   azax/branches/plugin/plugins/json/__init__.py
   azax/branches/plugin/plugins/json/browser/
   azax/branches/plugin/plugins/json/browser/jsonkukit.js
   azax/branches/plugin/plugins/json/config.py
   azax/branches/plugin/plugins/json/configure.zcml
   azax/branches/plugin/plugins/json/interfaces.py
   azax/branches/plugin/plugins/json/utils.py
Modified:
   azax/branches/plugin/plugins/configure.zcml
   azax/branches/plugin/plugins/registry.py
Log:
Added JSON plugin support

- it is loaded only as an option
- tested with demo1 (change tag contents) and two_select on:
   Mozilla, IE6, Konqueror3.5.2, Opera8

- tested With and Without the presence of Json

 * only problem: IE breaks two_select in any way, that's
   an IE bug, http://support.microsoft.com/default.aspx?scid=kb;en-us;276228


Modified: azax/branches/plugin/plugins/configure.zcml
==
--- azax/branches/plugin/plugins/configure.zcml (original)
+++ azax/branches/plugin/plugins/configure.zcml Mon Apr 17 16:57:53 2006
@@ -6,6 +6,8 @@
 
 
 
+
+
  > gets broken with both MOZILLA and IE
+   //
+   //var root = document.createElement('html');
+   //root.innerHTML = param;
+   //
+   // XXX Sarissa bug; html docs would not have a
+   // working serialize, and so importNodes would fail on them.
+   // XXX Fixed in: Revision 1.23  - Sun Jul 10 18:53:53 2005 UTC
+   // use at least 0.9.6.1
+   
+new_params[name] = root;
+   //alert(Sarissa.serialize(root));
+}
+command.params = new_params;
+// Add the command.
+this.addCommand(command);
+} 
+

Added: azax/branches/plugin/plugins/json/config.py
==
--- (empty file)
+++ azax/branches/plugin/plugins/json/config.py Mon Apr 17 16:57:53 2006
@@ -0,0 +1,7 @@
+ 
+try:
+import Products.jsonserver
+except ImportError:
+HAS_JSON = False
+else:
+HAS_JSON = True

Added: azax/branches/plugin/plugins/json/configure.zcml
==
--- (empty file)
+++ azax/branches/plugin/plugins/json/configure.zcmlMon Apr 17 16:57:53 2006
@@ -0,0 +1,31 @@
+http://namespaces.zope.org/zope";
+   xmlns:browser="http://namespaces.zope.org/browser";
+   xmlns:five="http://namespaces.zope.org/five";>
+ 
+
+
+
+
+ 
+
+
+
+

Added: azax/branches/plugin/plugins/json/interfaces.py
==
--- (empty file)
+++ azax/branches/plugin/plugins/json/interfaces.py Mon Apr 17 16:57:53 2006
@@ -0,0 +1,42 @@
+# -*- coding: ISO-8859-15 -*-
+# Copyright (c) 2005
+# Authors:
+#   Godefroid Chapelle <[EMAIL PROTECTED]>
+#   Tarek Ziad� <[EMAIL PROTECTED]>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+#
+
+from config import HAS_JSON
+from zope.interface import Interface
+
+if HAS_JSON:
+from Products.jsonserver.interfaces import IJsonRequest
+from Products.jsonserver.minjson.interfaces import IJSONStreamWriteable, 
IJSONWriter
+else:
+# If jsonserver is not present, we just define interfaces
+# that noone implements so the adapters will never be looked up.
+# This is because the zcml will try to import these.
+# XXX occasionally this should be done from the zcml, 
+# via features/conditionals!
+
+class IJsonRequest(Interface):
+'Interface never to be implemented'
+
+class IJSONStreamWriteable(Interface):
+'Interface never to be implemented'
+
+class IJsonWriter(Interface):
+'Interface never to be implemented'

Added: azax/branches/plugin/plugins/json/utils.py
==
--- (empty file)
+++ azax/branches/plugin/plugins/json/utils.py  Mon Apr 17 16:57:53 2006
@@ -0,0 +1,56 @@
+'''\
+Supplemental support for json plugins
+'''
+
+import os.path
+import zope.component
+from zope.interface 

[Z3lab-checkins] r2859 - azax/branches/plugin

2006-04-17 Thread bree
Author: bree
Date: Mon Apr 17 16:00:37 2006
New Revision: 2859

Modified:
   azax/branches/plugin/commands.py
   azax/branches/plugin/parsers.py
Log:
refactor html named entit replacement, now it is done as standard part of the 
parsing.

Modified: azax/branches/plugin/commands.py
==
--- azax/branches/plugin/commands.py(original)
+++ azax/branches/plugin/commands.pyMon Apr 17 16:00:37 2006
@@ -30,7 +30,6 @@
 from interfaces import IAzaxCommands, IAzaxCommand, IAzaxParam
 from plugins import Command
 from unicode_quirks import force_unicode
-import re, htmlentitydefs
 
 class AzaxCommands(list):
 implements(IAzaxCommands)
@@ -86,25 +85,14 @@
 The render method does actual marshalling
 of the commands to be sent to the client.
 '''
-
-_entity_regexp = re.compile(r"&([a-zA-Z]+);")
 
 def __init__(self, context, request):
 self.context = context
 self.request = request
 
 # XML output gets rendered via a page template
-_render = ViewPageTemplateFile('browser/kukitresponse.pt', 
content_type='text/xml;charset=utf-8')
+render = ViewPageTemplateFile('browser/kukitresponse.pt', 
content_type='text/xml;charset=utf-8')
 
-# replace named entities to fix a bug in IE
-def render(self):
-name2codepoint = htmlentitydefs.name2codepoint
-def entity_replacer(m):
-value = name2codepoint.get(m.group(1))
-if value is None:
-return m.group(0)
-return "&#%i;" % value
-
-result = self._render()
-result = self._entity_regexp.sub(entity_replacer, result)
-return result
+#def render(self):
+#result = self._render()
+#return result

Modified: azax/branches/plugin/parsers.py
==
--- azax/branches/plugin/parsers.py (original)
+++ azax/branches/plugin/parsers.py Mon Apr 17 16:00:37 2006
@@ -29,6 +29,25 @@
 '''
 
 from unicode_quirks import force_unicode
+import re, htmlentitydefs
+
+class replace_html_named_entities(object):
+
+_entity_regexp = re.compile(r'&([A-Za-z]+);')
+
+def _entity_replacer(m):
+value = htmlentitydefs.name2codepoint.get(m.group(1))
+if value is None:
+return m.group(0)
+return "&#%i;" % value
+_entity_replacer = staticmethod(_entity_replacer)
+
+def _replace(cls, value):
+return cls._entity_regexp.sub(cls._entity_replacer, value)
+_replace = classmethod(_replace)
+
+def __new__(cls, value):
+return cls._replace(value)
 
 class XmlParser(object):
 '''Custom XML parser
@@ -64,4 +83,10 @@
 #tag['xmlns'] = "http://www.w3.org/1999/xhtml";
 
 def __call__(self):
-return unicode(self.soup)
+value = unicode(self.soup)
+# Replace named HTML entitied in each case.
+# This is necessary for two reasons:
+# 1. Fixes an IE bug.
+# 2. Needed for the alternate transport mechanism to work.
+value = replace_html_named_entities(value)
+return value
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r2858 - azax/branches/plugin

2006-04-17 Thread bree
Author: bree
Date: Mon Apr 17 15:42:22 2006
New Revision: 2858

Modified:
   azax/branches/plugin/parsers.py
Log:
commented out adding of xmlns namespace to 1st level tags in the kukit params; 
I think this is not needed any more, after kukit patches r25865, r25866

Modified: azax/branches/plugin/parsers.py
==
--- azax/branches/plugin/parsers.py (original)
+++ azax/branches/plugin/parsers.py Mon Apr 17 15:42:22 2006
@@ -56,8 +56,12 @@
 def __init__(self, value):
 value = force_unicode(value)
 self.soup = self.BeautifulSoup(value)
-for tag in self.soup.fetch(recursive=False):
-tag['xmlns'] = "http://www.w3.org/1999/xhtml";
+#
+# XXX ree: I think these are not needed any more. See
+# kukit patches r25865, r25866 that IMO fix this on IE.
+#
+#for tag in self.soup.fetch(recursive=False):
+#tag['xmlns'] = "http://www.w3.org/1999/xhtml";
 
 def __call__(self):
 return unicode(self.soup)
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r2856 - azax/branches/plugin

2006-04-15 Thread bree
Author: bree
Date: Sat Apr 15 23:32:46 2006
New Revision: 2856

Modified:
   azax/branches/plugin/configure.zcml
Log:
comment

Modified: azax/branches/plugin/configure.zcml
==
--- azax/branches/plugin/configure.zcml (original)
+++ azax/branches/plugin/configure.zcml Sat Apr 15 23:32:46 2006
@@ -2,6 +2,7 @@
xmlns:browser="http://namespaces.zope.org/browser";
xmlns:five="http://namespaces.zope.org/five";>
  
+  
   
 
   http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r2852 - azax/branches/plugin

2006-04-15 Thread bree
Author: bree
Date: Sat Apr 15 09:55:58 2006
New Revision: 2852

Modified:
   azax/branches/plugin/commands.py
   azax/branches/plugin/interfaces.py
Log:
Add interfaces for command elements

Modified: azax/branches/plugin/commands.py
==
--- azax/branches/plugin/commands.py(original)
+++ azax/branches/plugin/commands.pySat Apr 15 09:55:58 2006
@@ -27,7 +27,7 @@
 
 from zope.interface import implements
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
-from interfaces import IAzaxCommands
+from interfaces import IAzaxCommands, IAzaxCommand, IAzaxParam
 from plugins import Command
 from unicode_quirks import force_unicode
 import re, htmlentitydefs
@@ -36,6 +36,7 @@
 implements(IAzaxCommands)
 
 class AzaxParam:
+implements(IAzaxParam)
 
 def __init__(self, name, content=''):
 self.name = name
@@ -49,6 +50,7 @@
 return self.content
 
 class AzaxCommand:
+implements(IAzaxCommand)
 
 def __init__(self, name, selector):
 Command.checkRegistered(name)

Modified: azax/branches/plugin/interfaces.py
==
--- azax/branches/plugin/interfaces.py  (original)
+++ azax/branches/plugin/interfaces.py  Sat Apr 15 09:55:58 2006
@@ -23,3 +23,9 @@
 
 class IAzaxCommands(Interface):
 'Azax commands'
+
+class IAzaxCommand(Interface):
+'An Azax command'
+
+class IAzaxParam(Interface):
+'An Azax parameter'
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r2798 - in azax/branches/plugin: . browser tests

2006-04-09 Thread bree
Author: bree
Date: Sun Apr  9 18:44:12 2006
New Revision: 2798

Added:
   azax/branches/plugin/commands.py
   azax/branches/plugin/parsers.py
   azax/branches/plugin/selectors.py
Modified:
   azax/branches/plugin/azaxview.py
   azax/branches/plugin/browser/kukitresponse.pt
   azax/branches/plugin/configure.zcml
   azax/branches/plugin/interfaces.py
   azax/branches/plugin/tests/test_azaxview.py
Log:
Refactoring. Rendering command via adapter hook, + break up files

Modified: azax/branches/plugin/azaxview.py
==
--- azax/branches/plugin/azaxview.py(original)
+++ azax/branches/plugin/azaxview.pySun Apr  9 18:44:12 2006
@@ -19,139 +19,25 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 # 02111-1307, USA.
 #
+'''\
+AZAX Base view class
 
-from zope.interface import implements
-from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
-from Products.Five import BrowserView
-from unicode_quirks import force_unicode
-from plugins import Command
-
-import htmlentitydefs
-import re
-_entity_regexp = re.compile(r"&([a-zA-Z]+);")
-
-# --
-# Parser implementations
-#
-# These assure that output is valid XML or HTML and fix the code or
-# raise an exception.
-#
-# The wrapping makes it possible to change the parser transparently
-# if necessary.
-# --
-
-class XmlParser(object):
-'''Custom XML parser
-
-wraps the parser implementation
-'''
-
-from BeautifulSoup import BeautifulStoneSoup
-
-def __init__(self, value):
-value = force_unicode(value)
-self.soup = self.BeautifulStoneSoup(value)
-
-def __call__(self):
-return unicode(self.soup)
-
-class HtmlParser(object):
-'''Custom HTML parser
+All the implementations should create a specialization
+of this class when building their browser views.
 
-wraps the parser implementation
-'''
+The policy is that a method should build up a command
+set on available methods and then return self.render().
 
-from BeautifulSoup import BeautifulSoup
-
-def __init__(self, value):
-value = force_unicode(value)
-self.soup = self.BeautifulSoup(value)
-for tag in self.soup.fetch(recursive=False):
-tag['xmlns'] = "http://www.w3.org/1999/xhtml";
-
-def __call__(self):
-return unicode(self.soup)
-
-# --
-# Marshal objects
-# 
-# These build up the response and get marshalled to the client
-# in the defined format
-# --
+The default command set is implemented in the base class
+as well.
+'''
 
-class AzaxParam:
-
-def __init__(self, name, content=''):
-self.name = name
-# Content must be str with ascii encoding, or unicode!
-self.content = force_unicode(content)
-
-def getName(self):
-return self.name
-
-def getContent(self):
-return self.content
-
-class AzaxCommand:
-
-def __init__(self, name, selector):
-Command.checkRegistered(name)
-if isinstance(selector, basestring): 
-self.selector = selector
-self.selectorType = ''
-else:
-self.selector = selector.value
-self.selectorType = selector.type
-self.name = name
-self.params = []
-
-def addParam(self, name, content=''):
-param = AzaxParam(name, content)
-self.params.append(param)
-return param
-
-def getName(self):
-return self.name
-
-def getSelector(self):
-return self.selector
-
-def getSelectorType(self):
-return self.selectorType
-
-def getParams(self):
-return self.params
-
-XPATH_SELECTOR = 'xpath'
-CSS_SELECTOR = 'css'
-HTMLID_SELECTOR = 'htmlid' 
-
-class XpathSelector:
-
-type = XPATH_SELECTOR
-
-def __init__(self, selector):
-self.value = selector
-
-class CssSelector:
-
-type = CSS_SELECTOR
-
-def __init__(self, selector):
-self.value = selector
-
-class HtmlIdSelector:
-
-type = HTMLID_SELECTOR
-
-def __init__(self, selector):
-self.value = selector
-# --
-# Base view class
-# 
-# All the implementations should create a specialization
-# of this class when building their browser views
-# --
+from Products.Five import BrowserView
+from  commands import AzaxCommands, AzaxCommand
+from selectors import XpathSelector, CssSelector, HtmlIdSelector
+from parsers import XmlParser, HtmlParser
+import zope.component
+from zope.interface import Interface
 
 class AzaxBaseView(BrowserView):
 """ Base azax view
@@ -160,25 +46,15 @@
 generate it out.
 """
 
-# XML output gets rendered via a page template
-_render = ViewPageTemplateF

[Z3lab-checkins] r2781 - azax/branches/plugin/tests

2006-04-04 Thread bree
Author: bree
Date: Wed Apr  5 07:00:26 2006
New Revision: 2781

Modified:
   azax/branches/plugin/tests/test_azaxview.py
Log:
Fix tests

Modified: azax/branches/plugin/tests/test_azaxview.py
==
--- azax/branches/plugin/tests/test_azaxview.py (original)
+++ azax/branches/plugin/tests/test_azaxview.py Wed Apr  5 07:00:26 2006
@@ -74,6 +74,7 @@
   
provides="zope.app.traversing.interfaces.ITraverser"
   /-->
 '''))
+load_config('meta.zcml', package=Products.azax.plugins)
 load_config('configure.zcml', package=Products.azax.plugins)
  
 def beforeTearDown(self):
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r2766 - in azax/branches/plugin: . plugins tests

2006-04-03 Thread bree
Author: bree
Date: Mon Apr  3 16:01:02 2006
New Revision: 2766

Added:
   azax/branches/plugin/plugins/EXTERNALS.TXT
   azax/branches/plugin/plugins/interfaces.py
   azax/branches/plugin/plugins/registry.py
Modified:
   azax/branches/plugin/   (props changed)
   azax/branches/plugin/EXTERNALS.TXT
   azax/branches/plugin/configure.zcml
   azax/branches/plugin/meta.zcml
   azax/branches/plugin/plugins/   (props changed)
   azax/branches/plugin/plugins/__init__.py
   azax/branches/plugin/plugins/command.py
   azax/branches/plugin/plugins/configure.py
   azax/branches/plugin/plugins/configure.zcml
   azax/branches/plugin/plugins/directives.py
   azax/branches/plugin/plugins/meta.zcml
   azax/branches/plugin/plugins/plugin.py
   azax/branches/plugin/tests/test_azaxview.py
Log:
Change plugin registration; make cooperate with concatresource.

This means that the additional plugins are now transparently registered into the
kukit.js resource.

Modified: azax/branches/plugin/EXTERNALS.TXT
==
--- azax/branches/plugin/EXTERNALS.TXT  (original)
+++ azax/branches/plugin/EXTERNALS.TXT  Mon Apr  3 16:01:02 2006
@@ -2,7 +2,7 @@
 # results of svn propget svn:externals
 # https://svn.z3lab.org/z3lab/azax/trunk
 #
-# created by: svn propset svn:externals -F EXTERNALS.TXT .
+# You can update your working dir by: 
+# svn propset svn:externals -F EXTERNALS.TXT .
 #
 kukit http://codespeak.net/svn/kukit/branch/plugin
-

Modified: azax/branches/plugin/configure.zcml
==
--- azax/branches/plugin/configure.zcml (original)
+++ azax/branches/plugin/configure.zcml Mon Apr  3 16:01:02 2006
@@ -1,14 +1,16 @@
 http://namespaces.zope.org/zope";
xmlns:browser="http://namespaces.zope.org/browser";
xmlns:five="http://namespaces.zope.org/five";>
-  
+ 
+  
+
   
 
-  
 
@@ -61,5 +63,5 @@
 file="tests/js/testStyleParse.js"
 name="testAzaxStyleParse.js"
   />
-
+  
 

Modified: azax/branches/plugin/meta.zcml
==
--- azax/branches/plugin/meta.zcml  (original)
+++ azax/branches/plugin/meta.zcml  Mon Apr  3 16:01:02 2006
@@ -1,6 +1,6 @@
 http://namespaces.zope.org/meta";>
 
-   
+   
 
 

Added: azax/branches/plugin/plugins/EXTERNALS.TXT
==
--- (empty file)
+++ azax/branches/plugin/plugins/EXTERNALS.TXT  Mon Apr  3 16:01:02 2006
@@ -0,0 +1,10 @@
+#
+# results of svn propget svn:externals
+# https://svn.z3lab.org/z3lab/azax/trunk/plugins
+#
+# You can update your working dir by: 
+# svn propset svn:externals -F EXTERNALS.TXT .
+#
+
+# concatresource is now included like as batteries
+concatresource 
http://codespeak.net/svn/z3/jsonserver/branch/merge/concatresource

Modified: azax/branches/plugin/plugins/__init__.py
==
--- azax/branches/plugin/plugins/__init__.py(original)
+++ azax/branches/plugin/plugins/__init__.pyMon Apr  3 16:01:02 2006
@@ -2,5 +2,6 @@
 Module init
 '''
 
-from plugin import AzaxPluginError
+from registry import AzaxPluginError
+from plugin import registerPlugin
 from command import Command

Modified: azax/branches/plugin/plugins/command.py
==
--- azax/branches/plugin/plugins/command.py (original)
+++ azax/branches/plugin/plugins/command.py Mon Apr  3 16:01:02 2006
@@ -6,9 +6,8 @@
 
 '''
 
-plugins = {}
+plugintype = 'command'
 
-def __init__(self, name, jsresource):
-Plugin.__init__(self, name, jsresource)
+def __init__(self, name, jsfile):
+Plugin.__init__(self, name, jsfile)
 
-Command.__pluginclass__ = Command

Modified: azax/branches/plugin/plugins/configure.py
==
--- azax/branches/plugin/plugins/configure.py   (original)
+++ azax/branches/plugin/plugins/configure.py   Mon Apr  3 16:01:02 2006
@@ -1,11 +1,20 @@
 
 import os.path
 from command import Command
+from plugin import registerPlugin
 
-class AzaxConfigurationError(Exception):
-pass
+#class AzaxConfigurationError(Exception):
+#pass
 
-def registerCommand(_context, name, jsresource=None):
+def registerCommand(_context, name, jsfile=None):
+'Directive that registers a command' 
+
+# check to see if the file exists
+if jsfile is not None:
+file(jsfile, 'rb').close()
 
-command = Command(name, jsresource)
-command.register()
+_context.action(
+discriminator = ('registerAzaxCommand', name, jsfile),
+call

[Z3lab-checkins] r2615 - in azax/branches/snowsprint: . demos/azaxdemo demos/azaxdemo/browser

2006-03-12 Thread bree
Author: bree
Date: Sun Mar 12 13:18:17 2006
New Revision: 2615

Added:
   azax/branches/snowsprint/demos/azaxdemo/browser/azax_demo.kukit
  - copied unchanged from r2614, 
azax/branches/plugin/demos/azaxdemo/browser/azax_demo.kukit
   azax/branches/snowsprint/demos/azaxdemo/browser/azax_instant_edit.kukit
  - copied unchanged from r2614, 
azax/branches/plugin/demos/azaxdemo/browser/azax_instant_edit.kukit
   azax/branches/snowsprint/demos/azaxdemo/browser/azax_three_autoupdate.kukit
  - copied unchanged from r2614, 
azax/branches/plugin/demos/azaxdemo/browser/azax_three_autoupdate.kukit
   azax/branches/snowsprint/demos/azaxdemo/browser/azax_tree.kukit
  - copied unchanged from r2614, 
azax/branches/plugin/demos/azaxdemo/browser/azax_tree.kukit
   azax/branches/snowsprint/demos/azaxdemo/browser/azax_two_select.kukit
  - copied unchanged from r2614, 
azax/branches/plugin/demos/azaxdemo/browser/azax_two_select.kukit
   azax/branches/snowsprint/demos/azaxdemo/browser/cancel_submit.kukit
  - copied unchanged from r2614, 
azax/branches/plugin/demos/azaxdemo/browser/cancel_submit.kukit
Removed:
   azax/branches/snowsprint/demos/azaxdemo/browser/azax_demo.kkt
   azax/branches/snowsprint/demos/azaxdemo/browser/azax_instant_edit.kkt
   azax/branches/snowsprint/demos/azaxdemo/browser/azax_three_autoupdate.kkt
   azax/branches/snowsprint/demos/azaxdemo/browser/azax_tree.kkt
   azax/branches/snowsprint/demos/azaxdemo/browser/azax_two_select.kkt
   azax/branches/snowsprint/demos/azaxdemo/browser/cancel_submit.kkt
Modified:
   azax/branches/snowsprint/TODO.txt
   azax/branches/snowsprint/__init__.py
   azax/branches/snowsprint/demos/azaxdemo/azaxview.py
   azax/branches/snowsprint/demos/azaxdemo/browser/azax_demo.pt
   azax/branches/snowsprint/demos/azaxdemo/browser/azax_instant_edit.pt
   azax/branches/snowsprint/demos/azaxdemo/browser/azax_three_autoupdate.pt
   azax/branches/snowsprint/demos/azaxdemo/browser/azax_tree.pt
   azax/branches/snowsprint/demos/azaxdemo/browser/azax_two_select.pt
   azax/branches/snowsprint/demos/azaxdemo/browser/cancel_submit.pt
   azax/branches/snowsprint/demos/azaxdemo/configure.zcml
Log:
Merge in fixes from plugin branch

* .kkt -> .kukit extension change
* small typo fix in demo


Modified: azax/branches/snowsprint/TODO.txt
==
--- azax/branches/snowsprint/TODO.txt   (original)
+++ azax/branches/snowsprint/TODO.txt   Sun Mar 12 13:18:17 2006
@@ -1,5 +1,4 @@
 * rename AzaxResponse to KukitResponse
-* register kkt mimetype instead of azax
 * look to TextIndexNG3 howto have it compatible with Z3, Z2 and Plone
 * rename the commands to better match the DOM API
 * try to fix the namespace problems - see 
https://svn.z3lab.org/z3lab/azax/branches/gotcha-namespaces

Modified: azax/branches/snowsprint/__init__.py
==
--- azax/branches/snowsprint/__init__.py(original)
+++ azax/branches/snowsprint/__init__.pySun Mar 12 13:18:17 2006
@@ -1,6 +1,7 @@
 import mimetypes
 
-mimetypes.types_map['.kkt'] = 'text/xml' 
+mimetypes.types_map['.kkt'] = 'text/xml'# XXX legacy!
+mimetypes.types_map['.kukit'] = 'text/xml'
 
 from azaxview import AzaxBaseView
 from unicode_quirks import force_unicode, AzaxUnicodeError

Modified: azax/branches/snowsprint/demos/azaxdemo/azaxview.py
==
--- azax/branches/snowsprint/demos/azaxdemo/azaxview.py (original)
+++ azax/branches/snowsprint/demos/azaxdemo/azaxview.py Sun Mar 12 13:18:17 2006
@@ -40,7 +40,7 @@
 
 def copyToDivContent(self):
 """ copy div content """
-return_object.copyChildrenTo('div#copy', 'demo')
+self.copyChildrenTo('div#copy', 'demo')
 return self.render()
 
 def moveToDivContent(self):

Modified: azax/branches/snowsprint/demos/azaxdemo/browser/azax_demo.pt
==
--- azax/branches/snowsprint/demos/azaxdemo/browser/azax_demo.pt
(original)
+++ azax/branches/snowsprint/demos/azaxdemo/browser/azax_demo.ptSun Mar 
12 13:18:17 2006
@@ -1,7 +1,7 @@
 
   
 
+  tal:attributes="href 
string:${context/absolute_url}/++resource++azax_demo.kukit"/>
 
   
   
@@ -60,12 +60,12 @@
 
 Javascript Styling
 This page defines a link in the header which 
rel attribute points
-   to a .kkt server file :
+   to a .kukit server file :
 
-  
+  
see the kukit file here.
 
-This .kkt file declares CSS selectors associated with 
events and server URLs called when the event occur.
+This .kukit file declares CSS selectors associated with 
events and server URLs called

[Z3lab-checkins] r2614 - in azax/branches/plugin: . demos/azaxdemo demos/azaxdemo/browser

2006-03-12 Thread bree
Author: bree
Date: Sun Mar 12 13:08:32 2006
New Revision: 2614

Added:
   azax/branches/plugin/demos/azaxdemo/browser/azax_demo.kukit
  - copied unchanged from r2569, 
azax/branches/plugin/demos/azaxdemo/browser/azax_demo.kkt
   azax/branches/plugin/demos/azaxdemo/browser/azax_instant_edit.kukit
  - copied unchanged from r2569, 
azax/branches/plugin/demos/azaxdemo/browser/azax_instant_edit.kkt
   azax/branches/plugin/demos/azaxdemo/browser/azax_three_autoupdate.kukit
  - copied unchanged from r2569, 
azax/branches/plugin/demos/azaxdemo/browser/azax_three_autoupdate.kkt
   azax/branches/plugin/demos/azaxdemo/browser/azax_tree.kukit
  - copied unchanged from r2569, 
azax/branches/plugin/demos/azaxdemo/browser/azax_tree.kkt
   azax/branches/plugin/demos/azaxdemo/browser/azax_two_select.kukit
  - copied unchanged from r2569, 
azax/branches/plugin/demos/azaxdemo/browser/azax_two_select.kkt
   azax/branches/plugin/demos/azaxdemo/browser/cancel_submit.kukit
  - copied unchanged from r2569, 
azax/branches/plugin/demos/azaxdemo/browser/cancel_submit.kkt
Removed:
   azax/branches/plugin/demos/azaxdemo/browser/azax_demo.kkt
   azax/branches/plugin/demos/azaxdemo/browser/azax_instant_edit.kkt
   azax/branches/plugin/demos/azaxdemo/browser/azax_three_autoupdate.kkt
   azax/branches/plugin/demos/azaxdemo/browser/azax_tree.kkt
   azax/branches/plugin/demos/azaxdemo/browser/azax_two_select.kkt
   azax/branches/plugin/demos/azaxdemo/browser/cancel_submit.kkt
Modified:
   azax/branches/plugin/TODO.txt
   azax/branches/plugin/__init__.py
   azax/branches/plugin/demos/azaxdemo/browser/azax_demo.pt
   azax/branches/plugin/demos/azaxdemo/browser/azax_instant_edit.pt
   azax/branches/plugin/demos/azaxdemo/browser/azax_three_autoupdate.pt
   azax/branches/plugin/demos/azaxdemo/browser/azax_tree.pt
   azax/branches/plugin/demos/azaxdemo/browser/azax_two_select.pt
   azax/branches/plugin/demos/azaxdemo/browser/cancel_submit.pt
   azax/branches/plugin/demos/azaxdemo/configure.zcml
Log:
Demos: .kkt -> .kukit name change

Modified: azax/branches/plugin/TODO.txt
==
--- azax/branches/plugin/TODO.txt   (original)
+++ azax/branches/plugin/TODO.txt   Sun Mar 12 13:08:32 2006
@@ -1,5 +1,4 @@
 * rename AzaxResponse to KukitResponse
-* register kkt mimetype instead of azax
 * look to TextIndexNG3 howto have it compatible with Z3, Z2 and Plone
 * rename the commands to better match the DOM API
 * try to fix the namespace problems - see 
https://svn.z3lab.org/z3lab/azax/branches/gotcha-namespaces

Modified: azax/branches/plugin/__init__.py
==
--- azax/branches/plugin/__init__.py(original)
+++ azax/branches/plugin/__init__.pySun Mar 12 13:08:32 2006
@@ -1,6 +1,7 @@
 import mimetypes
 
-mimetypes.types_map['.kkt'] = 'text/xml' 
+mimetypes.types_map['.kkt'] = 'text/xml'# XXX legacy!
+mimetypes.types_map['.kukit'] = 'text/xml'
 
 from azaxview import AzaxBaseView
 from unicode_quirks import force_unicode, AzaxUnicodeError

Modified: azax/branches/plugin/demos/azaxdemo/browser/azax_demo.pt
==
--- azax/branches/plugin/demos/azaxdemo/browser/azax_demo.pt(original)
+++ azax/branches/plugin/demos/azaxdemo/browser/azax_demo.ptSun Mar 12 
13:08:32 2006
@@ -1,7 +1,7 @@
 
   
 
+  tal:attributes="href 
string:${context/absolute_url}/++resource++azax_demo.kukit"/>
 
   
   
@@ -60,12 +60,12 @@
 
 Javascript Styling
 This page defines a link in the header which 
rel attribute points
-   to a .kkt server file :
+   to a .kukit server file :
 
-  
+  
see the kukit file here.
 
-This .kkt file declares CSS selectors associated with 
events and server URLs called when the event occur.
+This .kukit file declares CSS selectors associated with 
events and server URLs called when the event occur.
 
 A javascript engine processes the XML content : it inserts javascript
events in the DOM.

Modified: azax/branches/plugin/demos/azaxdemo/browser/azax_instant_edit.pt
==
--- azax/branches/plugin/demos/azaxdemo/browser/azax_instant_edit.pt
(original)
+++ azax/branches/plugin/demos/azaxdemo/browser/azax_instant_edit.ptSun Mar 
12 13:08:32 2006
@@ -1,7 +1,7 @@
 
   
 
+  tal:attributes="href 
string:${context/absolute_url}/++resource++azax_instant_edit.kukit"/>
 
   
   

Modified: azax/branches/plugin/demos/azaxdemo/browser/azax_three_autoupdate.pt
==
--- azax/branches/plugin/demos/azaxdemo/browser/azax_three_autoupdate.pt
(original)

[Z3lab-checkins] r2613 - azax/branches/plugin/demos/azaxdemo

2006-03-12 Thread bree
Author: bree
Date: Sun Mar 12 12:54:04 2006
New Revision: 2613

Modified:
   azax/branches/plugin/demos/azaxdemo/azaxview.py
Log:
Fix demo (copyToDivContent typo)

Modified: azax/branches/plugin/demos/azaxdemo/azaxview.py
==
--- azax/branches/plugin/demos/azaxdemo/azaxview.py (original)
+++ azax/branches/plugin/demos/azaxdemo/azaxview.py Sun Mar 12 12:54:04 2006
@@ -40,7 +40,7 @@
 
 def copyToDivContent(self):
 """ copy div content """
-return_object.copyChildrenTo('div#copy', 'demo')
+self.copyChildrenTo('div#copy', 'demo')
 return self.render()
 
 def moveToDivContent(self):
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r2611 - in azax/branches/plugin: . plugins plugins/browser tests

2006-03-12 Thread bree
Author: bree
Date: Sun Mar 12 12:52:06 2006
New Revision: 2611

Removed:
   azax/branches/plugin/plugins/browser/
Modified:
   azax/branches/plugin/azaxview.py
   azax/branches/plugin/plugins/__init__.py
   azax/branches/plugin/plugins/command.py
   azax/branches/plugin/plugins/configure.py
   azax/branches/plugin/plugins/configure.zcml
   azax/branches/plugin/plugins/directives.py
   azax/branches/plugin/plugins/plugin.py
   azax/branches/plugin/tests/test_azaxview.py
Log:
Progress with command plugins

Modified: azax/branches/plugin/azaxview.py
==
--- azax/branches/plugin/azaxview.py(original)
+++ azax/branches/plugin/azaxview.pySun Mar 12 12:52:06 2006
@@ -24,6 +24,7 @@
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 from Products.Five import BrowserView
 from unicode_quirks import force_unicode
+from plugins import Command
 
 import htmlentitydefs
 import re
@@ -94,6 +95,7 @@
 class AzaxCommand:
 
 def __init__(self, name, selector):
+Command.checkRegistered(name)
 if isinstance(selector, basestring): 
 self.selector = selector
 self.selectorType = ''

Modified: azax/branches/plugin/plugins/__init__.py
==
--- azax/branches/plugin/plugins/__init__.py(original)
+++ azax/branches/plugin/plugins/__init__.pySun Mar 12 12:52:06 2006
@@ -2,3 +2,5 @@
 Module init
 '''
 
+from plugin import AzaxPluginError
+from command import Command

Modified: azax/branches/plugin/plugins/command.py
==
--- azax/branches/plugin/plugins/command.py (original)
+++ azax/branches/plugin/plugins/command.py Sun Mar 12 12:52:06 2006
@@ -1,14 +1,14 @@
 
-from plugin import Plugin, baseclass_singleton_property
+from plugin import Plugin
 
 class Command(Plugin):
 '''The command plugin
 
 '''
 
-def __init__(self, name, jsfile, method):
-Plugin.__init__(self, name)
-self.jsfile = jsfile
-self.method = method
+plugins = {}
 
-Command.__plugin_baseclass__ = Command
+def __init__(self, name, jsresource):
+Plugin.__init__(self, name, jsresource)
+
+Command.__pluginclass__ = Command

Modified: azax/branches/plugin/plugins/configure.py
==
--- azax/branches/plugin/plugins/configure.py   (original)
+++ azax/branches/plugin/plugins/configure.py   Sun Mar 12 12:52:06 2006
@@ -5,13 +5,7 @@
 class AzaxConfigurationError(Exception):
 pass
 
-def registerCommand(_context, name, jsfile, method):
+def registerCommand(_context, name, jsresource=None):
 
-jsfile = _context.path(jsfile)
-
-if not os.path.exists(jsfile):
-raise AzaxConfigurationError, 'jsfile "%s" does not exist.' % (jsfile, 
)
-
-command = Command(name, jsfile, method)
+command = Command(name, jsresource)
 command.register()
-

Modified: azax/branches/plugin/plugins/configure.zcml
==
--- azax/branches/plugin/plugins/configure.zcml (original)
+++ azax/branches/plugin/plugins/configure.zcml Sun Mar 12 12:52:06 2006
@@ -1,15 +1,71 @@
 http://namespaces.zope.org/zope";
- xmlns:azax="http://namespaces.zope.org/azax";>
+ xmlns:browser="http://namespaces.zope.org/browser";
+ xmlns:azax="http://namespaces.zope.org/azax";
+ >
  
-  
-  
+ 
-
-  
+ 
   
+ -->
+
+ 
+ 
+
+ 
+ 
+ 
+  
+ 
+  
+ 
+  
+ 
+  
+ 
+  
+ 
+  
+ 
+  
+ 
+  
+ 
+  
+ 
+  
+ 
+  
 

Modified: azax/branches/plugin/plugins/directives.py
==
--- azax/branches/plugin/plugins/directives.py  (original)
+++ azax/branches/plugin/plugins/directives.py  Sun Mar 12 12:52:06 2006
@@ -10,14 +10,8 @@
  required=True,
  )
 
-jsfile = TextLine(
- title=u"Javascript file",
- description=u"The javascript file path where the method is in.",
- required=True,
- )
- 
-method = TextLine(
- title=u"Method name",
- description=u"The name of the javascript method",
- required=True,
+jsresource = TextLine(
+ title=u"Javascript resource",
+ description=u"The javascript resource that defines the plugin",
+ required=False,
  )

Modified: azax/branches/plugin/plugins/plugin.py

[Z3lab-checkins] r2570 - in azax/branches/plugin: . plugins plugins/browser

2006-03-10 Thread bree
Author: bree
Date: Fri Mar 10 10:53:18 2006
New Revision: 2570

Added:
   azax/branches/plugin/meta.zcml
   azax/branches/plugin/plugins/
   azax/branches/plugin/plugins/__init__.py
   azax/branches/plugin/plugins/browser/
   azax/branches/plugin/plugins/browser/corecommands.js
   azax/branches/plugin/plugins/command.py
   azax/branches/plugin/plugins/configure.py
   azax/branches/plugin/plugins/configure.zcml
   azax/branches/plugin/plugins/directives.py
   azax/branches/plugin/plugins/meta.zcml
   azax/branches/plugin/plugins/plugin.py
Modified:
   azax/branches/plugin/configure.zcml
Log:
configuration for plugins, server side (command plugin only)

Modified: azax/branches/plugin/configure.zcml
==
--- azax/branches/plugin/configure.zcml (original)
+++ azax/branches/plugin/configure.zcml Fri Mar 10 10:53:18 2006
@@ -1,7 +1,7 @@
 http://namespaces.zope.org/zope";
xmlns:browser="http://namespaces.zope.org/browser";
xmlns:five="http://namespaces.zope.org/five";>
-
+  
   http://namespaces.zope.org/meta";>
+
+   
+
+

Added: azax/branches/plugin/plugins/__init__.py
==
--- (empty file)
+++ azax/branches/plugin/plugins/__init__.pyFri Mar 10 10:53:18 2006
@@ -0,0 +1,4 @@
+'''\
+Module init
+'''
+

Added: azax/branches/plugin/plugins/browser/corecommands.js
==
--- (empty file)
+++ azax/branches/plugin/plugins/browser/corecommands.jsFri Mar 10 
10:53:18 2006
@@ -0,0 +1,42 @@
+
+/* so this is the js file with our core commands.*/
+
+/* does not work yet of course... */
+
+/*
+So the question is left if we do something like
+
+*/
+
+kukit.registerCommand('setHtmlAsChild', function(node, command_data)
+{
+Sarissa.clearChildNodes(node);
+var childNodes = command_data['html'].childNodes;
+kukit.dom.appendChildren(childNodes, node);
+kukit.setupEvents(node);
+}
+)
+
+/* ... in this case the "method" can be omitted from the zcml
+directive,
+
+or we do something like
+*/
+
+kukit.setHtmlAsChild = function(node, command_data) {
+
+}
+
+/* and in this case the method property would be like
+
+  method="kukit.setHtmlAsChild"
+
+   or in the case we are talking about a custom component
+   registration, "my_custom_namespace" instead of "kukit".
+
+   Then the registerCommand would be implemented in the
+   same way but also the registerCommand calls
+   would be autogenerated.
+   
+*/
+

Added: azax/branches/plugin/plugins/command.py
==
--- (empty file)
+++ azax/branches/plugin/plugins/command.py Fri Mar 10 10:53:18 2006
@@ -0,0 +1,14 @@
+
+from plugin import Plugin, baseclass_singleton_property
+
+class Command(Plugin):
+'''The command plugin
+
+'''
+
+def __init__(self, name, jsfile, method):
+Plugin.__init__(self, name)
+self.jsfile = jsfile
+self.method = method
+
+Command.__plugin_baseclass__ = Command

Added: azax/branches/plugin/plugins/configure.py
==
--- (empty file)
+++ azax/branches/plugin/plugins/configure.py   Fri Mar 10 10:53:18 2006
@@ -0,0 +1,17 @@
+
+import os.path
+from command import Command
+
+class AzaxConfigurationError(Exception):
+pass
+
+def registerCommand(_context, name, jsfile, method):
+
+jsfile = _context.path(jsfile)
+
+if not os.path.exists(jsfile):
+raise AzaxConfigurationError, 'jsfile "%s" does not exist.' % (jsfile, 
)
+
+command = Command(name, jsfile, method)
+command.register()
+

Added: azax/branches/plugin/plugins/configure.zcml
==
--- (empty file)
+++ azax/branches/plugin/plugins/configure.zcml Fri Mar 10 10:53:18 2006
@@ -0,0 +1,15 @@
+http://namespaces.zope.org/zope";
+ xmlns:azax="http://namespaces.zope.org/azax";>
+ 
+  
+  
+
+  
+
+  
+  
+

Added: azax/branches/plugin/plugins/directives.py
==
--- (empty file)
+++ azax/branches/plugin/plugins/directives.py  Fri Mar 10 10:53:18 2006
@@ -0,0 +1,23 @@
+from zope.interface import Interface
+from zope.schema import TextLine
+
+class IRegisterCommandDirective(Interface):
+'Register an AZAX command plugin'
+
+name = TextLine(
+ title=u"Name",
+ description=u"The name of the command plugin.",
+ required=True,
+ )
+
+jsfile = TextLine(
+ title=u"Javascript file",
+ description=u"

[Z3lab-checkins] r2569 - azax/branches/snowsprint

2006-03-09 Thread bree
Author: bree
Date: Fri Mar 10 08:05:26 2006
New Revision: 2569

Added:
   azax/branches/snowsprint/unicode_quirks.py
  - copied unchanged from r2568, azax/branches/plugin/unicode_quirks.py
Log:
Forgot to add this file. (had to merge it from the plugin branch)
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r2568 - azax/branches/plugin

2006-03-09 Thread bree
Author: bree
Date: Fri Mar 10 08:00:04 2006
New Revision: 2568

Added:
   azax/branches/plugin/unicode_quirks.py
Log:
Forgot to add this file.

Added: azax/branches/plugin/unicode_quirks.py
==
--- (empty file)
+++ azax/branches/plugin/unicode_quirks.py  Fri Mar 10 08:00:04 2006
@@ -0,0 +1,14 @@
+
+class AzaxUnicodeError(RuntimeError):
+pass
+
+def force_unicode(value, encoding='ascii'):
+'Force value to be unicode - allow also value in a specific encoding (by 
default, ascii).'
+if isinstance(value, str):
+try:
+value = unicode(value, encoding)
+except UnicodeDecodeError, exc:
+raise AzaxUnicodeError, 'Content must be unicode or ascii string, 
original exception: %s' % (exc, )
+else:
+assert isinstance(value, unicode)
+return value
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r2567 - azax/branches/plugin

2006-03-09 Thread bree
Author: bree
Date: Fri Mar 10 07:58:28 2006
New Revision: 2567

Modified:
   azax/branches/plugin/   (props changed)
   azax/branches/plugin/EXTERNALS.TXT
Log:
Branching for plugin development

Modified: azax/branches/plugin/EXTERNALS.TXT
==
--- azax/branches/plugin/EXTERNALS.TXT  (original)
+++ azax/branches/plugin/EXTERNALS.TXT  Fri Mar 10 07:58:28 2006
@@ -4,5 +4,5 @@
 #
 # created by: svn propset svn:externals -F EXTERNALS.TXT .
 #
-kukit http://codespeak.net/svn/kukit/branch/snowsprint
+kukit http://codespeak.net/svn/kukit/branch/plugin
 
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r2566 - azax/branches/plugin

2006-03-09 Thread bree
Author: bree
Date: Fri Mar 10 07:55:41 2006
New Revision: 2566

Added:
   azax/branches/plugin/
  - copied from r2565, azax/branches/snowsprint/
Log:
branching for plugin development

-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r2562 - in azax/branches/snowsprint: . tests

2006-03-09 Thread bree
Author: bree
Date: Thu Mar  9 18:46:47 2006
New Revision: 2562

Modified:
   azax/branches/snowsprint/__init__.py
   azax/branches/snowsprint/tests/test_azaxview.py
Log:
fix tests for unicode handling

Modified: azax/branches/snowsprint/__init__.py
==
--- azax/branches/snowsprint/__init__.py(original)
+++ azax/branches/snowsprint/__init__.pyThu Mar  9 18:46:47 2006
@@ -3,4 +3,4 @@
 mimetypes.types_map['.kkt'] = 'text/xml' 
 
 from azaxview import AzaxBaseView
-from unicode_quirks import force_unicode
+from unicode_quirks import force_unicode, AzaxUnicodeError

Modified: azax/branches/snowsprint/tests/test_azaxview.py
==
--- azax/branches/snowsprint/tests/test_azaxview.py (original)
+++ azax/branches/snowsprint/tests/test_azaxview.py Thu Mar  9 18:46:47 2006
@@ -22,7 +22,7 @@
 import unittest, os
 from zope.testing import doctest
 from Testing.ZopeTestCase import ZopeTestCase
-from Products.azax import AzaxBaseView
+from Products.azax import AzaxBaseView, AzaxUnicodeError
 from Products.azax import config 
 from ZPublisher.HTTPRequest import HTTPRequest
 from cStringIO import StringIO
@@ -127,6 +127,14 @@
 
 def test_setHtmlAsChildTextTagPlusText(self):
 self._checkSetHtmlResult('beforehttp://www.w3.org/1999/xhtml";>new_contentafter')
+
+def test_setHtmlAcceptsUnicode(self):
+'Test that it accepts unicode'
+self._checkSetHtmlResult(u'abc�')
+
+def test_setHtmlChecksForNonUnicode(self):
+'Test that it does not accept non unicode (unless pure ascii)'
+self.assertRaises(AzaxUnicodeError, self._checkSetHtmlResult, 'abc�')
 
 class FTestAzaxView(AzaxViewTestCase):
 'Functional tests'
@@ -151,7 +159,7 @@
 def test_empty(self):
 view = self.view
 result = view.render()
-self.assertEquals(view.request.response.getHeader('Content-Type'), 
'text/xml')
+self.assertEquals(view.request.response.getHeader('Content-Type'), 
'text/xml;charset=utf-8')
 self.assertCommandsEqual(result, '')
 
 def test_setHtmlAsChild(self):
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r2561 - azax/branches/snowsprint

2006-03-09 Thread bree
Author: bree
Date: Thu Mar  9 18:35:41 2006
New Revision: 2561

Modified:
   azax/branches/snowsprint/__init__.py
   azax/branches/snowsprint/azaxview.py
Log:
Handle unicode in azax response

Modified: azax/branches/snowsprint/__init__.py
==
--- azax/branches/snowsprint/__init__.py(original)
+++ azax/branches/snowsprint/__init__.pyThu Mar  9 18:35:41 2006
@@ -3,3 +3,4 @@
 mimetypes.types_map['.kkt'] = 'text/xml' 
 
 from azaxview import AzaxBaseView
+from unicode_quirks import force_unicode

Modified: azax/branches/snowsprint/azaxview.py
==
--- azax/branches/snowsprint/azaxview.py(original)
+++ azax/branches/snowsprint/azaxview.pyThu Mar  9 18:35:41 2006
@@ -23,6 +23,7 @@
 from zope.interface import implements
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 from Products.Five import BrowserView
+from unicode_quirks import force_unicode
 
 import htmlentitydefs
 import re
@@ -47,10 +48,11 @@
 from BeautifulSoup import BeautifulStoneSoup
 
 def __init__(self, value):
+value = force_unicode(value)
 self.soup = self.BeautifulStoneSoup(value)
 
 def __call__(self):
-return str(self.soup)
+return unicode(self.soup)
 
 class HtmlParser(object):
 '''Custom HTML parser
@@ -61,12 +63,13 @@
 from BeautifulSoup import BeautifulSoup
 
 def __init__(self, value):
+value = force_unicode(value)
 self.soup = self.BeautifulSoup(value)
 for tag in self.soup.fetch(recursive=False):
 tag['xmlns'] = "http://www.w3.org/1999/xhtml";
 
 def __call__(self):
-return str(self.soup)
+return unicode(self.soup)
 
 # --
 # Marshal objects
@@ -79,7 +82,8 @@
 
 def __init__(self, name, content=''):
 self.name = name
-self.content = content
+# Content must be str with ascii encoding, or unicode!
+self.content = force_unicode(content)
 
 def getName(self):
 return self.name
@@ -155,7 +159,7 @@
 """
 
 # XML output gets rendered via a page template
-_render = ViewPageTemplateFile('browser/kukitresponse.pt', 
content_type='text/xml')
+_render = ViewPageTemplateFile('browser/kukitresponse.pt', 
content_type='text/xml;charset=utf-8')
 
 # replace named entities to fix a bug in IE
 def render(self):
@@ -167,7 +171,8 @@
 return "&#%i;" % value
 
 result = self._render()
-return _entity_regexp.sub(entity_replacer, result)
+result = _entity_regexp.sub(entity_replacer, result)
+return result
 
 def __init__(self, context, request):
 BrowserView.__init__(self, context, request)
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins


[Z3lab-checkins] r2556 - in azax/branches/snowsprint: . tests

2006-03-07 Thread bree
Author: bree
Date: Tue Mar  7 20:50:52 2006
New Revision: 2556

Modified:
   azax/branches/snowsprint/azaxview.py
   azax/branches/snowsprint/tests/test_azaxview.py
Log:
(Florian's patch): handle other HTML entities for IE

Modified: azax/branches/snowsprint/azaxview.py
==
--- azax/branches/snowsprint/azaxview.py(original)
+++ azax/branches/snowsprint/azaxview.pyTue Mar  7 20:50:52 2006
@@ -24,6 +24,10 @@
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 from Products.Five import BrowserView
 
+import htmlentitydefs
+import re
+_entity_regexp = re.compile(r"&([a-zA-Z]+);")
+
 # --
 # Parser implementations
 #
@@ -151,16 +155,19 @@
 """
 
 # XML output gets rendered via a page template
-render = ViewPageTemplateFile('browser/kukitresponse.pt', 
content_type='text/xml')
-
-# XXX test only, hardcoded HTML for the first button of the first demo
-##render = ViewPageTemplateFile('tests/kukitresponse_test.pt', 
content_type='text/xml')
+_render = ViewPageTemplateFile('browser/kukitresponse.pt', 
content_type='text/xml')
 
-# fix for IE
-_render = render
+# replace named entities to fix a bug in IE
 def render(self):
+name2codepoint = htmlentitydefs.name2codepoint
+def entity_replacer(m):
+value = name2codepoint.get(m.group(1))
+if value is None:
+return m.group(0)
+return "&#%i;" % value
+
 result = self._render()
-return result.replace(' ', ' ')
+return _entity_regexp.sub(entity_replacer, result)
 
 def __init__(self, context, request):
 BrowserView.__init__(self, context, request)

Modified: azax/branches/snowsprint/tests/test_azaxview.py
==
--- azax/branches/snowsprint/tests/test_azaxview.py (original)
+++ azax/branches/snowsprint/tests/test_azaxview.py Tue Mar  7 20:50:52 2006
@@ -1,8 +1,9 @@
 # -*- coding: ISO-8859-15 -*-
-# Copyright (c) 2005
+# Copyright (c) 2005-2006
 # Authors:
 #   Godefroid Chapelle <[EMAIL PROTECTED]>
 #   Tarek Ziad� <[EMAIL PROTECTED]>
+#   Bal�zs Re� <[EMAIL PROTECTED]>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License version 2 as published
@@ -108,7 +109,12 @@
 self.assertEqual(params[0].getContent(), content)
 
 def test_setHtmlAsChildTextPlusEntity(self):
+'See if non breaking space entity works'
 self._checkSetHtmlResult(' ')
+
+def test_setHtmlAsChildTextPlusEntityOthers(self):
+'See if the other HTML entities work as well'
+self._checkSetHtmlResult('http://www.w3.org/1999/xhtml";>»Hello world!«')
 
 def test_setHtmlAsChildTextOnly(self):
 self._checkSetHtmlResult('new content')
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins