Re: [Zope3-Users] Working with the last version of a module

2009-03-26 Thread Paul Carduner
Assuming your project is using svn, you can use svn:externals property
to automatically check out the trunk version. i.e.:

$ svn pedit svn:externals .

some editor opens and you should add this:

z3c.form svn://svn.zope.org/repos/main/z3c.form/trunk


Once you have the externals set, you can add z3c.form to the list of
develop eggs and override any pinned versions in your buildout.cfg...
i.e.

[buildout]
... some stuff here...
develop = . z3c.form
versions = versions

[versions]
z3c.form =

(note the z3c.form version is specifically left blank so it uses the
develop egg)

2009/3/26 Simon Elbaz elbazsim...@gmail.com:
 Hi,
 I need to use z3c.form and the last downloadable release is 1.9.0 in the
 python package index.
 However, I would like to use the last version of z3c.form (trunk revision in
 svn.zope.org).

 How I could do that ?

 Thanks for your help
 Simon



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





-- 
Paul Carduner
http://www.carduner.net
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Looking for the Z3C tutorial?

2008-10-09 Thread Paul Carduner
Hi everyone,

My website that was hosting the z3c tutorial recently went down.  I
haven't had time to diagnose the problems and bring it back up.  In
the mean time, I have moved the z3c tutorial to ibiblio.  If you have
been looking for it recently, you can find it here:

http://www.ibiblio.org/paulcarduner/z3ctutorial/

-- 
Paul Carduner
http://www.carduner.net
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] z3c.formjs - global js-variables and form-content in scripts

2008-09-18 Thread Paul Carduner
On Wed, Sep 17, 2008 at 4:48 PM, garz [EMAIL PROTECTED] wrote:

 hi,

 i'm working with z3c.formjs and there are three questions that arose.

 1.) defining global variables
 i'd like to define some global variables that i can refer to in the
 functions that i want to define with the jsfunction-package. for example a
 global counter that counts something. is there any possibility to do so?

You can include any global javascript functions the same way you
include style sheets and other resources: either by placing said
script directly into your layout template, or using JavaScriptViewlet
objects and the viewlet manager pattern.  As long as your global
javascript function appears before any dynamically generated
javascript within the rendered page, the function will be available in
all rendered jsfunctions.

 2.) form-content in jsfunctions-scripts
 i want to define a jsfunction that returns a rendered widget. this widget is
 an information that the particular instance of a form has. so i need to
 somehow access that form to get that widget. as far as i can see this there
 is no possibility to do this with jfsunction-package, since the functions
 defined with it are static and they arent given any useful parameter-values
 when called.

The parameters passed to the renderer javascript function are only
javascript objects and do not have any special knowledge about the
form.  I'm not sure I completely understand your use case.  When you
say form and widget, are you referring to the form and widget as they
are represented on the server side or as they are rendered on the
client's web page?

 so i looked at jsevent and jsaction but the problem there is they dont know
 the source form neither. they know the calling request, but since im working
 with subforms, i need to know the exact form where the executed handler is
 coming from. neither the request nor the jssubscriptions know about the
 source-form.

 so it isnt meant to weave form-specific data into the js-script. so what is
 the solution to this? i cant see it.

Again I'm not sure if you are talking about server or client.  From
the server perspective, if you have

@jsfunction.function('z3c')
def myFunc(self):
  return ualert('the fields in this form are %s'); % [w.id for w in
self.widgets.values()]

then calling the function from javascript will give the widgets of
that field.  But of course this gets hard coded into the javascript
function so it is not dynamic from the client perspective.

 3.) jssubscriptions-renderer
 why are those renderers only in the testing-package? arent they good enough?
 or is this usually done another way?

There is JQuerySubscriptionRenderer in jqueryrenderer.py.  It looks
just like the one in testing because jquery is the reference
implementation.


 +++

 my goal is to write a general sequence-form, that can display a sequence
 consisting of an arbitrary widget. it should provide delete-buttons for
 every element. in add-forms, the functionality of these should be realized
 through javascript, dom-manipulation plus submit and in edit-forms without
 submit but with ajax.

This particular use case I think is too high level for a package like
formjs, but would certainly be a great addition as an example in
formjsdemo.  It seems quite similar to the tree editor demo in
formjsdemo: http://demo.carduner.net/z3c.formjsdemo/test

 since i dont think that that there is a solution to this need, i think i
 will have to adjust formjs. i would like to make that clean, means i dont
 want to do a hacky formjs-adaption. maybe this usecase is already known
 and there is interest in evolving formjs? maybe through new packages? maybe
 through rewrites?

Extensions to formjs for supporting these types of CRUD use cases are
certainly welcome.  Feel free to start hacking on a branch.

-- 
Paul Carduner
http://www.carduner.net
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Help: I cannot login after installing z3c.formjs

2008-07-15 Thread Paul Carduner
, zope.contentprovider.interfaces.BeforeUpdateEvent
 object at 0xafeb33cc, zope.contentprovider.interfaces.BeforeUpdateEvent
 object at 0xafeb348c, zope.contentprovider.interfaces.BeforeUpdateEvent
 object at 0xafeb354c, zope.contentprovider.interfaces.BeforeUpdateEvent
 object at 0xafeb35ec, zope.contentprovider.interfaces.BeforeUpdateEvent
 object at 0xafeb318c, zope.contentprovider.interfaces.BeforeUpdateEvent
 object at 0xafeb362c, zope.contentprovider.interfaces.BeforeUpdateEvent
 object at 0xafeb1a4c, zope.contentprovider.interfaces.BeforeUpdateEvent
 object at 0xafeb1b6c, zope.contentprovider.interfaces.BeforeUpdateEvent
 object at 0xafeb1f8c, zope.contentprovider.interfaces.BeforeUpdateEvent
 object at 0xafeb190c, zope.contentprovider.interfaces.BeforeUpdateEvent
 object at 0xafeb16ac, zope.contentprovider.interfaces.BeforeUpdateEvent
 object at 0xafeb18cc, zope.contentprovider.interfaces.BeforeUpdateEvent
 object at 0xafeb172c, zope.contentprovider.interfaces.BeforeUpdateEvent
 object at 0xafeb18ac]}
 (Pdb)
 credentials.request_annotations['z3c.formjs.jsclientevent.caughtEvents'][0]
 zope.app.publication.interfaces.BeforeTraverseEvent object at 0xafea8e4c
 (Pdb)
 cPickle.dumps(credentials.request_annotations['z3c.formjs.jsclientevent.caughtEvents'][0])
 *** UnpickleableError: Cannot pickle type 'zope.security._proxy._Proxy'
 objects

 (Pdb) ev =
 credentials.request_annotations['z3c.formjs.jsclientevent.caughtEvents'][0]
 (Pdb) ev.object
 zope.app.folder.folder.Folder object at 0xb6034b6c
 (Pdb) cPickle.dumps(ev.object)
 *** UnpickleableError: Cannot pickle type 'zope.security._proxy._Proxy'
 objects
 (Pdb) cPickle.dumps(ev.request)
 *** TypeError: a class that defines __slots__ without defining
 __getstate__ cannot be pickled




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




-- 
Paul Carduner
http://www.carduner.net
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] A slew of z3c.form questions

2008-07-06 Thread Paul Carduner
On Sun, Jul 6, 2008 at 12:46 PM, Martin Aspeli [EMAIL PROTECTED] wrote:
 Hi,

 I'm using z3c.form in Plone via plone.z3cform. The z3c.form documentation is
 very good and very detailed, but I must admit to getting a bit lost in all
 of it. :)

 To that end, I have a few questions. I'm creating a pair of add- and edit
 forms for a content item:

  - I've created a few buttons with @button.buttonAndHandler(). However, I
 need to set a different CSS class for each button. What's the easiest way to
 do that?

You can override the updateActions method and modify the css after the
buttons are created.  As you may have read, buttons are like schema
fields, and actions are like the widgets for a schema field.  So to
modify the appearance of a button, you have to actually modify the
action:

@button.buttonAndHander(My Button, name=myButton)
def handleMyButton(self, action):
print handling my button

def updateActions(self):
super(MyForm, self).updateActions()
self.actions[myButton].addClass(my-custom-css-class)

  - Some fields on the form are provided by the content item. Others can come
 from other schemata. There will be adapters from the context to these
 interfaces. How do it up so that z3c.form uses the appropriate adapter to
 read and write values, including in the add form?

In the add form, it is up to you to handle the data input, by
implementing the create and add methods.  As for the edit forms, I'm
not entirely sure about this but I believe the form framework will
just do the right thing.  i.e. you might say:

fields = field.Fields(IMyInterface)
fields += field.Fields(IMyOtherInterface)

And it will automatically try to adapt the context to the interface
from which the field was defined.  An alternative way which will
definitely work (even if you don't have adapters) is to use groups:

class MyOtherInterfaceGroup(group.Group):
fields = field.Fields(IMyOtherInterface)
def getContent(self):
# do whatever you have to do to get something implementing
IMyOtherInterface, adaptation or otherwise
return myInterfaceToOtherInterfaceAdapter(self.context) #even
a direct call to a specific adapter

class MyForm(group.GroupForm):
fields = field.Fields(IMyOtherInterface)
groups = (MyOtherInterfaceGroup,)

This is essentially the poor man's version of having a subform.  It's
also a great way to fake object widgets when one of the fields of
IMyInterface is of type zope.schema.Object.

  - I'd like to group widgets together into fieldsets. A fieldset may contain
 widgets from multiple interfaces. All fieldsets will be on the same form, in
 different fieldset / tags. Should I look to use groups for this? Subforms?
 Or something else?

I'd recommend just writing your own template.  I've found that the
templates in z3c.formui can only take you so far, and are best used as
prototyping tools and reference documents.  Of course, you can always
reuse many of the macros, especially when it comes to displaying
widget error messages.

-- 
Paul Carduner
http://www.carduner.net
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Is ZAM suitable for a new application?

2008-06-02 Thread Paul Carduner
On Mon, Jun 2, 2008 at 7:56 AM, Junyong Pan [EMAIL PROTECTED] wrote:
 I found zam has very nice interface. And it's pluggable structure is
 quite flexible.

 I wan't to use it for my new application. But I don't know if zam is
 created for this purpose.

 Can anyone talk more about ZAM? When ZAM is mature, what will it
 influence the zope world? For example, will most prodcuts be released
 as installable zamplugins, Just like what Plone products like?

 I found so few information about zam. It really need more documentations.

 Thanks.

Roger Ineichen can give you the best response to this question.  ZAM
stands for Zope Application Management.  I wouldn't use it as the
basis for your application, however I have been using it quite
successfully as the administrative side of a web application.  This
includes things like browsing the object hierarchy, viewing error
logs, managing the server process, and some other basic tasks that
were provided by the Rotterdam skin.  ZAM provides the functionality
that just about every website needs, but which you rarely want to
expose to end users.  As I see it, ZAM is just a zope component which
you can use in your web application for common administrative tasks -
it is not a platform in the same way Zope 2 is.  I hope that was
somewhat helpful.

-- 
Paul Carduner
http://www.carduner.net
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] z3cformdemo w/zopeproject

2008-05-31 Thread Paul Carduner
On Sat, May 31, 2008 at 5:16 AM, Tim Cook [EMAIL PROTECTED] wrote:
 In the zopeproject instructions for adding dependencies the indication
 is that (once the egg is installed) I would just have to add it to the
 configure.zcml

 But ...
  !-- Add your own component registrations here --
include package=z3c.formdemo /

 yields this configuration error:

ZopeXMLConfigurationError: File
 /home/tim/buildout-eggs/z3c.formdemo-1.5.1-py2.4.egg/z3c/formdemo/configure.zcml,
  line 11.2-11.29
ZopeXMLConfigurationError: File
 /home/tim/buildout-eggs/z3c.formdemo-1.5.1-py2.4.egg/z3c/formdemo/skin/configure.zcml,
  line 22.2
ConfigurationError: ('Unknown directive',
 u'http://namespaces.zope.org/browser', u'zrt-resource')


 I looks like zrt-resource and everything else that z3c.formdemo needs is
 defined in application.zcml but is not it isn't registered in
 z3c.formdemo/configure.zcml So now I added it to my
 zopeproject/configure.zcml

  !-- Add your own component registrations here --
include package=z3c.formdemo file=application.zcml/
include package=z3c.formdemo /

File
 /home/tim/buildout-eggs/z3c.formdemo-1.5.1-py2.4.egg/z3c/formdemo/application.zcml,
  line 23.2-23.47
browser:menu id=zmi_views title=Views /
File
 /home/tim/buildout-eggs/zope.app.zcmlfiles-3.4.3-py2.4.egg/zope/app/zcmlfiles/menus.zcml,
  line 5.2-9.8
menu
id=zmi_views
title=Views
description=Menu for displaying alternate representations
 of an object
/


 So by now I am certain that there is something very fundamental about
 this third-party registration process that I don't understand.

 Any help is appreciated.

Unfortunately, adding 3rd party packages is still somewhat
non-trivial.  The problem is that although the setup.py files do
properly reference all dependencies for a given package, the
configure.zcml files for those packages typically do not include their
zcml dependencies.  I consider this a bug and would really like to fix
it at some point.  In the mean time though, if you want to play with
z3c.formdemo, you should just set it up as a stand alone application
rather than adding it to another package as a dependency.  See the
pypi page for instructions on how to do this:
http://pypi.python.org/pypi/z3c.formdemo/.  Since it's only five
lines, I'll just paste it into this email:

$ svn co svn://svn.zope.org/repos/main/z3c.formdemo/trunk formdemo
$ cd formdemo
$ python bootstrap.py
$ ./bin/buildout
$ ./bin/demo fg

Hope that helps!

-- 
Paul Carduner
http://www.carduner.net
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Fwd: Validation of viewlets in forms?

2008-05-30 Thread Paul Carduner
On Wed, May 28, 2008 at 12:34 PM, Paul Winkler [EMAIL PROTECTED] wrote:
 (whoops, i accidentally sent this to zope3-dev; re-sending.)

 I'm wondering what's a nice way to deal with (server-side) validation
 of a form composed of multiple viewlets.
 I don't think I really want to move to a full-featured forms framework
 yet, they all seem a little overly complex to me.

 In the viewlet code, the obvious thing to do would be to raise an
 exception in its update() method if there's a problem, otherwise save
 the data or whatever.
 This is what Philip does in his worldcookery viewlet examples.

 But this means you only ever see the first error. In order to show the
 user *all* the validation errors at once, something (the viewlet
 manager?) would have to catch those exceptions.
 And having done that, we would need to explicitly abort the
 transaction. I'm not sure the best place to do that.

 I could just poke around until I get something working, but I was
 hoping somebody here would already have a nice example I can look at.
 Should I just get used to the idea of using z3c.form or some such?

I would just get used to the idea of using z3c.form.  It will be
especially helpful to look at z3c.formdemo, which has examples that I
think are highly relevant to your usecase.  You'll end up writing a
less code that does more.

-- 
Paul Carduner
http://www.carduner.net
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] bsquare'ing

2008-04-03 Thread Paul Carduner
I think the problem you are having is that buildout Is not installed  
on your system. I'm not sure what the buildout bootstrap command does  
but I imagine it is a replacement for the bootstrap.py script.  
Personally, I think bootstrap.py should be used when it is available.


I like your suggested changes and I'd like to add some more. It would  
be really cool if bsquare could see that buildout.cfg is using  
develop packages and somehow how check the develop packages out  
automatically. It would also be nice to parse the dependencies of a  
package and rebuild it whenever a dependency is rebuilt. Finally my  
last wish is that bsquare can be used without installing buildbot or  
twisted on the system. That would mean depending on buildbot and  
zope.app.twisted and adding console script entry points for the  
relevant command line scripts they provide. I've been meaning to make  
some of these changes in pcardune-setup branch but haven't had a lot  
of time.


- Paul

On Apr 3, 2008, at 3:39 AM, Adam GROSZER [EMAIL PROTECTED] wrote:


Hello,

I'm trying to setup a buildbot here for our buildout based packages.

What I don't get is, how that works:
   f.addStep(Compile(name='bootstrap',
   command='buildout bootstrap .',
   description=['bootstrapping'],
   descriptionDone=['bootstrap']))

We used to issue python2.4 bootstrap.py,
buildout bootstrap . gives an error, unless I'm missing something.

Also, I'd propose some enhancements too:

-def configure(svn_url, http_port=8010, allowForce=False):
+def configure(svn_url, svnuser=None, svnpasswd=None,  
http_port=8010,allowForce=False, poller=None):

   Creates a buildout master configuration.

   The configuration returned is almost functional. You just need to  
add

   slaves.

   
   c = {}
   c['slavePortnum'] = 8989
-c['change_source'] = SVNPoller(svn_url, split_file=split_file,  
pollinterval=30)

+if poller:
+ c['change_source'] = poller
+else:
+ c['change_source'] = SVNPoller(svn_url, svnuser=svnsuer,  
svnpasswd=svnpasswd, split_file=split_file, pollinterval=30)


Christian, opinions? Where to make those changes?


--
Best regards,
Adam GROSZER  mailto:[EMAIL PROTECTED]
--
Quote of the day:
Life is 10% of what happens to you and 90% of how you respond to it.

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

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


Re: [Zope3-Users] login/logout with z3c.pagelet?

2008-02-11 Thread Paul Carduner
Hi Christophe,

I looked at some of my projects using z3c.pagelet and found that it
had taken a fair amount of work to get the login/logout views setup
with pagelets.  I think it would be great if someone could contribute
a package that makes setting this up easier.  Any volunteers?

- Paul

On Feb 11, 2008 8:20 AM, Christophe Combelles [EMAIL PROTECTED] wrote:
 Christophe Combelles a écrit :
  Hi,
 
  Are there any login/logout/redirect templates for z3c.pagelet?
 
  I could reuse the templates from zope.app.authentication, but they
  obviously contain some macros that need some registrations I don't have,
  such as @@standard_macros. And my layout template does not contain any
  macro.
  Maybe there is some package with a layer that does this job?
  How are you doing?

 Actually I haven't seen any other solution than registering standard_macros 
 and
 some views of zope.app.security and zope.app.authentication in my layer
 (login.html, logout.html, loginForm.html, @@login_logout), and adding the 
 'page'
 macro and the 'headers' and body slots in my pagelet based layout template.

 It finally works, and it avoids some copy-pasting of these templates in my
 project, but I wondered whether a full pagelet solution existed?

 Christophe


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

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

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


[Zope3-Users] z3c.formjs-0.2 and z3c.formjsdemo-0.2 released!

2007-07-18 Thread Paul Carduner

The 0.2 versions of z3c.formjs and z3c.formjsdemo have just been released!
(for the blog version of this mail, see
http://beta.carduner.net/wordpress/?p=20)

For those who have not been following the development, z3c.formjs is a
package that extends z3c.form (written by Stephan Richter and Roger
Ineichen), adding JavaScript and AJAX functionality. More
specifically, it allows you to control JavaScript and AJAX from within
a presentation component like a form based view class. Alternatively
ala Stephan Richter,

   This package is designed to provide a Python API to common
Javascript features
   for forms written with the z3c.form* packages. While the reference
   backend-implementation is for the JQuery library, any other
Javascript library can
   be hooked into the Python API.

Here's what's new in the 0.2 release, taken straight from CHANGES.txt:

z3c.formjs
-
Version 0.2.0 (7/18/2007)

   * Feature: Registration of public AJAX server calls via a simple
 decorator. The calls are made available via a special ajax view on the
 original view.
   * Feature: Allow registering of JS subscriptions via a decorator within the
 presentation component.
   * Feature: Added a new CSS selector.
   * Feature: Implementation of AJAX-driven widget value validation.
   * Restructure: Completely overhauled the entire API to be most
easy to use and
 have the most minimal implementation.
   * Bug: The package is now 100% tested.
   * Feature: Implementation of AJAX request handlers in forms.

z3c.formjsdemo

Version 0.2.0 (7/18/2007)

   * Feature: The new chatroom demo implements a simple chat client
in HTML and Javascript using the z3c.formjs package.
   * Feature: Validation demo showing off on the fly ajax field validation.
   * Restructure: Code updated to keep up with the changes in the API
of z3c.formjs.

Installation Instructions
--
To checkout the demo, perform the following commands:

svn co svn://svn.zope.org/repos/main/z3c.formjsdemo/tags/0.2.0 z3c.formjsdemo
cd z3c.formjsdemo
python2.4 bootstrap.py
./bin/buildout -Nv
./bin/demo fg

The demo will then be available at http://localhost:8080.
Alternatively, checkout the live demo at
http://demo.carduner.net:8080/ (please no slashdot posts)

Cheese Shop
-
Both of these packages are available on the Python Cheese Shop at

   * http://cheeseshop.python.org/pypi/z3c.formjs/0.2.0
 and
   * http://cheeseshop.python.org/pypi/z3c.formjsdemo/0.2.0

Want to help?
--
This is by no means a one (or two (or three ( … ) ) ) (wo)man project
and I am very interested in what kinds of use cases other people have
and would like to see implemented or demonstrated. I am also very
interested in having other people join the fun and hack on some code.
z3c.formjs is in theory JavaScript library agnostic, and I would love
for that theory to be tested with a MochiKit rendering plugin or any
other type of rendering plugin. So, please if you are interested,
contact me at paulcarduner at gmail dot com or just make lots of noise
on zope3-users, zope3-dev, or #zope3-dev and we can discuss further
goals and tasks.
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users