Re: [Zope3-Users] z3c.jsonrpc response content type bug

2008-10-28 Thread Jim Washington
Roger Ineichen wrote:
 Hi Yuan
 
 Betreff: [Zope3-Users] z3c.jsonrpc response content type bug

 When I use z3c.jsonrpc (svn head) to publish an object, the 
 response generated gets the content header:

 Content-Type: application/x-javascript

 According to the README.txt of the package:

 This project provides the proposed request type 
 application/json. The request type application/json-rpc 
 is supported as long it is not officialy deprecated.

 And it also expects to receive a request with 'application/json'
 header. So this should be a bug.

 To fix it, one just need to modify _prepareResult method in 
 the file publisher.py to change from

 # set content type
 self.setHeader('content-type', 
 application/x-javascript;charset=%s \
 % charset)

 to

 # set content type
 self.setHeader('content-type', application/json;charset=%s \
 % charset)
 --
 Hong Yuan
 
 Thanks for the hint. I'll take a look at that this week.
 Regards
 Roger Ineichen

A bit of history on this.  The content-type in this bit of code was
determined more than three years ago by testing with several old major
web browsers.  At the time, 'application/x-javascript' was the
content-type that reliably told the web browser to use its javascript
parser on the document so that the rpc data could be used.  Other
settings did not work on all of the web browsers I tested.

So, this content-type was decided empirically (a long time ago), not
from specification. It maybe should continue to be the default for
compatibility with creaky old web browsers.  But maybe it can be
changeable (if you *really* know what you are doing) so that the
outgoing document can meet the expectations of client libraries.

- Jim Washington

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Find the zope3 instance home directory (or the /var directory)

2007-11-07 Thread Jim Washington
Stefan H. Holek wrote:
 I don't think there is any way whatsoever in Zope 3. There is no
 instance home to begin with, and the os.pardir hacks don't work
 either because you can't really know where your package is installed.

 Stefan


 On 6. Nov 2007, at 11:02, Eric Br�hault wrote:

 I had a look to different source code, and apparently the solution is
 to use
 the path of the current file to get the instance home, so we have
 code like
 this:
 os.path.normpath(
 os.path.join(os.path.dirname(__file__),
  os.pardir, os.pardir, os.pardir, os.pardir))

 Is there any easier (and cleaner) way to do it ?

I have found useful another trick related to __file__ .

If the file system location you are looking for is near code you are
using or can import, python's inspect may be your friend.

 import inspect

So, if your object is, for example, a view method and you need the
directory where another method is defined for your view, you can

 sourcefilepath = inspect.getsourcefile(self.otherMethod)

Here's another example for clarification.  It works, but is not
particularly useful:

Let's say we want to know the file system location where
Decimal.normalize is defined.

 from inspect import getsourcefile
 from decimal import Decimal

We can get the location directly:

 getsourcefile(Decimal.normalize)
'/usr/lib64/python2.5/decimal.py'

Or, if we just want the location of the class:
 getsourcefile(Decimal)
'/usr/lib64/python2.5/decimal.py'

or, we can get the location from an instance:

 d = Decimal('0.12')
 getsourcefile(d.normalize)
'/usr/lib64/python2.5/decimal.py'

From there, standard os.path functions can get you locations relative to
the location given.

HTH,

-Jim Washington


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: AW: [Zope3-Users] Re: header trouble

2007-10-10 Thread Jim Washington
Christian Zagrodnick wrote:

[...]
 But we *are* sending a Content-Type header. And we remove the
 http-equiv thingy from the page template file in favour of the HTTP
 header.
   
It's a good idea to keep the http-equiv content-type meta tag.  If an
HTML document is stored to disk, and that tag is not present, parsers
and browsers cannot be sure what the character encoding is.

The HTTP header should have precedence when the document is delivered
over the web, but on disk, you do not have that header.

More at:

http://www.trilithium.com/johan/2005/09/meta-http-equiv/

-Jim Washington




___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] best way to get started nowadays?

2007-09-22 Thread Jim Washington
Chris Withers wrote:
 Benji York wrote:
 Chris Withers wrote:
 So, what *is* the standard way now and where can I read about how
 to do it?

 That's in flux at the moment.  I think Philipp's zopeproject is a
 step in the right direction, but haven't had a chance to look at it
 closely yet.

 Where's zopeproject's home?

 Chris

Start at pypi (cheeseshop). You easy_install it.

-Jim Washington
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Zope3 still not compatible with Python2.5

2007-09-11 Thread Jim Washington
Philipp von Weitershausen wrote:
 This is a rather confusing post. I'm not sure what you're trying to
 say with it.

 Is Python 2.5 officially supported? No. We never said it was.

 Does Zope 3.4 actually work on Python 2.5.1? Yes, it works just fine
 for me and others. For example, Grok runs on Python 2.5.1 no problem [1].

This is very good to hear.  I'm not on the grok list.

 Is this a platform issue? Maybe, but your post isn't giving *any*
 useful information for tracking this down. All you're basically saying
 is that you were experimenting with several things all at once and
 that that was a bad idea. You certainly got that right.


Yup.  That's pretty much all I was saying - plus that in my case, the
quickest solution was to go back to python2.4.  I was also hoping I
might hear some time frame when I might expect to try again successfully. 

 I hope the rest isn't taken for FUD. I certainly encourage people to
 try out Zope 3.4 on Python 2.5 and report any problems *properly* so
 that we can chase down the bugs.

No FUD intended. 

I have attached a couple of tracebacks.  Traceback1 occurs when asking
for /index.html.  Traceback2 occurs when the instance from traceback1 is
stopped and restarted.

Is this more helpful?

Regards,

-Jim Washington


2007-09-11T22:42:56 ERROR SiteError http://localhost:8080/@@index.html
Traceback (most recent call last):
  File 
/home/jwashin/buildout-eggs/tmprA8xJD/zope.publisher-3.5.0a1.dev_r78838-py2.5.egg/zope/publisher/publish.py,
 line 133, in publish
  File 
/home/jwashin/buildout-eggs/tmpNVNVrW/zope.app.publication-3.4.0a1_2-py2.5.egg/zope/app/publication/zopepublication.py,
 line 167, in callObject
  File 
/home/jwashin/buildout-eggs/tmprA8xJD/zope.publisher-3.5.0a1.dev_r78838-py2.5.egg/zope/publisher/publish.py,
 line 108, in mapply
   - __traceback_info__: bound method Contents.index of 
zope.app.publisher.browser.viewmeta.Contents object at 0x37dbe10
  File 
/home/jwashin/buildout-eggs/tmprA8xJD/zope.publisher-3.5.0a1.dev_r78838-py2.5.egg/zope/publisher/publish.py,
 line 114, in debug_call
  File 
/home/jwashin/buildout-eggs/tmpBqALB1/zope.app.container-3.5.0a1-py2.5-linux-x86_64.egg/zope/app/container/browser/contents.py,
 line 439, in index
  File 
/home/jwashin/buildout-eggs/tmpW6ie0m/zope.app.pagetemplate-3.4.0b1dev_r75616-py2.5.egg/zope/app/pagetemplate/viewpagetemplatefile.py,
 line 83, in __call__
  File 
/home/jwashin/buildout-eggs/tmpW6ie0m/zope.app.pagetemplate-3.4.0b1dev_r75616-py2.5.egg/zope/app/pagetemplate/viewpagetemplatefile.py,
 line 51, in __call__
  File 
/home/jwashin/buildout-eggs/tmpYyeA98/zope.pagetemplate-3.4.0a1-py2.5.egg/zope/pagetemplate/pagetemplate.py,
 line 115, in pt_render
  File 
/home/jwashin/buildout-eggs/tmpG5P6SX/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py,
 line 271, in __call__
  File 
/home/jwashin/buildout-eggs/tmpG5P6SX/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py,
 line 346, in interpret
  File 
/home/jwashin/buildout-eggs/tmpG5P6SX/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py,
 line 891, in do_useMacro
  File 
/home/jwashin/buildout-eggs/tmpG5P6SX/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py,
 line 346, in interpret
  File 
/home/jwashin/buildout-eggs/tmpG5P6SX/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py,
 line 536, in do_optTag_tal
  File 
/home/jwashin/buildout-eggs/tmpG5P6SX/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py,
 line 521, in do_optTag
  File 
/home/jwashin/buildout-eggs/tmpG5P6SX/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py,
 line 516, in no_tag
  File 
/home/jwashin/buildout-eggs/tmpG5P6SX/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py,
 line 346, in interpret
  File 
/home/jwashin/buildout-eggs/tmpG5P6SX/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py,
 line 861, in do_defineMacro
  File 
/home/jwashin/buildout-eggs/tmpG5P6SX/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py,
 line 346, in interpret
  File 
/home/jwashin/buildout-eggs/tmpG5P6SX/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py,
 line 957, in do_defineSlot
  File 
/home/jwashin/buildout-eggs/tmpG5P6SX/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py,
 line 346, in interpret
  File 
/home/jwashin/buildout-eggs/tmpG5P6SX/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py,
 line 949, in do_defineSlot
  File 
/home/jwashin/buildout-eggs/tmpG5P6SX/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py,
 line 346, in interpret
  File 
/home/jwashin/buildout-eggs/tmpG5P6SX/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py,
 line 822, in do_loop_tal
  File 
/home/jwashin/buildout-eggs/tmpD0OTbe/zope.tales-3.4.0a1-py2.5.egg/zope/tales/tales.py,
 line 682, in setRepeat
  File 
/home/jwashin/buildout-eggs/tmpD0OTbe/zope.tales-3.4.0a1-py2.5.egg/zope/tales/tales.py,
 line 696, in evaluate
   - 
/home/jwashin/buildout-eggs/zope.app.container-3.5.0a1-py2.5-linux-x86_64.egg/zope/app/container/browser/index.pt
   - Line 36, Column 6
   - Expression

Re: [Zope3-Users] Calling a view in a doc test

2007-06-04 Thread Jim Washington
Florian Lindner wrote:
 Hello,
 in a doctest I have an object which has a view registered.
 I want to call this view and test for the XML it returns.
 How can I call the view so that it is being rendered, just like called by a 
 browser?

 Thanks,

 Florian
 ___
 Zope3-users mailing list
 Zope3-users@zope.org
 http://mail.zope.org/mailman/listinfo/zope3-users
   
Hi, Florian

Search for zope.testbrowser.

It's sometimes used in functional doctests.

from zope.testbrowser.testing import Browser
browser = Browser('http://localhost/')
#browser.handleErrors = False
browser.open('/somepath/someview.html')

-Jim Washington
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Blog naming proposals

2007-05-28 Thread Jim Washington
Pablo Ambrosio wrote:
 Bitacora, spanish for log. Since all names with blog in it seem
 already taken.

hehe.  I wondered where the word bitakora came from.

as in http://www.codesyntax.com/bitakora

But that seems to be taken, too.  Sort-of...

If you like the 'z' thing, something like expressionz or noize might be
fun.  Certainly better than anything with a z prepended.

If you really want your product to have a stand-out name, check whatever
you are evaluating on google.  If there are no matches, all the better.

For example: junglefig .  (It's a planet earth reference.)

-Jim Washington

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Initial File Releases - Zif Collective

2007-04-14 Thread Jim Washington
On behalf of the Zif Collective we are pleased to announce the release
of the following packages:

zif.gzipper-0.2
WSGI middleware providing gzip compression for HTTP server output. Does
what mod_gzip/mod_deflate does in apache, but if your Zope 3 is not
behind apache, this may be useful.  Highly configurable for choosing
what gets compressed, but does not compress unless the client allows.

zif.headincludes-0.2
Zope 3-enabled WSGI middleware to manipulate css and javascript elements
in the HTML header.  It's essentially the same utility as
zc.resourcelibrary, except implemented as WSGI middleware.

zif.jsmin-0.2
WSGI middleware for javascript compression. Configurable levels of
compression.

zif.jsonserver-0.1
JSON/JSON-RPC support for Zope 3. Now with zif namespace.  Employs
python-cjson (fast and compliant) for coding/encoding JSON if
python-cjson is installed.

zif.xtemplate-0.1
Document-oriented XHTML templating for Zope 3. Use lxml's elementtree
API and XPath functionality to generate pages.  This is fairly alpha --
interfaces and scope are still in flux. 

The Zif Collective is a growing collection of useful packages for Zope
3, although it is intended that some of the packages will find utility
in other python efforts. Our software packages are available as eggs or
tar.gz sources at the Python Cheese Shop and Sourceforge. We welcome
your feedback and participation to improve our offering. You will find
our landing page at:

zif.sourceforge.net

Regards,
Jim Washington
David Pratt

The Zif Collective contains no harmful chemicals.
___
Zope3-users mailing list
[EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Is DTML Deprecated In Zope3?

2007-03-20 Thread Jim Washington
Mark, Jonathan (Integic) wrote:
 Phillip says in his book not to use DTML any more. However, I am finding that 
 what is easy in DTML, producing an Atom 1.0 feed, for instance, is harder in 
 ZPT. I get peculiar errors telling me that my XML boilerplate is not valid. 
 DTML doesn't care. 

 I notice that in the Zope 3.3 ZMI you can create a DTML page. So is DTML 
 going to be supported for the next few years?
   
If you are publishing xml-ish content in zope 3, you might consider
using something like the techniques in zif.xtemplate.  zif.xtemplate
makes XHTML (with appendix c) documents, but you could easily do
something similar for Atom (or RSS) feeds.

zif.xtemplate uses lxml to create XHTML documents using the elementtree
API.  This means using python functions, classes and methods to get
around in your data, do looping, etc.  You can load and parse a template
from the file system as a starter piece.  Additional processing is
available with lxml's xpath and xslt support. 

I find this document-centric method a very nice thing to develop with. 
On the bad side, view code using this technique needs a z3 restart (or
z3reload) for changes, but on the good side, all error tracebacks are
standard python tracebacks.

zif.xtemplate is sort-of alpha for the moment.  I'm still evaluating
methods that need to be included, and those that are YAGNI.  We have not
done any benchmarks vs. ZPT, but it seems fast enough. It includes an
HTMLSanitizer for dealing with untrusted HTML.  In the default
pretty-print mode, zif.xtemplate puts out web pages with very pretty source.

zif.xtemplate is at http://zif.sourceforge.net .  We have not made any
releases yet, but to see/use the code, it's available in sourceforge's
svn repository.  I'm interested in feedback.

svn co
http://zif.svn.sourceforge.net/svnroot/zif/zif.xtemplate/trunk/src/zif/xtemplate

-Jim Washington
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Menus

2007-02-19 Thread Jim Washington

David Johnson wrote:
I am curious what methods people use to implements simple web site 
menus?  It seems to be this must be a common task.


So far I've done this as follows:
1. Create a skin
2. Create a content type Menu as Ordered Container
3. Create a content type MenuItem as contained by Menu
4. Add a Menu and fill it with MenuItems
4. Register Menu
5. Create a macro which returns the Menu using zapi.getUtility()
6. Use the macro in the skin, and display all the MenuItems.


Hi, David

You can do it that way.

I've been successful with the browser:menu... directives in zcml.  The 
following, as part of my browser/configure.zcml file, actually creates 
an IBrowserMenu utility with a name of myMenu.  I have another set of 
menuItems for the same menu for different interfaces, so the same named 
menu has different items at different parts of the site.


I find it handy to have this configuration in the same file where I 
configure the names of the pages.


!-- name the menu --
  browser:menu
   id=myMenu
   title=Main menu
/
   
!-- MAIN MENU --

browser:menuItems
   menu=myMenu
   for=..interfaces.IMainInterface
   
   browser:menuItem
   title=Main Page
   action=/index.html
   permission=zope.Public
   /

   browser:menuItem
   title=About Us
   action=aboutus.html
   permission=zope.Public
  /
/browser:menuItems

- Jim Washington
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] getId in zope3?

2006-11-05 Thread Jim Washington
Peter Bengtsson wrote:
 In Zope2 every object has an 'id' which meant that you can use
 someobject.getId() to find out what name the object is stored under in
 its container.
 Is there an equivalent in zope3?
 ...or am I looking for a solution to a problem that doesn't exist?
Hi, Peter

Have a look at

zope.traversing.api

If you have an older source tree, look for

zope.app.traversing.api

which is deprecated, but OK to use until 3.5.

-Jim Washington
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] App server tracebacks for functional tests

2006-10-26 Thread Jim Washington
John Maddison wrote:
 Hi all,

 Firstly, I have written some tests for an application, and with both
 ./bin/test -u and ./bin/test -f, they pass successfully.  However,
 ./bin/test fails in the functional tests (on a form submit) with a
 rather uninformative HTTP Error 500: Internal Server Error.
 Performing as-near-as-I-can-make-it identical actions in a browser
 works fine.  I'm sure I'm missing something obvious - has anyone seen
 something like this before?  [I'm not attaching source code since I've
 not yet observed this problem in anything less than the entire
 (unfortunately) proprietary application I'm working on.]

 Secondly, and leading on from this, is it possible to get the
 traceback the application server side of things produces in functional
 (zope.app.testing.functional.FunctionalDocFileSuite) tests?  At the
 moment the only information I'm seeing is the aforementioned 500
 error.

If you are using zope.testbrowser,  you can set

browser.handleErrors=False

to get a more informative traceback.

-Jim Washington
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Reportlab threadsafe solution?

2006-09-26 Thread Jim Washington

Hi

I need to produce PDFs with reportlab.

reportlab is not threadsafe. 
(http://two.pairlist.net/pipermail/reportlab-users/2006-June/005037.html)


I think I need a way to queue or generate a lockfile on requests for 
PDFs so that only one-at-a-time is generated.


I'm hoping that there is a utility for this already, but search in the 
source for queue or serialize or lock gets me a lot of stuff that does 
not seem to relate to what I want.


This looks like it would be a relatively simple utility.  Has this been 
done yet?  Any hints?


-Jim Washington
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] How to make a new namespace for pagetemplates?

2006-09-08 Thread Jim Washington

FB wrote:

Hi,

On Fri, Sep 08, 2006 at 12:54:14PM +0200, Martijn Pieters wrote:
  

On 9/8/06, FB [EMAIL PROTECTED] wrote:


my employer want to have all external links marked with a small icon telling
anonymous users from the internet that everything behind given links is
beyond our responsibility.
  

Why not use a piece of javascript to do this? See the linkpopper
product on plone.org for a way to process all links in a page and
process them. That product makes external links open in a new window,
but the code should be easy to alter.



Thank you for the hint.

But there are several reasons for not using JS:
   * One of the constraints of that site is javascript being optional.
 Problem ist: marked links are mandatory - they have to be marked
 even with javascript turned off.
   * I'd like to have a tag-postprocessing namespace for some other
 reasons, too - e.g. for a printing-view that automatically creates
 a list of links at the end of the page.
   * I'd like to know, how to make a new pagetemplate namespace :-).

  

As a follow-on to Philipp's comment about WSGI middleware:

It could be fairly easy (to be sure, not *really* easy) to do a 
search-and-replace for link tags and do appropriate alterations in WSGI 
middleware.


If I were doing this, I might re-parse the document in middleware using 
lxml, then do an xpath query to find the locations in the document that 
need changing.  Then, it would be a matter of using the elementtree API 
to make the changes.  lxml.etree.tounicode() would put the page back 
together for output.  Since outgoing pages generated with ZPT are 
generally parseable, this might work OK.  N.B., You may have to use the 
DTD at some point with this method.  Lxml will attempt to xml-minimize 
(e.g., br/) all tags without text content, so you will have to assure 
that this does not happen where it shouldn't.


If you are not too married to generating pages with ZPT, and if you like 
the elementtree API, there is also a possibility of a lxml/elementtree 
(python-only) method for generating pages, which can have a method for 
post-processing the page, in a manner like the above, except that the 
document stays in a parsed state until it is output by Zope.  I have a 
working base class for this.  I call it XTemplate.  It's 
not-quite-ready-for-prime-time (no docs or tests, yet, and you have to 
do skinning within this framework), but if there is interest, I should 
be able to release a preview in the near future.


-Jim Washington
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: zc.tables integration with Zope3

2006-08-25 Thread Jim Washington

Luis De la Parra wrote:

Hello

this is how indexes are implemented in RDBMs.. don't know if sqllite has
such a feature, but in oracle the table content is just stored in files
(structured, but unordered) and a set of sorted indexes is kept for the
primary key and all other secundary indexes. 


each index has the search fields like index0 = lastname/firstname and
index1 = telephone and a  file/segment/row pointer to the information.
every update to the table triggers an update to all indices in the same
transaction, but you get searching, sorting and batching in return.

  
Yup.  But if your data is in a zodb,  you only have one (maybe two, with 
an OrderedFolder)  canonical ordering of things in a container.  Any 
other order requires sorting the entire set on the fly.


... At the moment. ;)

For anyone following this thread, I have updated my factoradic 
implementation code this morning.  It now memoizes to an sqlite db, and 
is much much faster overall.  http://blog.hill-street.net


-Jim Washington
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] zc.tables integration with Zope3

2006-08-23 Thread Jim Washington

Martijn Faassen wrote:

Jim Washington wrote:
This is probably a bit premature, but I have been doing some thinking 
about reordering/batching of large sets.


My current (not-quite-ready-for-prime-time) solution involves 
factoradics, and I have done a bit of a write-up on my blog, 
http://blog.hill-street.net/?p=5 .


I don't have time to read your article right now, but I will do so 
later. I'm quite interested in making the presentation of tabular data 
scale better. Right now, zc.table excepts to have access to the whole 
list in order to sort and batch it, but with huge amounts of data this 
may not scale so well. Relational databases have limit queries that 
seem to help here, though I'm not sure how much optimization is 
happening on the backend level.


Anyway, just wanted to register my interest in this topic, if indeed I 
understand you correctly.




Hi, Martijn

Good to hear that there may be some interest.  As usual, soon after 
publishing, I came up with some ideas for improving the implementation 
algorithms.  It's on my to-do list. 

BTW, I have recently been having some fun generating Zope 3 pages using 
lxml.  I plan to do another article about that, soon.


-Jim Washington
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] zc.tables integration with Zope3

2006-08-23 Thread Jim Washington

David Pratt wrote:
Hi Jim. This approach is completely new to me. It is interesting and 
I'll keep an eye on your blog. How expensive is updating indexes with 
data modification. You are talking about sqlite, does this mean you 
figure the indexes would be a significant drag on the ZODB due their 
size or is this idea a performance consideration. Many thanks.


The expense is in recalculating the new factoradic for each stored 
index, which involves a lot of division and factorial operations.  But 
this might be done in a smart way.  Maybe instead of on-change, we could 
recalculate an index on first access to that index after change.


Sqlite would be mainly for performance, ATM.  A lookup is less expensive 
than calculating a factoradic of a very large number.


Size may also be an issue if the index is stored in the zodb.  An 
integer (long as it might be) is the most compact representation of the 
factoradic. I'm pretty sure that longs end up as base ten strings in a 
pickle, but that is still smaller than the pickle of the factoradic list 
representation.  I still need to experiment more, but it's not out of 
the question that the indexes could end up as sqlite-backed annotations 
to the container/data source, particularly when sqlite may already be in 
the mix for memoizing factorial and/or factoradic calculations.


It may still turn out that this is all not worth the effort in practice.

-Jim Washington
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Dojo Support

2006-05-31 Thread Jim Washington
Rocky Burt wrote:
 On Tue, 2006-30-05 at 14:49 -0400, Jim Washington wrote:
   
 I am just starting to try-out Dojo (http://dojotoolkit.org). 

 Interestingly, the RPC it does is JSON-RPC. Since I am well-acquainted 
 with JSON-RPC support in Zope 3, I have put together a package for 
 making Dojo and its JSON-RPC client work with Zope 3.

 http://zif.hill-street.net/dojosupport

 At the moment, Dojo is just a new toy for me, but I see a lot of 
 potential for rich user interfaces using Zope 3 and Dojo.
 

 Perhaps the z3c.javascript project in svn.zope.org would benefit from
 inclusion with dojo (rather than you making your own prj).
   
Thanks, Rocky.  I sometimes need to be reminded about things like this.

I see some dojo support is already there in z3c.javascript, and it is
for most purposes identical to what I worked out.

-Jim Washington

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] New Request Variable?

2006-05-19 Thread Jim Washington
I have an expensive function (the result is a long list of IntIds) that 
I only want to call once in a request.  It only gets calculated the 
first time it is called, and the results may be used anytime after 
that.  But only for the current request.  A subsequent request has to 
recalculate from the beginning.


Session is the wrong place to stash this.  I do not want want it to 
persist beyond the current request.


Request is also the wrong place.  It's slotted; I cannot add variables.

So where is the proper place to hold on to something like this just for 
the duration of one request?


Suggestions (or solutions), anyone?  I fear I may have missed something 
obvious.


-Jim Washington

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] New Request Variable?

2006-05-19 Thread Jim Washington

Fred Drake wrote:

On 5/19/06, Jim Washington [EMAIL PROTECTED] wrote:

Request is also the wrong place.  It's slotted; I cannot add variables.


Isn't this what the request annotations are for?


 -Fred

Thanks, Fred.  That is, of course, the correct (and quite elegant) 
solution. 


-Jim Washington

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] How to make catalog working?

2006-05-16 Thread Jim Washington
Frank Burkhardt wrote:
 Hi,

 On Mon, May 15, 2006 at 11:16:09PM +0200, Florian Lindner wrote:
   
 Hello,
 I've added some content objects of interface IFoo to my site.
 Then I added a catalog to my site (and also a IntID utility). I registered 
 both. To the catalog I've added a FieldIndex and a TextIndex, set the 
 interface to IFoo and the fieldname to a field that IFoo has. I registered 
 both indexes.
 

 The IntID utility has to be registered *before* all the objects you
 want to find. No object created before you had a registered IntID
 will ever be found.

 Have a look at

  http://zope3.mpg.de/suchen (Das Prinzip)

   
You can get the IntIDs utility to register objects after they are created.

Something like the below will register and catalog a bunch of items:

def catalog_items(self):
intids = zapi.getUtility(IIntIds,[name])
catalog = zapi.getUtility(ICatalog,[name])
for item in some_function_that_returns_the_items():
catalog.index_doc(intids.register(item), item)

The most important part is the intids.register(item) statement.

-Jim Washington

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Re: [Zope3-dev] Re: Zope 3 lacks Ajax capability?

2006-05-16 Thread Jim Washington
:: moved to zope3-users

Jeff Rush wrote:
 Tarek Ziadé wrote:
 Jeff Rush wrote:

 what does your code actually do ?

 Provide a chat window at the bottom of a page, in which a student
 interacts with a teaching app and members of his team.  In the upper
 portion of the page, the teaching app alternately presents proficency
 questionaires and lessons.

 My idea was to construct a Zope widget component that can be dropped
 over, using widget= in ZCML, a TextArea/Lines Zope widget and
 transform it into an async typing window into a chat space.

You might consider using jsonserver (JSON-RPC) for the ajax-y
communication.  Soon, JSON-RPC (1.1-specification) will have native
support for keyword (named) parameters, which provides a python-ish feel
for the javascript calls.

I have a public example (not open-sourced, sorry - line-of-business app)
of jsonserver in action at http://www1.vtdata.org . It's fast and does
the async communication with little fuss.

jsonserver is available at http://zif.hill-street.net/jsonserver

-Jim Washington
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: [Zope3-dev] Re: Zope 3 lacks Ajax capability?

2006-05-16 Thread Jim Washington
Benji York wrote:
 Jim Washington wrote:
 I have a public example (not open-sourced, sorry - line-of-business app)
 of jsonserver in action at http://www1.vtdata.org . It's fast and does
 the async communication with little fuss.

 Very cool.
Thanks!  (and apologies to non-US-ians about the US-centric questions :(
) The quiz app still has a few soon-to-be-resolved edge-case buglets,
but we have been using it for high school contests around the state
(yes, through cranky school district firewalls/proxies, etc.), and for
occasional exams around the university.

An upcoming jsonserver release will have its own JSON-RPC javascript
included, based on Roger's JSON-RPC javascript in Tiks.  jsolait, while
still OK to use, will no longer be an external recommended dependency,
which I think will make a lot of people happy.

The new semantics of JSON-RPC1.1 will be available.  Keyword parameters
are cool!

Best of all, the new release will be a unified release that will operate
in both Zope 2/Five and Zope 3.  Balazs Ree is the genius behind that
amazing feat.

Stay tuned!

-Jim Washington
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] How to make catalog working?

2006-05-16 Thread Jim Washington

 The problem is not that objects have been created before the IntIDs utility.

 The IntID utility says that 3 objects are registered, but the catalog indexes 
 are still zero count.

   
This is a bit baffling.  Did you name your IntIDs utility?  The IntIDs
utility works best when unnamed, I think.

-Jim Washington


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] More fun with WSGI/zope.paste

2006-05-09 Thread Jim Washington
Gary Poster wrote:


 Checking in the code is an assertion of provenance/license: for
 instance, I wouldn't have known about the Plone code, which is
 potentially a problem because of GPL vs. ZPL (see below).

Hold-off on checking-in jsmin.  The original author of the packer has
not decided whether allow us a BSD-ish license or ZPL.
 Wanna get commit privileges? :-)  It's the easiest way for you to
 assert the code's status.

Can't at the moment.  My note to Benji explains.  Maybe after I see the
new contributor agreement...
 - putting them in a namespace?
 Probably a good idea.  If it was only one... well, but I do seem to have
 gotten prolific. :)

 :-)

 Go for it (on whichever namespace gets decided).  These three projects,
 I feel a need to reiterate, need zope.paste and Paste.Deploy (or a
 similar stack), to use with zope3, so deprecating zc.resourcelibrary may
 not be a good idea until more folks are on-board with the wsgi filters
 idea.

 I think the project is on board with wsgi.  paste is maybe not as
 mainstream in the Zope world yet, so yes, maybe we need to let that
 settle out.  If there are no issues with the paste-based version,
 though, I'd like zc to use it.

No further issues.  There is some code from Python Cookbook (Python
License, presumably, and presumably acceptable) but the rest is
substantially mine.
 gzipper and jsmin really have no particular ties to zope at all,
 except that I used Zope3 for developing them, and they probably work OK
 in Zope3 as a consequence. (PS. er, actually, the packer in jsmin came
 from Plone.)

 eek!  GPL can't go in zope.org.  Do you know what the license is to
 that particular component?

Of course, I went eek! first when Balazs wanted to include the packer
in jsonserver / concatresource when it was GPL.  This will be handled in
a most appropriate and satisfactory manner.
 With the caveats above, sounds great. :-)

Good.  You will find that my code has the very liberal Academic Free
License referenced.  If you need different, I will be happy to relicense.

-Jim Washington

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: Re : [Zope3-Users] formlib problem

2006-04-19 Thread Jim Washington
: ('Could not adapt', Items at 0x3d7ce30, 
InterfaceClass zope.app.traversing.interfaces.IPhysicallyLocatable)
 C:\Python24\Lib\site-packages\zope\tal\talinterpreter.py line 352 in interpret
 = 'handlers[opcode](self, args)'
 ** exceptions.TypeError: ('Could not adapt', Items at 0x3d7ce30, 
InterfaceClass zope.app.traversing.interfaces.IPhysicallyLocatable)
 C:\Python24\Lib\site-packages\zope\tal\talinterpreter.py line 976 in 
do_defineSlot
 = 'self.interpret(block)'
 ** exceptions.TypeError: ('Could not adapt', Items at 0x3d7ce30, 
InterfaceClass zope.app.traversing.interfaces.IPhysicallyLocatable)
 C:\Python24\Lib\site-packages\zope\tal\talinterpreter.py line 352 in interpret
 = 'handlers[opcode](self, args)'
 ** exceptions.TypeError: ('Could not adapt', Items at 0x3d7ce30, 
InterfaceClass zope.app.traversing.interfaces.IPhysicallyLocatable)
 C:\Python24\Lib\site-packages\zope\tal\talinterpreter.py line 625 in 
do_insertText_tal
 = 'text = self.engine.evaluateText(stuff[0])'
 ** exceptions.TypeError: ('Could not adapt', Items at 0x3d7ce30, 
InterfaceClass zope.app.traversing.interfaces.IPhysicallyLocatable)
 C:\Python24\Lib\site-packages\zope\app\pagetemplate\engine.py line 101 in 
evaluateText
 = 'text = self.evaluate(expr)'
 ** exceptions.TypeError: ('Could not adapt', Items at 0x3d7ce30, 
InterfaceClass zope.app.traversing.interfaces.IPhysicallyLocatable)
 C:\Python24\Lib\site-packages\zope\tales\tales.py line 696 in evaluate
 = 'return expression(self)'
 ** exceptions.TypeError: ('Could not adapt', Items at 0x3d7ce30, 
InterfaceClass zope.app.traversing.interfaces.IPhysicallyLocatable)
 C:\Python24\Lib\site-packages\zope\tales\expressions.py line 249 in __call__
 = 'v = var(econtext)'
 ** exceptions.TypeError: ('Could not adapt', Items at 0x3d7ce30, 
InterfaceClass zope.app.traversing.interfaces.IPhysicallyLocatable)
 C:\Python24\Lib\site-packages\zope\tales\expressions.py line 205 in __call__
 = 'return self._eval(econtext)'
 ** exceptions.TypeError: ('Could not adapt', Items at 0x3d7ce30, 
InterfaceClass zope.app.traversing.interfaces.IPhysicallyLocatable)
 C:\Python24\Lib\site-packages\zope\tales\expressions.py line 199 in _eval
 = 'return ob()'
 ** exceptions.TypeError: ('Could not adapt', Items at 0x3d7ce30, 
InterfaceClass zope.app.traversing.interfaces.IPhysicallyLocatable)
 C:\Python24\Lib\site-packages\zope\app\pagetemplate\talesapi.py line 73 in 
title_or_name
 = return getattr(self, 'title', '') or zapi.name(self.context)
 ** exceptions.TypeError: ('Could not adapt', Items at 0x3d7ce30, 
InterfaceClass zope.app.traversing.interfaces.IPhysicallyLocatable)
 C:\Python24\Lib\site-packages\zope\app\traversing\api.py line 149 in getName
 = 'return IPhysicallyLocatable(obj).getName()'
 ** exceptions.TypeError: ('Could not adapt', Items at 0x3d7ce30, 
InterfaceClass zope.app.traversing.interfaces.IPhysicallyLocatable)
 C:\Python24\Lib\site-packages\zope\interface\interface.py line 682 in __call__
 = 'raise TypeError(Could not adapt, obj, self)'
 ** exceptions.TypeError: ('Could not adapt', Items at 0x3d7ce30, 
InterfaceClass zope.app.traversing.interfaces.IPhysicallyLocatable)
 127.0.0.1 - - [19/Apr/2006:16:13:32 +0200] POST /netevenTest/test/neteven.Accounts.1/ HTTP/1.1 
200 163 - Mozilla/5.0 (Windows; U; Windows NT 5.1; fr-FR; rv:1.7.12) Gecko/20050919 
Firefox/1.0.7
 
 It seems that retrieving my object from code doesn't give me an address for it, which would cause the problem with IPhysicallyLocatable (my uninformed guess).

 Is there a way to solve the problem, knowing that my object is retrieved 
through sqlos, and thus has no true address ? There might be something else but 
being
 quite new to zope 3 (and enjoying it, thanks to you all guys), I can't figure 
it out.
  

Maybe these questions will help.

What is an Items object? 
Why are you calling a page template that needs title_or_name with an 
Items object as the context?


-Jim Washington
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: Re : Re : [Zope3-Users] formlib problem

2006-04-19 Thread Jim Washington

Stéphane Brault wrote:
Hi Jim, 
 the Items object is my object, linked to my items, table which implements the IItems interface I use for my form:
 
 from neteven.interfaces.items import IItems
 from zope.formlib import form
 
 class ItemsForm(form.EditForm):

 form_fields = form.Fields(IItems)
 form_fields = form_fields.omit('dateLastUpdate')
 
 Items is defined this way:
 
 from zope.interface import implements

 from sqlobject import *
 from sqlos import SQLOS
 from neteven.interfaces.items import IItems
 
 class Items(SQLOS):

 implements(IItems)
 
 class sqlmeta:

 table = 'items'
 
 
  When I add this zcml declaration :

 browser:page
   for=.interfaces.items.IItems
   name=edit.html
   class=.forms.items.ItemsForm
   menu=zmi_views
   title=Edit a Item
   permission=zope.ManageContent
   /
 everything works fine from the ZMI (I created simple containers to test that).
 
 My JSON server side code is:
 
 def getItemEdit(self, itemId):

 item = Items.get(itemId) #a sqlos function to get an Item instance 
from the table given its Id
 return ItemsForm(item, self.request)()
 
The fact is I don't use any page template right now ( though I might do this later to have a nice GUI).
 
  

Actually, you are using a page template.

Calling ItemsForm() invokes the render() method of 
zope.formlib.form.FormBase, which uses pageform.pt in the zope.formlib 
folder by default.  This is where title_or_id is requested.


You may wish to set a different template for your ItemsForm class.

Have you tried subclassing form.SubPageEditForm instead of form.EditForm?

-Jim Washington


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Announce: httpgz - gzip compression

2006-03-18 Thread Jim Washington
Announcing httpgz, a Zope 3 package that performs gzip compression of 
most responses.


More information and download is available at 
http://zif.hill-street.net/httpgz . There's not much to it, but 
bandwidth savings of up to 80% are possible.


httpgz requires Zope 3 version 3.2 or greater.

Enjoy!

-Jim Washington


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Please Guido, pick me, pick me!

2006-02-03 Thread Jim Washington

Martin Aspeli wrote:

Lennart Regebro [EMAIL PROTECTED] writes:

  

But having a name that signifies that there is something a little more than a
new major-version release going on here would go a long way in giving people
something to fix their minds on.
  

Not if that name changes with every release, becuase then people will
see it as a release code name, because that's what it will be.



Absolutely - we seem to be on the same page. :)

The branding needs to be consistent and carried forward, until such time we
refactor the whole thing again and call it Zope 4. :)
  
My university, Virginia Tech, is doing something similar right now, and 
I think it is in part due to recent negative publicity involving 
athletics (I could be wrong). 

The vision includes a new trademarked tagline (Invent the Future) and a 
new logo incorporating the tagline. 
http://www.vtnews.vt.edu/story.php?relyear=2006itemno=53


We could do something similar:

Zope 3: Excellence in Web Component Design

OK, I'm not a marketer, but something in that vein could help to gain 
community standing.


-Jim Washington
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problem: Could not locate Zope software installation! - solution

2006-01-16 Thread Jim Washington

Martin Kudlvasr wrote:

Ronald L Chichester wrote:


This, of course, begs the question of some 64-bit compatibility issue.
  
That is a possibility, but we do have a 64-bit Athalon running here used 
  in daily development with no problems (running Ubuntu).



the problem is really 64 compatibility issue.
When I look into mkzopeinstance script:


***
for parts in [(src,), (lib, python), (Lib, site-packages)]:
d = os.path.join(swhome, *(parts + (zope, app, appsetup)))
if os.path.isdir(d):
d = os.path.join(swhome, *parts)
sys.path.insert(0, d)
break
else:
try:
import zope.app.server
except ImportError:
print sys.stderr, Could not locate Zope software
installation!
sys.exit(1)
***
this means that first of directories $PREFIX/src, $PREFIX/lib/python,
$PREFIX/Lib/site-packages (suffixed by zope/app/appsetup) is added to
sys.path

BUT !!! when compiled on 64 architecture, zope compiles its files into
$PREFIX/lib64 directory, so the mkzopeinstance cannot import
zope.app.server and fails.

I succesfully used:

***
for parts in [(src,), (lib, python), (lib64, python), (Lib,
site-packages)]:
***

3.2.0-final has the same problem

I please anybody competent to fix this.

  

This has been reported to the collector:

http://www.zope.org/Collectors/Zope3-dev/528

My (local) fix was to make a symlink, lib64-lib, in the instance 
directory.  This also works.


-Jim Washington
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problem: Could not locate Zope software installation! - solution

2006-01-16 Thread Jim Washington




My (local) fix was to make a symlink, lib64-lib, in the instance 
directory.  This also works.

Oops, I meant swhome directory.

-Jim Washington
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Eric3 unit tests and debugger?

2006-01-05 Thread Jim Washington

I like the Eric3 python IDE. http://www.die-offenbachs.de/detlev/eric3.html

I've been using it for a while, mainly for file organization and its SVN 
and Bicycle Repair Man integration.  It claims support for unit testing 
and debugging, but the setup for those seems to be more oriented toward 
full PyQt applications than packages within another framework.  Has 
anyone tried to get those working for z3 project development? 


-Jim Washington

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problem: Could not locate Zope software installation!

2005-10-06 Thread Jim Washington

Ronald L Chichester wrote:

I downloaded ZopeX3-3.0.1 and Zope3.1 (final).  The ./configure | make 
| make install (as root) went without a hitch.  However, when I went 
to make an instance (with either 3.0.1 or 3.1) I got a Could not 
locate Zope software installation!


In both cases, I used the default settings (i.e., Zope was made in 
/usr/local/Zopex/


I used /usr/local/ZopeX3x/bin/mkzopeinstance -u manager:secret

... and got the error message.

I've seen this before in the bug track list, but has anyone got a 
workaround?  I'm using Zope on Gentoo Linux (2.6.13-r2 kernel) with 
python 2.3.5 and and GCC 3.4.4.



Just a guess.  Do you have net-zope/zopeinterface installed?  It
provides a package named zope in /usr/lib/[system
python]/site-packages.  This might make weird namespace issues.

-Jim Washington

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] pau and zope.manager

2005-10-04 Thread Jim Washington

I wrote:

I want to use pau, with session (cookie) based authentication.  No 
basic authentication.


The problem is, when the pau is activated, the zope.manager defined in 
zcml seems to be no longer accessible, effectively locking me out of 
the zmi.


What I think is happening is the pau appends a prefix to the principal 
name, so that the principal, instead of being zope.manager, becomes 
prefixzope.manager, which has no permissions anywhere.


I think my choices are the following.

1.  make pau always look (last) in principalRegistry and return a 
non-prefixed principal if found and validated
2.  have my authentication plugin look in principalRegistry and assign 
the same roles for the principals found in principalRegistry, but with 
the pau prefix.  This would happen when the plugin is created or on 
demand.
3.  provide methods for my authentication plugin to generate an 
emergency user for one of its valid principals


Or did I miss something in the documentation that gets around this?


Apparently not?  So, I am going to choose door #3.  It should be pretty 
simple.  The main hazard is getting it wrong, which will require some 
amusing spelunking with the debugger to deactivate the utility if there 
is anything important in the ZODB.  On the good side, it will prep me 
for the next project, which I think will require ldap.


-Jim Washington

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] pau and zope.manager

2005-10-03 Thread Jim Washington
I want to use pau, with session (cookie) based authentication.  No basic 
authentication.


The problem is, when the pau is activated, the zope.manager defined in 
zcml seems to be no longer accessible, effectively locking me out of the 
zmi.


What I think is happening is the pau appends a prefix to the principal 
name, so that the principal, instead of being zope.manager, becomes 
prefixzope.manager, which has no permissions anywhere.


I think my choices are the following.

1.  make pau always look (last) in principalRegistry and return a 
non-prefixed principal if found and validated
2.  have my authentication plugin look in principalRegistry and assign 
the same roles for the principals found in principalRegistry, but with 
the pau prefix.  This would happen when the plugin is created or on demand.
3.  provide methods for my authentication plugin to generate an 
emergency user for one of its valid principals


Or did I miss something in the documentation that gets around this?

-Jim Washington
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Announce: jsonserver-1.0beta3 and jsonserver-1.1alpha

2005-09-09 Thread Jim Washington

Announcing jsonserver1.0 beta3 and 1.1alpha

jsonserver provides some JSON-RPC (http://json-rpc.org) support for zope3. 


jsonserver-1.0beta3 is available at http://zif.hill-street.net/jsonserver

or at svn repository

http://brigadoon.hill-street.net/svn/repos/jsonserver/tags/jsonserver-1.0beta3/

The major change for beta3 is improved safety for the minjson.py JSON 
parser.  It now pre-parses and inspects the incoming JSON to make rogue 
client exploits less likely.  They were not likely before, but now it's 
more belt-and-suspenders.  Unlike beta2, beta3 works with python-2.3.


jsonserver trunk (1.1alpha) is keeping up with zope3 trunk.  It now does 
the wsgi thing, too, which I presume to be zope3's behavior for 3.2+.  
IMPORTANT: jsonserver trunk is now likely incompatible with zope3 3.1 or 
lower. 


jsonserver trunk is available at svn repository

http://brigadoon.hill-street.net/svn/repos/jsonserver/trunk

Why use JSON-RPC when there is a perfectly good XML-RPC?  Client 
support.  jsonserver with jsolait works with most gecko browsers 
(Firefox, Mozilla, Netscape 6.1+, etc.), khtml browsers (Safari 1.2+ and 
konqueror 3.4+), recent IEs, and Opera 8.1. And I understand it is very 
easy to write your own client in javascript, should you choose not to 
use jsolait.  JSON-RPC also has a notify concept, where the client may 
send a message to the server and not expect a return response.  This is 
handy for methods that do things but do not return things.


Why does jsonserver replace the zope3 HTTP server?  Client support.  We 
need to sniff at the incoming data stream in case the client is Opera 
and the content-type is not set the way we want.  Actually, jsonserver 
uses much the same code as zope3 trunk, and at the moment I don't think 
there is any other way to add another RPC listener. There should not be 
any noticeable difference other than adding support for JSON-RPC.


So this is an AJAX technology? Well, it's more AJAJ,  JSON instead of 
XML for the last letter of the acronym.  Web browser clients use 
XMLHTTPRequest to send and receive data without a complete page refresh. 
You may transport HTML or XML snippets as javascript strings, so there 
is little difference technically.


-Jim Washington
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Announce: jsonserver-1.0beta3 and jsonserver-1.1alpha

2005-09-09 Thread Jim Washington

PS.  username anonymous and no password are needed for read access to
the svn repository.

-Jim

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Announcement - jsonserver 1.0 beta1, JSON-RPC for Zope3

2005-07-27 Thread Jim Washington

Announcing:  jsonserver 1.0 beta1.

jsonserver is an implementation of JSON-RPC for Zope 3.  It enhances
Zope 3's http server to listen for content-type of 'text/x-json' and
allows json-rpc methods.  json-rpc methods are used like xml-rpc methods.

jsonserver is licensed ZPL2.1.

This is a beta release.  It does everything I need it to do, but there
may still be some bugs or features I missed that people want.  It works
with current Zope 3 svn trunk.  It may work with earlier versions of
Zope 3. Tests are included, just to be sure.

Since the alpha announcement, there have been many bugfixes, and the
JSON implementation is now a replaceable component.  jsonserver also now
provides feature=jsonrpc, so you can write conditional zcml that takes
effect only if jsonrpc is available (thanks, Roger Ineichen!).

The README.txt file has installation instructions and information about
dependencies.

jsonserver is available at http://zif.hill-street.net/jsonserver

For more about JSON and links about JSON-RPC, see
http://en.wikipedia.org/wiki/JSON .

-Jim Washington

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Announcement - jsonserver 1.0 alpha, JSON-RPC for Zope3

2005-06-23 Thread Jim Washington
Stephan Richter wrote:

Congratulations, though I know its late! :-) There might be some interest in 
the Z3-ECM community of a JSON server.

  

I would hope there would be interest in Z3-ECM.  JSON's almost-python
notation is very fast to read and write, and particularly so with
minjson.py, which is part of the project.  Of course, JSON(-RPC) only
transports text-ish things; images and such need a different transport,
I think.

And I probably should have been a bit more explanatory on a couple of
things in my announcement:

1.  Since it is in my svn repository, and still alpha, it will change
(presumably improve) as I see fit.  If anyone sees anything that needs
improving, let me know; I'm still enthusiastic about the project, so
updates can happen quickly.  In fact, I just did a minor update.  Debug
info now uses the logging facility instead of simply printing on the
console :) .  I'll wait until I hear positive things from anyone needing
unicode (still a nagging worry) with it before I make a beta announcement.

2.  My subversion repository is http only:

svn co http://brigadoon.hill-street.net/svn/repos/jsonserver/trunk 
jsonserver

will work OK.  I did not bother poking another hole in the firewall for
svn://

3.  minjson.py (also updated an hour or so ago) seems to work OK in
pythons 2.3 and 2.4

4.  If there's interest, I could probably put together and include a
simple demonstration application. I am open for suggestions on what that
app might be.

BTW, I have also deicded that I will tackle the HTTPRequestFactory issue for 
3.2 by developing some sort of registry based on subscribers that decides 
based on registered subscribers which request to create. This way all you 
need to do is to register a new subscriber to hook up a new HTTP extension. 
Maybe I make it a utility, I don't know. :-)
  

Thanks, Stephan. That sounds appropriate.  It seemed unpythonic to
duplicate the code for all content-type listeners to add one
content-type listener.

Regards,

-Jim Washington
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users