[Zope3-Users] Re: AJAX (was Uploading files)

2006-06-01 Thread Balazs Ree
On Thu, 01 Jun 2006 15:36:59 +0200, Marco Mariani wrote:

> Stephan Richter wrote:
> 
>>> Just curious... what is it about AJAX that you hate? The
>>> implementation? The concept? Something else?
>> 
>> About everything. JS has no good development tools, it is impossible to
>> do decent debugging and testing. (No, I do not consider the
>> browser-based debugger and Selenium acceptable development
>> environments.)
> 
> Please take into account that the next Gecko release (Firefox 3.0) will
> have agnostic DOM support, with python and friends. And for some markets,
> having one supported browser is enough.

I am sad to say but I am with Stephan on this issue. And I have also seen
projects (from a safe distance) where one supported browser was enough,
but it was IE.

Otherwise when I do javascript development I almost feel to be back in the
old days when I programmed in assembly on my ZX-Spectrum. I liked it, at
that time.

> But I guess future zope releases/modules won't make it any more
> difficult to have "exotic" front-ends, be it ajax, xul,
> the-ms-alternative-to-xul or xforms. Somebody would just write a formlib
> look-a-like.

We will certainly continue developing javascript and AJAX solutions
nevertheless all the problems, and it is also true that the largest effort
is to cut down development costs caused by the deficiencies of javascript
and browser incompatibilities. 

-- 
Balazs Ree


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


[Zope3-Users] Re: multivalued fields and sources

2006-06-01 Thread Sam Stainsby
On Thu, 01 Jun 2006 16:05:53 -0400, Stephan Richter wrote:

> I think providing widgets for missing source fields would be fantastic.

I've already done this - see changes in Zope 3.3. Now I'm trying to get
AJAXish things happening with widgets ... with some success!

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


Re: [Zope3-Users] How to prevent several notifications of events ?

2006-06-01 Thread Thierry FLORAC




On Thu, 2006-06-01 at 12:27 +0200, Florent Guillaume wrote:


Thierry FLORAC wrote:
> I've build a simple adapter that modifies context properties through
> annotations ; everything works fine.
> In several cases, when some attributes are updated, I do a
> "notify(ObjectModifiedEvent(self.context))" so that several subscribers
> are called.
> 
> My problem is then that if several attributes modifications are done,
> several "ObjectModifiedEvent" are sent and the same handler is called
> several times (with the same parameters) ; so is it easily possible to
> prevent the same event to be called several times for a same context and
> a same request ?
> Or should I try to use request annotations and subscribe to
> IEndRequestEvent (if it's not too late and not too expensive...) ?

Yes that's the proper way to do compress events: record the stuff to do, and 
do it at the end of the request.

Depending on the stuff to do, it may involve subtleties, for instance if you 
modify one object then delete it in the same request, you don't want to call 
your final handler for that object...



Thanks for the reply, but I'd like to have a few complements :
 - I suppose that IEndRequestEvent is sent automatically for every request, so even for consultation requests which doesn't imply any modification. So I suppose that the IEndRequestEvent handler have to be VERY optimised if I don't want it to be too expensive.
 - what is the best way to keep track of objects having been modified (and which, for example, should be re-indexed) into request annotations. Can I just put an object into an annotation's list (with a kind of "IAnnotations(request)['myKey'].append(context)") ??

Thanks,
Thierry


-- 
This message has been scanned for viruses and
dangerous content by
MailScanner, and is
believed to be clean.

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


Re: [Zope3-Users] request.principal and render/update

2006-06-01 Thread Pete Taylor

no problem anymore, that was a while back.  it's been working
correctly for quite some time.  if you check the later posts, I did
exactly what you suggest, and use session credentials.  it then had an
issue where it assumed that the form always called the fields "login"
and "password" so I overrode that behavior myself.  then
AuthenticatedPrincipalFactory doesn't actually adapt a principal back
to the type of principal you originally sent in, but instead sends you
back an IPrincipal, rather than derived version.  so I built my own
Authenticated factory as well, to get back a principal with my own,
extra attributes.

as far as the "login/password" fields issue, I'm pretty sure Florian
submitted a fix for that back to svn a while back as well.

Thanks for the answer though!

On 6/1/06, Stephan Richter <[EMAIL PROTECTED]> wrote:

On Wednesday 12 April 2006 12:54, Pete Taylor wrote:
> i have built a credentials plugin and an authenticator plugin, and set
> them up in my PAU. i built the credentials plugin such that if no
> credentials a recieved in the request, it checks the cookies for the
> expected credentials, and if they're there, builds the necessary
> credentials dict out of that instead, and returns that back for the
> authenticator plugin to use.

Aehm, this is exactly what the SessionCredentials do.

> the login logic then, assuming a principal is infact returned from
> pau.authenticate(self.request) (either because the cookies have the
> credentials or the request did), returns back
> self.request.setPrincipal(principal) and sets the cookies for the next
> use (in the case that the credentials were found in the request, but
> hadn't been set yet).
>
> my login form's action looks like this:
>
> @form.action('Login')
> def handle_login_action(self, action, data):
> lsm = component.getSiteManager(context=self.context)
> pau = component.getUtility(IAuthentication, context=lsm)
> principal = pau.authenticate(self.request)
> if principal is not None:
> self.setCookies()
> #i've both used this and not used this...
> #doesn't seem to affect anything one way or the other
> self.request.setPrincipal(principal)

Why are you doing this by hand? The authentication service should do all of
this for you.

> as a bit of extra background, i have a viewlet that needs to be aware
> of request.principal. in tales, i did a bit of tracking of "where and
> when" the current self.request was aware of request.principal. the
> primary page view found request/principal/id every time. the viewlet
> could find request/principal/id in tales, but not in the viewlet class
> (a form.Form), even though self.request is super'd up through. i
> attempted, in the viewlet, to look at
> "self.__parent__.request.principal" since i set __parent__ to the view
> that comes in on __init__, and i know that view can see
> request.principal, since it shows up in tales every time.
>
> still no luck, it always throws AttributeError on request.principal.

All this will work, if you use PAU correctly.

I strongly suggest setting up a simple PAU, all with standard components. It
is really not that hard and work beautifully.

Regards,
Stephan
--
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training




--
"All guilt is relative, loyalty counts, and never let your conscience
be your guide."
 - Lucas Buck, American Gothic
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Re: IObjectModifiedEvent

2006-06-01 Thread Marco Mariani
Philipp von Weitershausen wrote:

> >   >>> from zope.lifecycleevent.interfaces import ObjectModifiedEvent
> >   >>> from zope.event import notify
> >   >>> notify(ObjectModifiedEvent(myobj))

I see, thanks. I missed the notify() because I override
handle_edit_action() without calling super(), and I looked at the
content interfaces for the trouble, not at the forms.

> > This is, btw, exactly what the container machinery is doing when you
> > add
> > a child to a container. It's also what the form machinery does when
> > it
> > changes an object as the result of an automated add or edit form.

This brings the question: is it the form's responsibility, or the
container's? Why is a container any different than other content
objects?
There has to be a simple reason the parent is not notified inside
AddFormBase.add(), and I try to state it.. "within a container
interface, we can always know when it's modified. With other objects, we
cannot unless we wrap each and every exposed attribute."

It sounds right, now..  :-) 

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


Re: [Zope3-Users] i18n questions

2006-06-01 Thread Lennart Regebro

On 6/1/06, Stephan Richter <[EMAIL PROTECTED]> wrote:

Yes, the PO file format is totally independent of Zope and Python.


However, the directory structure is not independent of which i18n
implementation you have. ;) Five and Zope3 uses the same one, though:
  /LC_MESSAGES/.mo

I think Plone uses:
  /LC_MESSAGES/.po

Notice the difference, Zope3/Five requires you to compile to po files,
Plone doesn't.
CPS uses another one completely.


On Wednesday 31 May 2006 04:29, Chris Withers wrote:
> - How would I mark up constant and computers strings in zodb-based
> Python Scripts?


Mark up?


> - How do I generate .pot files from ZPTs, Python Scipts and External
> Methods? I used to use PTS' .missing functionality and just spider the
> whole app. Is something similar available in Zope 2.9/3 land?

In Zope 3 you can simply call utilities/i18nextract.py; it will extract all
message strings from Python, ZPT and ZCML files.


Last time I tried this didn't work under Five. I haven't tried Since
2.8, though.
--
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Couple of Zope 3 screencasts, input solicited

2006-06-01 Thread Stephan Richter
On Monday 15 May 2006 15:36, Paul Everitt wrote:
> Hi all.  I did a couple of screencasts for Zope 3:
>
>    http://zeapartners.org/scl/2006/04/25/z3-install/index.html
>    http://zeapartners.org/scl/2006/04/25/z3-helloworld/index.html
>
> The first one is primarily a way for me to remember how to get stuff
> running on Windows. :^)

Hey Paul, I meant to respond for a while to this mail. I really love the 
screencasts. They truly capture the simplest case possible!

> On the second, I worked with Joel Moxley through a couple of iterations
> of refinement.  I was trying to get as quickly as possible to pixels on
> the screen, not showing the "clean" way but showing the fast way,
> requiring as few new ideas as possible.  Kind of the "see, it's not so
> scary" screencast.

Right, I think you totally succeeded!

> The plan is to do a 3rd one, actually showing something cool about Zope 3.
>
> I'd like to stick to the philosophy of short walkthroughs, not too many
> new concepts at once, little chance that the viewers can screw up doing
> it themselves, etc.  "Dive into Python" is pretty good about this...for
> example, classes don't appear until chapter five.
>
> However, I'd like the next step to get closer to the real differentiator
> of Zope 3 vs. other frameworks.
>
> Any suggestions for a storyboard?

I think I would do a view class next that shows how you can prepare data for 
output in a page template. For example, show all contents of a container + 
some meta data (maybe). To spice things up, you could use zc.table here to 
create a formatted table, which is cool too.

From there you can dive into formlib, which is really a Zope 3 power package.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] zope 3 book messageboard example..

2006-06-01 Thread Stephan Richter
On Thursday 30 March 2006 13:16, Alec Flett wrote:
> So everything looks right to me - I wish I could offer more! I consider
> myself a reasonably skilled Python developer but this is my first foray
> into Zope

The code looks okay. Unfortunately, the messageboard code was written for Zope 
3.0 and some things just might not work anymore. I cannot make much of the 
traceback either. Sorry.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: directlyProvides and formlib

2006-06-01 Thread Stephan Richter
On Thursday 01 June 2006 16:32, luis wrote:
> well... there was a follow-up on this thread...
> it seems like (if the object doesnt provide ILocation), the marker
> interfaces are not attached to the object itself, but to a ContainedProxy
> object which wraps the real object, and that makes problems with the
> introspector... for all the details see my post from 2006-05-29, the
> relevant parts are:

Oh, good digging. So proxies hide directly provided interfaces. Interesting. 
Mmh, only LocationProxies hide directly provided interfaces. It certainly 
works for security proxies.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] ILoginPassword anyone?

2006-06-01 Thread Stephan Richter
On Tuesday 28 March 2006 20:55, David Johnson wrote:
> Does anyone have an ILoginPassword/BasicAuthAdapter implementation?  I
> posted earlier, but no-one responded. I am stumped on this one.
>
> I implemented the example from Phillip's book with no success.  Various
> attempts to correct the apparent problems just produce more errors, so I
> figure it is outdated.

The code in the books covers the old zope.app.pluggableauth package. The newer 
zope.app.authentication package works differently, but allows you to 
implement only small parts of the authentication system. The *.txt files in 
that package are pretty good.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Re: directlyProvides and formlib

2006-06-01 Thread luis

Hi,

Stephan Richter wrote:
 
> The code looks good. Are you really sure IMarker is not provided? Maybe
> another piece of code calls directlyProvides(), which would override this
> call. You should pretty much always use alsoProvides, since it does not
> delete the existing directly provided interfaces.
> 

well... there was a follow-up on this thread...
it seems like (if the object doesnt provide ILocation), the marker
interfaces are not attached to the object itself, but to a ContainedProxy
object which wraps the real object, and that makes problems with the
introspector... for all the details see my post from 2006-05-29, the
relevant parts are:

- luis wrote:

well... I'm not sure but it seems not to be a bug in ContainedProxy, but
just a "display bug" in the  @@introspector.html...
[...]
so, the IMarker is provided by the file, but in a "different" way.. so I
think the introspector is just not showing it correctly...
if I add a File w/ ILocation, it doesnt go into the ContainedProxy and the
introspector shows the directlyProvided intefaces correctly...
-

regards.
luis


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


Re: [Zope3-Users] formlib validator

2006-06-01 Thread Stephan Richter
On Sunday 23 April 2006 11:27, David Johnson wrote:
> I'm using formlib and trying to implement a validator on a new-use sign up
> form. It seems to work unless I provide my own widget errors.  Below is my
> validator. The code is being executed (I can see my debug code).  Any
> ideas? What am I not understanding?  The form simply returns with no
> validation errors at all.

Try to follow the code path and see what happens with the error list after the 
checkFields() call. Roger also recently provided a bug fix that allows you to 
use invariants on interfaces. That might work for you as well.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Generating loginForm with formlib

2006-06-01 Thread Stephan Richter
On Thursday 20 April 2006 09:38, Florian Lindner wrote:
> but formlib generates the two fields with name="form.login" therefore the
> session credentials plugin is able to extract the credentials.
>
> How can I use formlib to generate a login form?

I think we used a custom written form. ;-) But you need to find a way to turn 
off the widget prefix. It is probably a matter of overriding the 
"setUpWidgets()" method.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] A Question about the "Hostname" in the Zope3 Server

2006-06-01 Thread Stephan Richter
On Tuesday 09 May 2006 09:33, Helman R. Valencia B. wrote:
> When I Start a Zope 2.7.5, the Hostname is the same of my computer, and
> when I Start a Zope 3.2.0 the Hostname is "localhost" (reserved word). Is
> possible to change that name in Zope 3.2.0? because in the Intranet I can't
> access the Zope server from other computers using Zope 3.2.0.

The message you are seeing at the beginning is for your information only. The 
hostname is still the same for all network services. All of the following 
will work: IP address, hostname, localhost, 127.0.0.1. The latter two are the 
callback loop interfaces that will always allow you to access your local 
machine.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Zope, WebDAV, MS Word

2006-06-01 Thread Stephan Richter
On Monday 08 May 2006 04:36, Achim Domma wrote:
> Is there still a problem with Zope 3, WebDAV and Windows? Any hint how
> to edit objects via Microsoft Word or OpenOffice Writer?

Zope 3 and Zope 2's implementation of WebDAV are somewhat different. Recently 
Michael Kerrin has worked on WebDAV, so you might want to contact him and 
poke him a bit about finishing his great work! :-)

So no, I do not know how to make it work.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Static vocabulary

2006-06-01 Thread Stephan Richter
On Sunday 30 April 2006 13:52, Florian Lindner wrote:
> I want to define an vocabulary schema field with a fixed sets of values.
> How can I do that? How can I define it directly in ZCML?

I would not define such thing in ZCML, use Python instead:

from zope.schema import vocabulary

vocab = vocabulary.SimpleVocabulary(
vocabulary.SimpleTerm('de', title='German'),
vocabulary.SimpleTerm('en', title='English'),
...
)

Alternatively you could create a vocabulary from a CSV file. Here is some code 
I wrote recently:

import csv, os
from zope.schema import vocabulary

def CSVVocabulary(filename):
# Create a prefix
prefix = os.path.split(filename)[-1][:-4]
# Open a file and read the data
f = file(filename)
reader = csv.reader(f, delimiter=";")
# Create the terms and the vocabulary
terms = []
for id, title in reader:
title = unicode(title, 'latin1')
term = vocabulary.SimpleTerm(id, title=_(prefix+'-'+id,default=title))
terms.append(term)
return vocabulary.SimpleVocabulary(terms)

Oh, and if you want to extract those titles for translation, you can use this: 

def csv_strings():
"""Extract message strings from CSV data files"""
catalog = {}
datadir = os.path.join(os.path.dirname(__file__), 'data')
for filename in os.listdir(datadir):
if filename.endswith('.csv'):
fullpath = os.path.join(datadir, filename)
vocab = CSVVocabulary(fullpath)
for index, term in enumerate(vocab):
if term.title not in catalog:
catalog[term.title] = []
catalog[term.title].append((fullpath, index+1))
return catalog

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Access subfolder's files object's metadata thru tal macros

2006-06-01 Thread Stephan Richter
On Tuesday 25 April 2006 01:19, Nicolas Legault wrote:
> 
>   file:filename 
>   desc:description 
> 
>
> Is there someone who can tell me the correct way to do this ?

When you iterate over a dictionary/mapping such as a folder, you iterate over 
its keys, not its values. Thus, item is just a string, which clearly does not 
have a description. You could alternatively iterate over "folder/values".

Having said that, I would strongly you to use view classes instead of TTW 
development, which is not supported at this point.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] getUtility outside of the zope.app

2006-06-01 Thread David Pratt

Hi Stephan. For sure! Thanks for your reply.

Regards,
David


Stephan Richter wrote:

On Friday 26 May 2006 09:11, David Pratt wrote:

Hi. For the use of interfaces outside of zope.app, does getUtility have
any value? Many thanks.


getUtility is provided by zope.component. If you use zope.interface and 
zope.component in another project, you surely can make use of it. Read the 
*.txt files in zope.component. They are very illuminating.


Regards,
Stephan

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


Re: [Zope3-Users] Re: Render ZPT template to send rich-text HTML mail

2006-06-01 Thread Alek Kowalczyk




Philipp von Weitershausen wrote:

  [EMAIL PROTECTED] wrote:
  
  
Hi, I need to send some rich-text (HTML) mail, containing information
based on many objects. It would be nice to render it using ZPT
provided by Zope instead of manual creation of HTML text.

Can I (ab)use ZPT for such purpose? I need to design ZPT template and
write corresponding View object. How to wire together the ZPT
template and corresponding View object to render a HTML message and
send it using mail utility?

  
  
Let's say that the 'mail.html' view provides the HTML for the email body
(whether that's ZPT, Python, or whatever doesn't matter), then you can
simply do:

  >>> from zope.component import getMultiAdapter
  >>> view = getMultiAdapter((obj, request), name="@@mail.html")
  >>> html_email_body = view()
  

Wow, ingenious in its simplicity! This is what I wanted :)  

  
Could you suggest some points to start with?

  
  Buy my book?

Philipp
  

If you present such tricks there - then it's worth to be bought...

Best Regards!
Alek.


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


Re: [Zope3-Users] directlyProvides and formlib

2006-06-01 Thread Stephan Richter
On Sunday 23 April 2006 19:42, luis wrote:
> I'm having problems getting interface.directlyProvides to work...
>
> does anyone know why the following code doesn't work (file is created, but
> it doesnt provide the IMarker interface...)

The code looks good. Are you really sure IMarker is not provided? Maybe 
another piece of code calls directlyProvides(), which would override this 
call. You should pretty much always use alsoProvides, since it does not 
delete the existing directly provided interfaces.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] callback errors?

2006-06-01 Thread Stephan Richter
On Thursday 20 April 2006 14:12, Joseph Turian wrote:
> [Posting this to twisted and zope3 user, since I'm not sure which is
> more germane]
>
> I just install zope 3.2.0 on Gentoo.
> I then manually configured a zope instance in /var/lib/zope/zope-3.2.0/
> When I access the zope server at 192.168.0.100:8080, I get the
> following error messages on my terminal:
>
> What do these mean?
> How can I resolve them?

I just wanted to write to let you know that I have no idea what the problem 
might be. Nobody has reported such an error.

The only thing that I could think of is that Your installation picks up a 
twisted installation that is not compatible with Zope 3.2.0. Note that Zope 3 
provides its own version of Twisted.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Overriding zope.conf in zope.app.twisted.main

2006-06-01 Thread David Pratt

Stephan Richter wrote:

On Friday 21 April 2006 13:11, David Pratt wrote:

I hoping to feed the configuration data as dictionary or similar instead
of providing a config option and file path. Many thanks.


I think the startup machinery depends on the options object. You basically 
would have to write code that creates the Options object in Python. It is a 
bunch of work (probably), but definitely possible.


Regards,
Stephan


Hi Stephan. Thanks for your reply. I had managed to do what I wanted 
after studying zconfig. Many thanks.


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


Re: [Zope3-Users] Object Widgets

2006-06-01 Thread Stephan Richter
On Tuesday 18 April 2006 10:44, Marco Mariani wrote:
> Should I set form_fields['photo'].custom_widget ? To what?

You have several choices, though this is a good one. I am not sure that there 
is an ImageWidget, but I think there is a file one. In one of my latest 
projects, we wrote some custom code, but we really should have something 
built in.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] multivalued fields and sources

2006-06-01 Thread Stephan Richter
On Saturday 15 April 2006 23:36, Sam Stainsby wrote:
> From looking the Zope 3 code, I suspect that the full set of widgets is
> not yet available for sources?

That's correct. You are very brave using sources. I still have not understood 
them. I happily use vocabularies, still. ;-)

> Or have I got that wrong?

I cannot tell, since I am not using sources.

> I see there are  
> some simpler widgets there that build the widgets used by vocabularies.
> I'm happy to try my hand at adding to that set of widget if noone else is
> doing it. Maybe this is being done a different way for sources?

I think providing widgets for missing source fields would be fantastic.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Understanding authentication

2006-06-01 Thread Stephan Richter
On Saturday 15 April 2006 15:28, Achim Domma wrote:
> Is there a simple example on how to setup a sub-site with a PAU and to
> allow login to a principal from this PAU.

I think the major problem here is that you user is not allowed to traverse 
from "main" to "demo1". Give the user at least enough permissions (maybe 
start with granting all permissions to see whether it works) to do the 
traversal.

It sounds like everything else is set up correctly.

Regards,
Stephan 
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] request.principal and render/update

2006-06-01 Thread Stephan Richter
On Wednesday 12 April 2006 12:54, Pete Taylor wrote:
> i have built a credentials plugin and an authenticator plugin, and set
> them up in my PAU.  i built the credentials plugin such that if no
> credentials a recieved in the request, it checks the cookies for the
> expected credentials, and if they're there, builds the necessary
> credentials dict out of that instead, and returns that back for the
> authenticator plugin to use.

Aehm, this is exactly what the SessionCredentials do.

> the login logic then, assuming a principal is infact returned from
> pau.authenticate(self.request) (either because the cookies have the
> credentials or the request did), returns back
> self.request.setPrincipal(principal) and sets the cookies for the next
> use (in the case that the credentials were found in the request, but
> hadn't been set yet).
>
> my login form's action looks like this:
>
>     @form.action('Login')
>     def handle_login_action(self, action, data):
>         lsm = component.getSiteManager(context=self.context)
>         pau = component.getUtility(IAuthentication, context=lsm)
>         principal = pau.authenticate(self.request)
>         if principal is not None:
>             self.setCookies()
>             #i've both used this and not used this...
>             #doesn't seem to affect anything one way or the other
>             self.request.setPrincipal(principal)

Why are you doing this by hand? The authentication service should do all of 
this for you.

> as a bit of extra background, i have a viewlet that needs to be aware
> of request.principal.  in tales, i did a bit of tracking of "where and
> when" the current self.request was aware of request.principal.  the
> primary page view found request/principal/id every time.  the viewlet
> could find request/principal/id in tales, but not in the viewlet class
> (a form.Form), even though self.request is super'd up through.  i
> attempted, in the viewlet, to look at
> "self.__parent__.request.principal" since i set __parent__ to the view
> that comes in on __init__, and i know that view can see
> request.principal, since it shows up in tales every time.
>
> still no luck, it always throws AttributeError on request.principal.

All this will work, if you use PAU correctly.

I strongly suggest setting up a simple PAU, all with standard components. It 
is really not that hard and work beautifully.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Blobs and filestream iterator

2006-06-01 Thread Stephan Richter
On Wednesday 12 April 2006 12:27, David Pratt wrote:
> Hi. I had written a repository product in zope2 for blobs. I am looking
> at bringing this into Z3 at the moment and looking for equivalent for
> stream iterator of zpublisher.

In Zope 3 you can now return IResult objects. The publisher then knows how to 
handle those objects. Check out zope.publisher (I think).

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Best structure for a large schema

2006-06-01 Thread Stephan Richter
On Wednesday 12 April 2006 11:44, David Pratt wrote:
> In any case. Thought I'd ask since I am concerned about the efficiency
> of storage and speed of access both. If rdf access was fast then it
> would be great but this had not been the case. I just thought there may
> be some other ideas on this or someone could advise on the efficiency of
> ZODB when in some cases, uses will be selective about which attributes
> are important to them.

I think the storage is just fine. And for querying you can use catalogs, so 
you do not have to wake up all objects. BTW, I love Zope 3's catalog, index 
and the hurry.query packages!

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Overriding zope.conf in zope.app.twisted.main

2006-06-01 Thread Stephan Richter
On Friday 21 April 2006 13:11, David Pratt wrote:
> I hoping to feed the configuration data as dictionary or similar instead
> of providing a config option and file path. Many thanks.

I think the startup machinery depends on the options object. You basically 
would have to write code that creates the Options object in Python. It is a 
bunch of work (probably), but definitely possible.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] formlib problem

2006-06-01 Thread Stephan Richter
On Friday 14 April 2006 11:00, Stéphane Brault wrote:
>  I'm trying to use formlib but I get a problem :
>  Traceback (most recent call last):
>    File "", line 1, in -toplevel-
>      print MyForm(None, request)()
>    File "", line 6, in __call__
>      widgets = form.setUpWidgets(self.form_fields, 'form', self.context,
> self.request, ignore_request=ignore_request) File
> "C:\Python24\Lib\site-packages\zope\formlib\form.py", line 255, in
> setUpWidgets IInputWidget)
>    File "C:\Python24\Lib\site-packages\zope\component\__init__.py", line
> 154, in getMultiAdapter raise ComponentLookupError(objects, interface,
> name)
>  ComponentLookupError: ((, http://127.0.0.1>), , u'')
>  
>  This problem occurs with my objects (which are sqlos objects) but also
> when I try the examples of the form.txt. I must be doing something wrong,
> but I can't figure it out, especially since I follow the examples. Any hint
> ?

Without more context, this traceback is not very helpful. Did you copy this 
traceback from the Web site, because the important info in the error message 
is missing?

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Found a (perhaps obvious) page template speedup

2006-06-01 Thread Stephan Richter
On Sunday 16 April 2006 15:17, Jeff Rush wrote:
> Perhaps most of you already know this but it bit me this week.  For my
> project I've noticed some sluggish presentation of pages, and a lot of
> container queries flying around for very simple pages.  It turns out to be
> Javascript code (singleBranchTree.xml) that is walking one-level of
> parents, siblings and children for each of my pages, even though I don't
> have a nav tree widget in my skin.
>
> I thought I was doing things the preferred way, by using the existing
> @@standard_macros/page and filling in slots to change out selected
> portions. It turns out that while there is a slot to disable the -display-
> of the nav tree, there isn't one for the page header to disable the
> -computation- of the nav tree, which is triggered from within the browser
> via navigation_tree.js upon the body load event.

I would always write a skin from scratch. Roger Ineichen has developed a set 
of minimal registrations (like error pages, etc) for a new skin. He should 
probably release that code, if he has not already.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] ftest: No registered publisher found for (GET/)

2006-06-01 Thread Stephan Richter
On Sunday 16 April 2006 10:57, Egon Frerich wrote:
> >     ConfigurationError: No registered publisher found for (GET/)
>
> Can someone tell me what is missing?

I have never encountered this problem.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] custom tuple widget

2006-06-01 Thread Stephan Richter
On Wednesday 29 March 2006 05:46, Marco Mariani wrote:
> The custom widget will then render all the tree in a javascript object
> (dictionary of dictionaries of dictionaries) which will fill and change
> the dropdown menus accordingly. As an improvement, the tree nodes can be
> retrieved by XmlHttp
>
> Before hitting my head too hard, is this doable?

Yes.

> Is it possible to avoid the bunch of javascript by having the widget
> re-submit itself at each menu selection? For instance, I select the
> state, the form resubmits and gives me the choice of cities. How can I
> tell the first two  tags to reload the page? Is it enough to
> attach an onchange event that calls submit() ?

With formlib you have great control over widget and action handling. However, 
in this case I would suggest doing the JS. It is the cleaner way too.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] security on file objects prevents accessing "read" in other methods

2006-06-01 Thread Stephan Richter
On Tuesday 28 March 2006 11:13, Joel Moxley wrote:
> What's the best way to pass around a file object with open permissions?

Either declare the file as a rock or do the following:


  


Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] ZPT traverser for finding site

2006-06-01 Thread Stephan Richter
On Tuesday 28 March 2006 09:19, Florian Lindner wrote:
> is there a ZPT traverser for finding the nearest site in Zope3?
>
> register
>
> because registrationForm is registered in my object which forms the site.

No there is not. Use the view class to look up the site using 
zope.app.component.hooks.getSite() and then generate the URL.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Question about batching

2006-06-01 Thread Stephan Richter
On Friday 24 March 2006 00:04, José Ernesto Guzmán Villeda wrote:
> Hello, I used to use the module  ZTUtils for Batching  in zope 2, but now
> we don't have that possibility in Zope3, is there any other module to work
> with batching?

So far no standard batching module has been provided. But writing your own is 
not that hard.

http://svn.zope.org/Zope3/trunk/src/bugtracker/batching/?rev=68449

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Re: Render ZPT template to send rich-text HTML mail

2006-06-01 Thread Philipp von Weitershausen
Philipp von Weitershausen wrote:
> [EMAIL PROTECTED] wrote:
>> Hi, I need to send some rich-text (HTML) mail, containing information
>> based on many objects. It would be nice to render it using ZPT
>> provided by Zope instead of manual creation of HTML text.
>>
>> Can I (ab)use ZPT for such purpose? I need to design ZPT template and
>> write corresponding View object. How to wire together the ZPT
>> template and corresponding View object to render a HTML message and
>> send it using mail utility?
> 
> Let's say that the 'mail.html' view provides the HTML for the email body
> (whether that's ZPT, Python, or whatever doesn't matter), then you can
> simply do:
> 
>   >>> from zope.component import getMultiAdapter
>   >>> view = getMultiAdapter((obj, request), name="@@mail.html")

W/o the @@ of course

>   >>> html_email_body = view()
> 
>   >>> from email.MIMEText import MIMEText
>   >>> message = MIMETExt(html_email_body.encode('utf-8'),
>   ...'text/html', 'utf-8')
>   >>> # etc.
> 
>   >>> from zope.component import getUtility
>   >>> mailer = getUtility(IMailDelivery, 'your-delivery-utility')
>   >>> mailer.send(from, to, message.as_string())
> 
>> Could you suggest some points to start with?
> 
> Buy my book?
> 
> Philipp

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


[Zope3-Users] Re: Render ZPT template to send rich-text HTML mail

2006-06-01 Thread Philipp von Weitershausen
[EMAIL PROTECTED] wrote:
> Hi, I need to send some rich-text (HTML) mail, containing information
> based on many objects. It would be nice to render it using ZPT
> provided by Zope instead of manual creation of HTML text.
> 
> Can I (ab)use ZPT for such purpose? I need to design ZPT template and
> write corresponding View object. How to wire together the ZPT
> template and corresponding View object to render a HTML message and
> send it using mail utility?

Let's say that the 'mail.html' view provides the HTML for the email body
(whether that's ZPT, Python, or whatever doesn't matter), then you can
simply do:

  >>> from zope.component import getMultiAdapter
  >>> view = getMultiAdapter((obj, request), name="@@mail.html")
  >>> html_email_body = view()

  >>> from email.MIMEText import MIMEText
  >>> message = MIMETExt(html_email_body.encode('utf-8'),
  ...'text/html', 'utf-8')
  >>> # etc.

  >>> from zope.component import getUtility
  >>> mailer = getUtility(IMailDelivery, 'your-delivery-utility')
  >>> mailer.send(from, to, message.as_string())

> Could you suggest some points to start with?

Buy my book?

Philipp

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


[Zope3-Users] Re: IObjectModifiedEvent

2006-06-01 Thread Philipp von Weitershausen
Marco Mariani wrote:
> I've never used events.
> 
> I've subscribed to modification events on my objects:
> 
>  handler=".events.modifiedObject" />
> 
> 
> 
> Unfortunately, modifiedObject() only gets called when new children are
> inserted (IMyObject provides IContainer)
> 
> I do NOT get an event for changing an attribute on a MyObject instance
> or for trying the same on other objects that do not implement IContainer.

Right, because you aren't sending the event. Zope does NOT automagically
send events when you change an attribute of an object. THis is how you
would send an IObjectModifiedEvent manually:

  >>> from zope.lifecycleevent.interfaces import ObjectModifiedEvent
  >>> from zope.event import notify
  >>> notify(ObjectModifiedEvent(myobj))

This is, btw, exactly what the container machinery is doing when you add
a child to a container. It's also what the form machinery does when it
changes an object as the result of an automated add or edit form.

Philipp

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


Re: [Zope3-Users] how work with thread with Twisted-instance?

2006-06-01 Thread Stephan Richter
On Monday 01 May 2006 17:04, Garanin Michael wrote:
> I use Zope3-trunk (with 'Twisted'-instance). I want use
> 'thread.get_ident' for identify requests (and use with 'zope.thread'),
> but 'thread.get_ident' always return one value and 'zope.thread' return
> always one result. Why? How i can do 'identify' requests?
>  With ZServer i use 'get_ident'&'zope.thread' and i not have problem.

This seems to be a deep twisted.web2.wsgi question. I do not know the answer, 
but you probably want to ask James Knight, the author of the mentioned code.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Container base classes

2006-06-01 Thread Stephan Richter
On Wednesday 26 April 2006 15:16, Jachin Rupe wrote:
> Assuming I know enough now to start working on a "real" project,  
> should I be sticking with the stuff in the "persistent" package?  Are  
> there other persistent objects hiding somewhere else in the API I  
> should be aware of?

Most developers use BTreeContainer, OrderedContainer, Folder, PersistentList 
and PersistentDict objects for this sort of thing. And yes, the order ranks 
from most often used to least often used, at least for me.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Starting thread in object deserialize

2006-06-01 Thread Stephan Richter
On Sunday 16 April 2006 13:39, Alek Kowalczyk wrote:
> I'll try to explain that a wee bit more, here is the Use Case:
>
> I have an IMonitorsContainer containing IMonitor(s).
> When a user creates new Monitor instance (using "Add Monitor" on the
> web), the created Monitor should start thread and periodically perform
> measurements (configured by the user by setting some Monitor's fields)
> in that thread - until the Monitor is deleted (by the user on the web
> interface).
> Or until Zope is eventually stopped/killed. When Zope is later started
> again, the persisted Monitors (i.e configuration of measurement threads)
> should be restored from ZODB, create and start the threads again after
> restored, and continue performing measurements.

I would use Twisted as a server and schedule tasks with the twisted loop. See 
for example:

http://svn.zope.org/Zope3/trunk/src/scheduler/

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Security in Code, example, why does this work?

2006-06-01 Thread Stephan Richter
On Sunday 09 April 2006 09:21, Reinhold Strobl wrote:
> So can code always access everything, or not?

Filesystem Python code is always trusted. Thus you have no security inside 
methods.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: ZODB - root and transaction

2006-06-01 Thread Stephan Richter
On Wednesday 05 April 2006 10:07, Reinhold Strobl wrote:
> I want in a utility class to get access with the current (!) database of
> the zope 3 application.
> In views, this is no problem, since I have the context variable, but this
> is not ture for utilities...

There are several possible solutions.

(a) Local utilities do know about the DB. zapi.getParent(utility)

(b) If you rely on the context, then your utility API should incorporate this 
in the methods, i.e. utility.method(context, ...)

(c) Use zope.app.component.hooks.getSite() you can get the current site.

I only find solution (b) desirable.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] rdb permission

2006-06-01 Thread Stephan Richter
On Friday 12 May 2006 17:59, David Johnson wrote:
> How are permissions determined in rdb connections?  I have added a rdb
> entry to my overrides.zcml problem, and it seems to picking up a
> "zope.ManageContent" security.  I'm not sure why, how, or where.  My
> anonymous users cannot access it therefore.
>
> What am I doing wrong?

Hi David,

without some more details on which access exactly fails, it is hard to provide 
any help. I remember there being permission issues though. An alternative 
would be to grant roles locally, so that anonymous uses can use the 
utilities.

The cheap way out would be to write a simple wrapper around the RDB adapter on 
which you can define your custom permissions.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Render ZPT template to send rich-text HTML mail

2006-06-01 Thread Andreas Jung



--On 1. Juni 2006 16:49:54 +0200 Andreas Jung <[EMAIL PROTECTED]> wrote:




--On 1. Juni 2006 16:32:35 +0200 [EMAIL PROTECTED] wrote:


Hi,
I need to send some rich-text (HTML) mail, containing information based
on many objects. It would be nice to render it using ZPT provided by Zope
instead of manual creation of HTML text.

Can I (ab)use ZPT for such purpose? I need to design ZPT template and
write corresponding View object.  How to wire together the ZPT template
and corresponding View object to render a HTML message and send it using
mail utility?



Look at Chris Wither's MailTemplates product.


Ups, I missed that this issue was Zope 3 related :-)

-aj



--
ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany
Web: www.zopyx.com - Email: [EMAIL PROTECTED] - Phone +49 - 7071 - 793376
E-Publishing, Python, Zope & Plone development, Consulting


pgp8Da6nilJzV.pgp
Description: PGP signature
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Render ZPT template to send rich-text HTML mail

2006-06-01 Thread Stephan Richter
On Thursday 01 June 2006 10:32, [EMAIL PROTECTED] wrote:
> Can I (ab)use ZPT for such purpose? I need to design ZPT template and write
> corresponding View object. How to wire together the ZPT template and
> corresponding View object to render a HTML message and send it using mail
> utility?
>
> Could you suggest some points to start with?

There is absolutely nothing magic about ZPT pages and the Web. We use page 
templates for all sorts of things including HTML, generic XML and RML. All 
that th e"view-version" of ZPT does is provide a request and context as top 
level namespaces. You can write your own page template class that provides 
other namespaces. You should start at looking at zope.pagetemplate.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] IObjectModifiedEvent

2006-06-01 Thread Marco Mariani
I'm using 3.3 beta 1.

I've never used events.

I've subscribed to modification events on my objects:

  



Unfortunately, modifiedObject() only gets called when new children are
inserted (IMyObject provides IContainer)

I do NOT get an event for changing an attribute on a MyObject instance
or for trying the same on other objects that do not implement IContainer.



I've also tried to set up the following catch-all handler:


  


def modifiedObject(event):
print 'MMM'
print 'Event: ', event
print 'Object: ', event.object


and upon restarting zope, I get tons of events, all of them related to
zope.app.container.contained.ContainerModifiedEvent



Some pointer?

tnx

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


Re: Re : [Zope3-Users] Uploading files

2006-06-01 Thread Tarek Ziadé
Stéphane Brault wrote:

>Thanks Stephan,
>  could you indicate me another way to upload files ?
>  
>  Stéphane
>
>- Message d'origine 
>De : Stephan Richter <[EMAIL PROTECTED]>
>À : zope3-users@zope.org; Stéphane Brault <[EMAIL PROTECTED]>
>Envoyé le : Jeudi, 1 Juin 2006, 2h53mn 32s
>Objet : Re: [Zope3-Users] Uploading files
>
>On Tuesday 30 May 2006 09:30, Stéphane Brault wrote:
>  
>
>> for my application I mainly use sqlos and jsonserver, which means that I
>>don't use much standard Zope components, I need to let users upload a file
>>which I parse to update the database. I don't see how to upload files with
>>AJAX. Is there a way or should I go another way. I must say I don't know
>>how to do it the standard way.
>>
>>
>
>While I hate AJAX with a passion, you could certainly do this. If JS has a way 
>to access a local file once it has been selected, then you can use the 
>XmlHttpRequest class to PUT the file on the server, for example. I certainly 
>would not use JSON for this task.
>
>Regards,
>Stephan
>  
>
You cannot upload file directly in javascript, because it can't reach
the file system to get the file (it's all about security)

the recipe is to use an IFrame in your form, to get back the hand into
the client,
then do what you need to do on client side while your file is beeing
uploaded.

What your precise use case ?

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


Re: [Zope3-Users] Render ZPT template to send rich-text HTML mail

2006-06-01 Thread Andreas Jung



--On 1. Juni 2006 16:32:35 +0200 [EMAIL PROTECTED] wrote:


Hi,
I need to send some rich-text (HTML) mail, containing information based
on many objects. It would be nice to render it using ZPT provided by Zope
instead of manual creation of HTML text.

Can I (ab)use ZPT for such purpose? I need to design ZPT template and
write corresponding View object.  How to wire together the ZPT template
and corresponding View object to render a HTML message and send it using
mail utility?



Look at Chris Wither's MailTemplates product.

-aj

--
ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany
Web: www.zopyx.com - Email: [EMAIL PROTECTED] - Phone +49 - 7071 - 793376
E-Publishing, Python, Zope & Plone development, Consulting


pgpXh7QFGMsqw.pgp
Description: PGP signature
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Render ZPT template to send rich-text HTML mail

2006-06-01 Thread thealx
Hi,
I need to send some rich-text (HTML) mail, containing information based on many 
objects. It would be nice to render it using ZPT provided by Zope instead of 
manual creation of HTML text.

Can I (ab)use ZPT for such purpose? I need to design ZPT template and write 
corresponding View object. 
How to wire together the ZPT template and corresponding View object to render a 
HTML message and send it using mail utility?

Could you suggest some points to start with?

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


Re : [Zope3-Users] Uploading files

2006-06-01 Thread Stéphane Brault
Thanks Stephan,
  could you indicate me another way to upload files ?
  
  Stéphane

- Message d'origine 
De : Stephan Richter <[EMAIL PROTECTED]>
À : zope3-users@zope.org; Stéphane Brault <[EMAIL PROTECTED]>
Envoyé le : Jeudi, 1 Juin 2006, 2h53mn 32s
Objet : Re: [Zope3-Users] Uploading files

On Tuesday 30 May 2006 09:30, Stéphane Brault wrote:
>  for my application I mainly use sqlos and jsonserver, which means that I
> don't use much standard Zope components, I need to let users upload a file
> which I parse to update the database. I don't see how to upload files with
> AJAX. Is there a way or should I go another way. I must say I don't know
> how to do it the standard way.

While I hate AJAX with a passion, you could certainly do this. If JS has a way 
to access a local file once it has been selected, then you can use the 
XmlHttpRequest class to PUT the file on the server, for example. I certainly 
would not use JSON for this task.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training



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


Re: [Zope3-Users] Cut + Paste Bug?

2006-06-01 Thread David Johnson
Thanks. That's exactly what I ended up doing!

On Thu, 2006-06-01 at 09:58 -0400, Stephan Richter wrote:
> On Monday 15 May 2006 16:15, David Johnson wrote:
> > I copied a Pluggable Authentication Utlity from one folder to another.
> > However, the plugins were not copied. As a result, I cannot edit the
> > copied utility.  Now I'm stuck with a broken pluggable authentication
> > utility.  If I try to edit it to fix it, I cannot.  
> >
> > 1. Is this a bug?
> 
> Yeah, it is a bug. Pluggable Authentication utilities should probably have 
> their own ObjectCopier/ObjectMover implementation.
> 
> > 2. How do I remove the broken utility?
> 
> Good question. During development I would say, delete the Data.fs file. In my 
> experience I have learned that all of your app setup should be described in 
> Python anyways. ;-)
> 
> Regards,
> Stephan

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


Re: [Zope3-Users] Cut + Paste Bug?

2006-06-01 Thread Stephan Richter
On Monday 15 May 2006 16:15, David Johnson wrote:
> I copied a Pluggable Authentication Utlity from one folder to another.
> However, the plugins were not copied. As a result, I cannot edit the
> copied utility.  Now I'm stuck with a broken pluggable authentication
> utility.  If I try to edit it to fix it, I cannot.  
>
> 1. Is this a bug?

Yeah, it is a bug. Pluggable Authentication utilities should probably have 
their own ObjectCopier/ObjectMover implementation.

> 2. How do I remove the broken utility?

Good question. During development I would say, delete the Data.fs file. In my 
experience I have learned that all of your app setup should be described in 
Python anyways. ;-)

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] ComponentLookupError

2006-06-01 Thread Stephan Richter
On Monday 15 May 2006 18:39, Jachin Rupe wrote:
> TypeError: ('Could not adapt',  0x3b3a6f0>, )
>
> I think this is saying that it can't adapt my Person object to the  
> IPerson interface.
>
> Am I still missing something?

No, your code looks good. I do not see, why Person cannot adapt IPerson; btw, 
if an object implements an interface it is always adaptable to this 
interface; it simply returns itself.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] AJAX (was Uploading files)

2006-06-01 Thread Marco Mariani
Stephan Richter wrote:

>> Just curious... what is it about AJAX that you hate? The implementation?
>> The concept? Something else?
> 
> About everything. JS has no good development tools, it is impossible to do 
> decent debugging and testing. (No, I do not consider the browser-based 
> debugger and Selenium acceptable development environments.)

Please take into account that the next Gecko release (Firefox 3.0) will
have agnostic DOM support, with python and friends.
And for some markets, having one supported browser is enough.

But I guess future zope releases/modules won't make it any more
difficult to have "exotic" front-ends, be it ajax, xul,
the-ms-alternative-to-xul or xforms. Somebody would just write a formlib
look-a-like.
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] i18n questions

2006-06-01 Thread Marco Mariani
Stephan Richter wrote:

>> - How do a write/register a negotiator that choose a language based on
>> an attribute of the user object and then falls back to normal browser
>> negotiation if that attribute isn't present?
> 
> Just implement the right interface and register it. This is not too hard and 
> I 
> think there are code examples out there.

There is an example on Philipp's book.

I don't have it here, but this for instance FORCES italian all the way:


from zope.publisher.browser import BrowserLanguages

class BrowserItalianLanguage(BrowserLanguages):

def getPreferredLanguages(self):
#langs = super(BrowserFormLanguages, self).getPreferredLanguages()
return ['it']



and then in overrides.zcml:

  



of course you would normally get 'langs' from the super method and
manipulate it before returning



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


Re: [Zope3-Users] How to use catalog.searchResults

2006-06-01 Thread Stephan Richter
On Saturday 20 May 2006 11:04, Florian Lindner wrote:
> How to use it?

I would strongly suggest looking into hurry.query from z3-base. It is very 
easy to use.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] AJAX (was Uploading files)

2006-06-01 Thread Stephan Richter
On Thursday 01 June 2006 09:01, Jonathan wrote:
> Just curious... what is it about AJAX that you hate? The implementation?
> The concept? Something else?

About everything. JS has no good development tools, it is impossible to do 
decent debugging and testing. (No, I do not consider the browser-based 
debugger and Selenium acceptable development environments.) Other than that, 
the way DOM, JS, et al. solve this sort of problem is just horrible. The 
problem of minimizing network data transfer for a GUI has been solved since 
over 20 years (X and all its toolkits), but the Web has to reinvent the 
wheel.

I am not going to comment further on the issue.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] getUtility outside of the zope.app

2006-06-01 Thread Stephan Richter
On Friday 26 May 2006 09:11, David Pratt wrote:
> Hi. For the use of interfaces outside of zope.app, does getUtility have
> any value? Many thanks.

getUtility is provided by zope.component. If you use zope.interface and 
zope.component in another project, you surely can make use of it. Read the 
*.txt files in zope.component. They are very illuminating.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] redirect in a ContainerTraverser

2006-06-01 Thread Stephan Richter
On Sunday 28 May 2006 11:30, gawel wrote:
> This work fine but is there an easy way to do this ?

Well, writing a view is one way. Another way is writing dynamically generated 
content components, like LocalFS does in Zope 2. You can also write a custom 
traverser that dynamically generates callable objects.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] AJAX (was Uploading files)

2006-06-01 Thread Jonathan


- Original Message - 
From: "Stephan Richter" <[EMAIL PROTECTED]>
While I hate AJAX with a passion, you could certainly do this. If JS has a 
way

to access a local file once it has been selected, then you can use the
XmlHttpRequest class to PUT the file on the server, for example. I 
certainly

would not use JSON for this task.

Regards,
Stephan



Just curious... what is it about AJAX that you hate? The implementation? The 
concept? Something else?




Jonathan 


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


Re: [Zope3-Users] i18n questions

2006-06-01 Thread Stephan Richter
On Wednesday 31 May 2006 04:29, Chris Withers wrote:
> - Can my existing .pot and .po files be used?

Yes, the PO file format is totally independent of Zope and Python.

> - Are ZPT's marked up in the same way as they were in Zope 2?

The Zope 2 people backported the Zope 3 code, so yes. :-)

> - How would I mark up constant and computers strings in zodb-based
> Python Scripts?

That issue has not been addressed at all, since we are not supporting TTW 
development.

> - Same question for External Methods.

This is Python code; Zope 3 provides a customized pygettext implementation to 
extract Python message strings.

> - How do I ask the translation service what the currently negotiated
> language is?

Zope 3 does not have a translation service. It is also not of the translation 
utility's concern to know about the negotiated language. There are other 
interfaces for this; I believe ILanguageNegotiator.

> - How do I ask the translation service what all the available languages
> are for a particular domain?

I do not think there is an API for that, but you could certainly develop one.

> - How do a write/register a negotiator that choose a language based on
> an attribute of the user object and then falls back to normal browser
> negotiation if that attribute isn't present?

Just implement the right interface and register it. This is not too hard and I 
think there are code examples out there.

> - How do I generate .pot files from ZPTs, Python Scipts and External
> Methods? I used to use PTS' .missing functionality and just spider the
> whole app. Is something similar available in Zope 2.9/3 land?

In Zope 3 you can simply call utilities/i18nextract.py; it will extract all 
message strings from Python, ZPT and ZCML files.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Uploading files

2006-06-01 Thread Stephan Richter
On Tuesday 30 May 2006 09:30, Stéphane Brault wrote:
>  for my application I mainly use sqlos and jsonserver, which means that I
> don't use much standard Zope components, I need to let users upload a file
> which I parse to update the database. I don't see how to upload files with
> AJAX. Is there a way or should I go another way. I must say I don't know
> how to do it the standard way.

While I hate AJAX with a passion, you could certainly do this. If JS has a way 
to access a local file once it has been selected, then you can use the 
XmlHttpRequest class to PUT the file on the server, for example. I certainly 
would not use JSON for this task.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] How to manually define an object's provided interfaces?

2006-06-01 Thread Stephan Richter
On Monday 29 May 2006 06:56, Frank Burkhardt wrote:
> Unfortunately, there is no 'provide' method on interfaces :-( .
>
> Now the questions:
>
> 1. Is the list of a content object's provided interfaces stored
> persistently in the Zodb?

Yes.

> 2. Is it according to Zope-, Python-, ... philosophy ok to danymically
> implement interfaces depending on the inner state of an object?

Yes.

> 3. How do I manually make objects provide or "unprovide" given interfaces?

zope.interface.directlyProvides(obj, ifaces) *overrides all* directly provided 
interfaces. For simply adding a a directly provided interface without 
deleting any others use zope.interface.alsoProvides(obj, ifaces). A good 
usage example is setting the skin on a request.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Call a Python method from a ZPT

2006-06-01 Thread Stephan Richter
On Monday 29 May 2006 13:49, Paolo Cilmo wrote:
>  In Zope3, i made the same product (package). From a ZPT page (in ZMI), i
> can call a method of Poll if the method don't take arguments, for example
> with: 
>  
>  
>  where poll1 is an istance of Poll package and it is in the same folder of
> the ZPT page. This works because the method don't take arguments, i just
> wan't call a method with parameters in Zope3, writing something like: 
>  

This works like you wrote it, however it is strongly discourage. Instead, you 
should write a view class that does all the logic and just insert the results 
into the template. There is a lot of documentation and code out there that 
describes how to develop views properly.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Re: How to prevent several notifications of events ?

2006-06-01 Thread Florent Guillaume

Thierry FLORAC wrote:

I've build a simple adapter that modifies context properties through
annotations ; everything works fine.
In several cases, when some attributes are updated, I do a
"notify(ObjectModifiedEvent(self.context))" so that several subscribers
are called.

My problem is then that if several attributes modifications are done,
several "ObjectModifiedEvent" are sent and the same handler is called
several times (with the same parameters) ; so is it easily possible to
prevent the same event to be called several times for a same context and
a same request ?
Or should I try to use request annotations and subscribe to
IEndRequestEvent (if it's not too late and not too expensive...) ?


Yes that's the proper way to do compress events: record the stuff to do, and 
do it at the end of the request.


Depending on the stuff to do, it may involve subtleties, for instance if you 
modify one object then delete it in the same request, you don't want to call 
your final handler for that object...


Florent

--
Florent Guillaume, Nuxeo (Paris, France)   Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   [EMAIL PROTECTED]
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Create RSS feed

2006-06-01 Thread Tarek Ziadé
Rupert Redington wrote:

>Tarek Ziadé wrote:
>  
>
>>Achim Domma wrote:
>>
>>
>>
>>>Hi,
>>>
>>>I want to provide an RSS for a content object which is a site. Seems
>>>to me, like this should be a generic functionality so I wonder if
>>>there is already some product which I did not found!?
>>>
>>>regards,
>>>Achim
>>>
>>>___
>>>Zope3-users mailing list
>>>Zope3-users@zope.org
>>>http://mail.zope.org/mailman/listinfo/zope3-users
>>>  
>>>
>>Hi,
>>Take a look here http://zope-cookbook.org/cookbook/recipe59
>>
>>Tarek
>>
>>___
>>Zope3-users mailing list
>>Zope3-users@zope.org
>>http://mail.zope.org/mailman/listinfo/zope3-users
>>
>>
>
>
>I've found PyRSS2Gen
>(http://www.dalkescientific.com/Python/PyRSS2Gen.html) very useful for
>doing the work of formatting the feed from inside a BrowserView.
>  
>
Interesting approach, I think having XML templates and a browser that
just returns items is better
though, because all formats out there (RSS 1, RSS 2, Atom, etc) can be
expressed by XML files and work over the very same
view class, that spits Dublin Core infos.

Then it's just a matter of ZCML configuration.

In your solution, the view itself has to take care of wich format should
be outputed.

Cheers

Tarek


>Rupert
>___
>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] Create RSS feed

2006-06-01 Thread Rupert Redington
Tarek Ziadé wrote:
> Achim Domma wrote:
> 
>> Hi,
>>
>> I want to provide an RSS for a content object which is a site. Seems
>> to me, like this should be a generic functionality so I wonder if
>> there is already some product which I did not found!?
>>
>> regards,
>> Achim
>>
>> ___
>> Zope3-users mailing list
>> Zope3-users@zope.org
>> http://mail.zope.org/mailman/listinfo/zope3-users
> 
> 
> Hi,
> Take a look here http://zope-cookbook.org/cookbook/recipe59
> 
> Tarek
> 
> ___
> Zope3-users mailing list
> Zope3-users@zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users


I've found PyRSS2Gen
(http://www.dalkescientific.com/Python/PyRSS2Gen.html) very useful for
doing the work of formatting the feed from inside a BrowserView.

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


Re: [Zope3-Users] Create RSS feed

2006-06-01 Thread Tarek Ziadé
Achim Domma wrote:

> Hi,
>
> I want to provide an RSS for a content object which is a site. Seems
> to me, like this should be a generic functionality so I wonder if
> there is already some product which I did not found!?
>
> regards,
> Achim
>
> ___
> Zope3-users mailing list
> Zope3-users@zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users


Hi,
Take a look here http://zope-cookbook.org/cookbook/recipe59

Tarek

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