Re: [Zope3-Users] Is zope3 dead?

2008-12-21 Thread Peter Bengtsson
Seen this?
http://plope.com/Members/chrism/le_roi_est_mort

"Zope 3" as an application server brand is dead.



2008/12/21 Alek :
> For some time, I have a bad, worrisome feeling that Zope3 development pace
> has slew down.
> Today looked to zope wiki and discovered that there are virtually no new
> articles. I've also found that last release is almost one year old and zope
> 3.4.0c0 is not even a real release, but a release candidate. Someone would
> say: hey, but maybe the development has just been decentralized? Zope 3.4 is
> the first eggified release, so maybe the development just moved to eggs
> (z3c.* and others).
> But I digged deeper and searched for some stats of Zope3-Users traffic,
> thanks to google. What I found I have published on a chart at
> http://pmiblog.blox.pl/2008/12/Is-Zope3-Dead.html. The traffic is at least
> half lower in 2008 than in 2007.
>
> Maybe the traffic moved somewhere else - to Wiki? This hypothesis haven't
> worked: I looked to zope 3 wiki and:
>
> the last new topic is 3 months old
> last month there is one edit of a topic
> After July 2008 there was not a one month with more than 5 edits.
>
> To summarize: It seems that zope3 development and engegement have been
> stalled for over half a year.
> Any thoughts? Have I missed some switch to other communication channels? Or
> maybe grok really took away all hearts and souls?
> What are the causes of the slowdown? Or maybe I just misinterpret the
> symptoms?
>
> Warm Regards,
> Alek
>
> ___
> Zope3-users mailing list
> Zope3-users@zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
>
>



-- 
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Annoying thing about schema

2008-06-05 Thread Peter Bengtsson
2008/6/5 Philipp von Weitershausen <[EMAIL PROTECTED]>:
> Peter Bengtsson wrote:
>>
>> Suppose you've written this:
>>
>> class ISomething(zope.interface.Interface):
>> foo = zope.schema.TextLine(title="Foo")
>>
>> then you get the error below.
>> First of all, why can't it just help me and just convert the str to a
>> unicode. All it'd need to do is just::
>>
>>  title = unicode(title)
>>
>> Django does this.
>> If someone does something bad like `TextLine(title="Ölmage")` that
>> developer should rightly get a UnicodeDecodeError.
>> Secondly, if there is an actual reason for this extreme analism, why
>> can't the error be wrapped into something more user friendly?
>
> Very good points. I think UnicodeDecodeErrors have a bad reputation, though
> (mostly because of Python's stupid implicit conversion). I think Grok's
> policy is very sane in this regard: wherever human-readable text has to be
> entered, either a unicode object or a string just containing ASCII
> characters are acceptable. A very explicit error message stating that exact
> policy should be raised. Look at Grok's error messages, we've tried hard
> making them understandable.
>
This was actually Grok development. But the interface and schema part
is all zope3.
I should have posted to zope3-dev instead.

> I think a proposal on zope3-dev (plus a patch) would be welcomed.
>

I'm not sure how to write the proposal. Can't I just make a feature
request on launchpad or something?



-- 
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Annoying thing about schema

2008-06-04 Thread Peter Bengtsson
le "/home/peterbe/dev/GROK/GrokGlossary/src/grokglossary/app.py",
line 21, in ITerm
term = schema.TextLine(title='Term')
  File 
"/home/peterbe/buildout-eggs/zope.schema-3.4.0-py2.4.egg/zope/schema/_bootstrapfields.py",
line 278, in __init__
super(Text, self).__init__(*args, **kw)
  File 
"/home/peterbe/buildout-eggs/zope.schema-3.4.0-py2.4.egg/zope/schema/_bootstrapfields.py",
line 260, in __init__
super(MinMaxLen, self).__init__(**kw)
  File 
"/home/peterbe/buildout-eggs/zope.schema-3.4.0-py2.4.egg/zope/schema/_bootstrapfields.py",
line 108, in __init__
self.title = title
  File 
"/home/peterbe/buildout-eggs/zope.schema-3.4.0-py2.4.egg/zope/schema/fieldproperty.py",
line 52, in __set__
field.validate(value)
  File 
"/home/peterbe/buildout-eggs/zope.schema-3.4.0-py2.4.egg/zope/schema/_bootstrapfields.py",
line 138, in validate
self._validate(value)
  File 
"/home/peterbe/buildout-eggs/zope.schema-3.4.0-py2.4.egg/zope/schema/_bootstrapfields.py",
line 263, in _validate
super(MinMaxLen, self)._validate(value)
  File 
"/home/peterbe/buildout-eggs/zope.schema-3.4.0-py2.4.egg/zope/schema/_bootstrapfields.py",
line 165, in _validate
    raise WrongType(value, self._type)
ZopeXMLConfigurationError: File
"/home/peterbe/dev/GROK/GrokGlossary/parts/app/site.zcml", line
4.0-4.34
ZopeXMLConfigurationError: File
"/home/peterbe/dev/GROK/GrokGlossary/src/grokglossary/configure.zcml",
line 5.2-5.27
WrongType: ('Term', )
> /home/peterbe/buildout-eggs/zope.schema-3.4.0-py2.4.egg/zope/schema/_bootstrapfields.py(165)_validate()
-> raise WrongType(value, self._type)


-- 
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Authentication without cookies

2008-04-14 Thread Peter Bengtsson
Slightly off-topic: What mobile browsers that support XHTML don't
support cookies these days? Don't need an accurate answer but I'm
curious about rough numbers.

On 14/04/2008, Hermann Himmelbauer <[EMAIL PROTECTED]> wrote:
> Hi,
>  I'm developing a Zope3-based application which is used on mobile phones. The
>  problem here is that cookies don't always work with mobile browsers.
>  Therefore it seems, the way to go is to put a session key in the URL.
>
>  Therefore I need some authentication system that first tries to set a cookie,
>  and if it does not work, inserts somehow a key into every URL, whereas a
>  credentials plugin retrieves this key.
>
>  However, I assume I'm not the only one with such a scenario, therefore I'd
>  like to know if somebody solved this problem already?
>
>  If not, is there some suggested scenario how to find out if the browser
>  supports cookies?
>
>  Best Regards,
>  Hermann
>
>
>  --
>  [EMAIL PROTECTED]
>  GPG key ID: 299893C7 (on keyservers)
>  FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7
>  ___
>  Zope3-users mailing list
>  Zope3-users@zope.org
>  http://mail.zope.org/mailman/listinfo/zope3-users
>


-- 
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Refreshing possible yet?

2006-11-07 Thread Peter Bengtsson



Philipp von Weitershausen wrote:

To answer the question right away: No.

Peter Bengtsson wrote:
Since I'm still an eager zope3 newbie the misstakes I make are the 
kind of misstakes that you can't really write unittests for, like 
missing directives in the configure.zcml or incorretly use of browser 
views.
This is to an expert simple deployment but since I have to look up 
everything I do by example or by Phillipps book I tend to make a lot 
of simple little misstakes. Having to restart every time is quite 
annoying now. Is there a "module refreshing" tool available yet?


Gintautas Miliauskas once wrote a simple view refreshing tool. It's a 
hack, I don't know if it works reliably. And it's limited to views. See 
http://codespeak.net/svn/z3/z3reload/trunk/.



Cool. We'll have a look once I understand it a bit more.

I'll give in and rely on unittests instead of trial-and-error once 
I've got the site up and running but for the moment it feels it's a 
bore to have to wait for the restart 3-6 seconds for every little change.


I agree. Reloading modules in Python, especially when you store 
references to global objects like component registries do, is highly 
non-trivial, though... There are some ideas floating around, but it'll 
take a bit for us to synthesize them into something that may or may not 
work... Sorry.


I'd love to contribute but at the moment if feels far to complex for my 
limited knowledge of zope3.

Refreshing will become very useful.

--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Refreshing possible yet?

2006-11-06 Thread Peter Bengtsson
Since I'm still an eager zope3 newbie the misstakes I make are the kind 
of misstakes that you can't really write unittests for, like missing 
directives in the configure.zcml or incorretly use of browser views.
This is to an expert simple deployment but since I have to look up 
everything I do by example or by Phillipps book I tend to make a lot of 
simple little misstakes. Having to restart every time is quite annoying 
now. Is there a "module refreshing" tool available yet?


I'll give in and rely on unittests instead of trial-and-error once I've 
got the site up and running but for the moment it feels it's a bore to 
have to wait for the restart 3-6 seconds for every little change.



--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] getId in zope3?

2006-11-05 Thread Peter Bengtsson
In Zope2 every object has an 'id' which meant that you can use 
someobject.getId() to find out what name the object is stored under in 
its container.

Is there an equivalent in zope3?
...or am I looking for a solution to a problem that doesn't exist?
--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] z3c.zrtresource or zc.resourcelibrary

2006-10-24 Thread Peter Bengtsson

Which one should I use for my new zope 3 site?
z3c.zrtresource or zc.resourcelibrary?

I don't understand the difference between them and I don't have hours to 
spare on evaluating both.


I'm sure they do different things and do them differently well.
My aim to be able to smoothly define css, images, js without too much 
magic for my one and only skin.



--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Email application form causing despair!

2006-03-14 Thread Peter Bengtsson



Michael Haubenwallner wrote:

Peter Bengtsson wrote:


Good code Laurence. Thanks.
I wish we had a Cookbook to put all of these into.
Zopelabs.com sucks unfortunately.



Hmm, i have used zopelabs.com for many years now, its a great resource 
of information.


Zope3 recipes could well be collected there (a 'Zope3' category has been 
added recently).


I never found it sucking - maybe you want to tell us your troubles ?

I haven't used it now since the login stopped working. There were also 
other problems with search not working.


And the long-lasting bug that there's nog link back to the homepage. The 
logo isn't clickable.


--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Email application form causing despair!

2006-03-14 Thread Peter Bengtsson

Good code Laurence. Thanks.
I wish we had a Cookbook to put all of these into.
Zopelabs.com sucks unfortunately.

Laurence Rowe wrote:

I think you want to do something along these lines:

from zope.formlib import form
from zope.interface import Interface

class IEmailForm(Interface):
subject = schema.TextLine(
title=u'Subject',
required=True,
)
comments = schema.TextLine(
title=u'Comments',
required=True,
)

class EmailForm(form.Form):
form_fields = form.Fields(IEmailForm)

@form.action("Email", validator='validate_input')
def handle_email_action(self, action, data):
send_mail(data['subject'], data['comments'])
self.status = u'Email Sent'

def validate_input(self, action, data):
#validation logic here
return [] # no errors

def send_mail(subject, comments):
...

Plumb it in with zcml in the normal way. No idea about mutable schemas.

Hope that helps,

Laurence

Graham Stratton wrote:
I have a seemingly simple problem.  I want to provide a web form which 
is emailed off on submission.  I'd like to do some validation before 
it is emailed off.


*snip saga involving much of formlib and browser:form*

On much reflection, I think what I probably want to do is to implement 
an 'email form' content type, which has an address to email the form 
to, and a schema, and then use the formlib machinery to produce and 
validate a form from this.  Is this the right way to go?  I can't work 
out how I can use any of the higher-level formlib code.  Will I need 
to render one widget at a time and do my own validation?  Or is there 
something useful in zope.app.form?


I guess in the longer term it would make sense to make my schema 
persistent and based on the mutable schema implementation.  How might 
I go about that?  I did play a bit with the mutable schema utility, 
but I got errors when trying to add Text and TextLine fields.   I also 
don't really understand why it's a utility anyway.  Does it offer a 
way to edit any persistent schema?


I'm feeling very lost, I hope someone can point me in the right 
direction.  Thanks for the all the support.


Regards,

Graham


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



--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Visionaire! (All your problems, solved)

2006-03-02 Thread Peter Bengtsson
Interesting. My angle on things is simplicity. I don't know or care
how it's reached as long as it's reached. (sort of)

You think the ONE package idea actually is confusing. You, as a
genuine real developer, find this mass of packages confusing. I
respect that.
Perhaps by having three packages instead of just one (ie. zope3)
structure and order is implied that you can use to your advantage.

The reason I prefer having one huge package in zope2 for stuff is
maybe because zope still isn't working very well with debian
packaging. Perhaps there's hope with Eggs? Maybe with eggs, when I
realise that I need CookieCrumbler I don't need to google for it to
manually download it from hathawaymix.org.

Chris M, you're the Eggs expert (or pretend to be for the sake of
this exercise). What do you think? Do you think we can use Eggs where
zope2 and debian failed?

On 3/2/06, Martin Aspeli <[EMAIL PROTECTED]> wrote:
> On Thu, 02 Mar 2006 11:41:37 -, Peter Bengtsson
> <[EMAIL PROTECTED]> wrote:
>
> > It's been a while but the last time I installed Plone it came with
> > stuff like CookieCrumbler and Formulator.
>
> Heh, it no longer does :-)
>
> > What a bliss and time-saver!
> > It's not "unix-right" but I don't care, I have other stuff to spend my
> > precious time on such as coding.
> >
> > Making things simple will (and always has) be superior to making
> > things clinically correct in the computer industry.
> >
> > You point, Jeff, was that the Zope2 ZMI is "plaguing" the true Zope3
> > as you know it. I'm not worried about this personally. On most of my
> > zope2 products the ZMI is just used as a debug tool rather than
> > something clients get to work in.
>
> The thing is, you know that. I'm just learning zope 3 and will be using it
> principally via Five, and even after reading a book on it, the exact use
> of the ZMI and rotterdam and all that is still unclear to me. Is it meant
> to be part of my application or not? Is it means as an admin interface, or
> simply for bootstrapping?
>
> Martin
>
> --
> (muted)
>
> ___
> Zope3-users mailing list
> Zope3-users@zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
>


--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Visionaire! (All your problems, solved)

2006-03-02 Thread Peter Bengtsson
I'm with Max on this one.

What's the point? To save a few megabytes of harddisk space?
If you don't want the zope.bobo part of your zope3, ignore it. You
don't have to use it if you don't want to.

It's been a while but the last time I installed Plone it came with
stuff like CookieCrumbler and Formulator. What a bliss and time-saver!
It's not "unix-right" but I don't care, I have other stuff to spend my
precious time on such as coding.

Making things simple will (and always has) be superior to making
things clinically correct in the computer industry.

You point, Jeff, was that the Zope2 ZMI is "plaguing" the true Zope3
as you know it. I'm not worried about this personally. On most of my
zope2 products the ZMI is just used as a debug tool rather than
something clients get to work in.

Sure, people have misstaken Zope for Plone when they use the windows
installer and we've all seen newbies complaining about bugs in zope on
the zope mailing list which just happens to be a 100% plone related
only.
Tough. I'd rather have a few of these lost beginners who are wrong
than no new beginners at all.

Let's keep it simple, bundle it all in one fat package and ignore the
excessive zmi files that gets thrown in.

On 3/2/06, Max M <[EMAIL PROTECTED]> wrote:
> Jeff Shell wrote:
>
> >I think this keeps Zope 3 as we know it alive, keeps the Zope brand
> >intact, and offers a future for Zope 2 and similar caliber desires for
> >a Big App Server while not interfering with the more "pure" and simple
> >concepts that makes Zope 3 appealing for developers like me.
> >
> >
>
> I think its an absolutely terrible idea!
>
>
> The most succesfull Zope 2 "product" out there is most likely Plone. And
> it has everything and the kitchen sink in it.
>
> Python also has a lot of libraries included, which means that you
> seldomly need 3. party libraries to extend Plone.
>
>
> I fear that loosely coupled libraries does not make an app server. I can
> just imagine the upgrade hell when one package requires two different
> packages, and another package requires the same two different packages,
> but in different versions.
>
> Canonical releases of compatible package collections is a *must*.
> Splitting it all up in small chunks that are out of sync would be a
> disaster.
>
> Releases that contains a *huge* compatible collection of packages is the
> most effective way to move forward in an unified way.
>
> Plone products works together because Plone is so well defined.
> Sometimes this feels like a straightjacket. On the othe hand, in plain
> Zope 2 it is practically impossible to reuse other peoples products on
> your own site because the playing field was too loosely defined.
>
>
> But just like you don't have to learn every Python library to use
> Python, you should not have to know every package in the app server.
> That is not a question of making seperate releases though, it's the age
> old programming problem of structuring code with few interdependencies.
>
> So throw everything into the release. heck even throw Zope 2 in there if
> you have to. But dont force the programmers to use it before they need
> the functionality.
>
> --
>
> hilsen/regards Max M, Denmark
>
> http://www.mxm.dk/
> IT's Mad Science
>
> ___
> Zope3-users mailing list
> Zope3-users@zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
>


--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Cometh the hour... ZCML Configurator

2006-02-23 Thread Peter Bengtsson
Wanna watch a 700Kb screencast showing the pre-alpha ZCML Configurator?
http://www.peterbe.com/zope/zcmlconfigurator/

It's not finished yet. I've only spent a day and a half on it and it's
missing some important Save features still. It's a commandline tool
that  fires up a browser (notice the -b on the command line in the
beginning) to allow you to manipulate a configure.zcml file as a DOM
tree with lots of nifty javascript fluff and AJAX.

I've tested it with Firefox (linux, windows) and I'm not going to lose
any sleep over it not working in IE or Lynx.

The only zope3 thing about this is that it can suggest clever new
directives and default attributes when you add a new directive through
the little wizard.

There are still a few features missing and a few bugs that I need to
iron out before I can launch anything, but I'm so excited about the
quick progress that I thought I'd share it with you guys.

The motivation was that I got annoyed by people complaining that XML
is so bad. I like XML situps!
(that, and that I wanted some excuse to dabble with more hardcore dom scripting)

--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] What attributes are made persistent

2006-02-16 Thread Peter Bengtsson
On 2/16/06, Jeff Shell <[EMAIL PROTECTED]> wrote:
> One could, but it's really not worth it. It's just the laws of Python
> and mutability and immutability :). (It took me years to understand
> those terms. I kept associating them with 'mutable' in the "can be
> made quiet" sense... Eventually my music brain stepped back and I went
> "oh, MUTATE! Ahhh!". Seriously, it took me about four years to
> understand that :).
>
Wow! I think I love you Jeff. Not only do you reply with
non-condencending constructive advise you also confess to [past]
weaknesses.

>
> Personally, I seldom store lists, or even use them as attributes on
> instances. Even outside of Zope/ZODB, I've found myself accidentally
> losing data because I was carelessly using the reference. Tuples for
> everybody!
>

Ok. Sounds sensible.
I've learnt something: use BTrees() instead of dict(), use tuple()
instead of list().


> On 2/15/06, Shaun Cutts <[EMAIL PROTECTED]> wrote:
> > Well, one could have a base class along the lines of
> >
> > class PersistSetItemOnAttributes:
> >
> > def __setattr__( self, attr, val ):
> > oldSI = val.__class__.__dict__.get( '__setitem__', None )
> > if oldSI is not None:
> > def newSI( vself, vattr, vval ):
> > vself._p_changed = True # is this the right member?
> > oldSI( vattr, vval )# oldSI is bound: no vself?
> > val.__class__.__setitem__ = newSI
> > super( PersistSetItemOnAttributes, self ).__setattr__( attr, val
> > )
> >
> > Of course, this is really just pseudocode. For one thing, need to trap
> > whether 'val' is really a class. For another if you were serious about
> > this, you would want to check if the obj wasn't persistent first, and
> > you might want to do it recursively. And while your are at it, you might
> > want to check on other mutators as well(for instance, check first
> > what sequence interface if any 'val' supports...)
> >
> > ... sounds like too much work, and would be problem prone even so. After
> > all, some things you don't want to be persistent!
> >
> > - Shaun
> >
> > > -Original Message-
> > > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]
> > > On Behalf Of Stephan Richter
> > > Sent: Wednesday, February 15, 2006 8:43 AM
> > > To: zope3-users@zope.org
> > > Cc: Florian Lindner
> > > Subject: Re: [Zope3-Users] What attributes are made persistent
> > >
> > > On Wednesday 15 February 2006 08:21, Peter Bengtsson wrote:
> > > > class PersistentAnything(PersistentMapping, PersistentList,
> > > > PersistentDict):
> > >
> > > AA! This is so wrong! It merges two incompatible APIs: collections
> > and
> > > mappings. The non-persistent equivalent to this is:
> > >
> > >   >>> class DoEverything(set, list, dict):
> > >   ...  pass
> > >
> > > > Am I just trying to make it too simple?
> > >
> > > I think you try far too hard to not understand why the persistent
> > > mechanism
> > > works as it does. You make your life harder than it has to be.
> > >
> > > 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 mailing list
> > Zope3-users@zope.org
> > http://mail.zope.org/mailman/listinfo/zope3-users
> >
>
>
> --
> Jeff Shell
> ___
> Zope3-users mailing list
> Zope3-users@zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
>


--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] What attributes are made persistent

2006-02-15 Thread Peter Bengtsson
On 2/15/06, Paul Winkler <[EMAIL PROTECTED]> wrote:
> On Wed, Feb 15, 2006 at 01:21:14PM +0000, Peter Bengtsson wrote:
> > I understand the mutation stuff and I always do it like this in zope2
> > (I'm a complete beginner in the zope3 world eager to learn):
> >
> > def updatesometing(self):
> >#self.numbers['Peter'] = "0779 123 456"
> >numbers = self.numbers
> >numbers['Peter'] = "0779 123 456"
> >self.numbers = numbers
> >
> > But in zope2 land, if I derive from Persistent it magically saves ALL
> > attributes defined in __init__ assuming that I post-write to them
> > correct as shown above.
>
> That hasn't changed in zope 3.  This is just standard ZODB behavior.
> setattr will cause a save on commit regardless of the type of
> the value.  If you read Jeff's reply again carefully, he said as much.
>
> PersistentList and PersistentDict are not new, either.
> They've been used in Zope 2 projects for ages.
>
> There are still exactly three ways to get sub-object mutations to
> persist:
>
> 1) Set the "dirty bit" by hand, e.g.:
>
>  self.alist.append(1)
>  self._p_changed = 1
>
> 2) Re-assign the attribute, e.g.:
>
>  alist = self.alist
>  alist.append(1)
>  self.alist = alist
>
> 3) Using a persistent sub-object, e.g. a PersistentList instance:
>
>  self.alist.append(1)
>


Now I get it! Sorry for being slow and thanks for explaining.

So by using PersistentList it just means that you can use:
 self.alist.append(1)
in your code. The attribute, self.alist, is still saved even without
PersistentList but it just means you have to be careful when writing
to it.

Cool!

--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] What attributes are made persistent

2006-02-15 Thread Peter Bengtsson
-- Forwarded message --
From: Peter Bengtsson <[EMAIL PROTECTED]>
To: Jeff Shell <[EMAIL PROTECTED]>
Date: Wed, 15 Feb 2006 13:14:58 +
Subject: Re: [Zope3-Users] What attributes are made persistent
On 2/15/06, Jeff Shell <[EMAIL PROTECTED]> wrote:
> On 2/14/06, Peter Bengtsson <[EMAIL PROTECTED]> wrote:
> > D'oh! That's confusing. Isn't there a class that gathers all of these in 
> > one.
> >
> > It seems confusing, you derive from Persistent but only some are accepted.
> > Does that mean that there's PersistentFloat and PersistentTuple too?
> > If not, why *only* dicts?
>
> As mentioned above, it applies to *mutable* objects.
>

>
> Instances of Persistent based classes know when they change. Like if you do::
>
> clive.age = 28
>

>
> On the other hand, if you do::
>
> clive.favoriteNumbers.append(13)
>
> 'clive' does not change. 'favoriteNumbers' changes. If favoriteNumbers
> is a regular Python list, the persistence machinery has no idea that
> it's changed. It's not being assigned to 'clive', it's already an
> attribute there and is not being replaced. So if it's not a
> PersistentList, it gets forgotten.
>

>
> It's not only dicts, it's dicts and lists (PersistentDict and PersistentList).
>
> I don't know if there's a PersistentSet. Python offers two sets since
> 2.3 - a mutable (list-like) one and an immutable (tuple-like) one. I
> imagine that if you use the mutable set (``sets.Set`` in 2.3, ``set``
> in 2.4), you'd run into the same problems. But if you used the
> immutable set (``sets.ImmutableSet``, ``frozenset`` in 2.4) you
> wouldn't.
>

>
> So - just use PersistentList and PersistentDict (or look into BTrees
> for better storage options).
>
> For more details, visit the ZODB documentation on ZODB programming,
> and visit the section on modifying mutable objects:
>
> http://www.zope.org/Wikis/ZODB/FrontPage/guide/node3.html
>

I understand the mutation stuff and I always do it like this in zope2
(I'm a complete beginner in the zope3 world eager to learn):

def updatesometing(self):
   #self.numbers['Peter'] = "0779 123 456"
   numbers = self.numbers
   numbers['Peter'] = "0779 123 456"
   self.numbers = numbers

But in zope2 land, if I derive from Persistent it magically saves ALL
attributes defined in __init__ assuming that I post-write to them
correct as shown above.

I like this simplicity and was hoping to find it in zope3 land too. I
guess I'm just an old dog and if I want to drag with me the zope2 way
I can do this::

import persistent.mapping.PersistentMapping
import persistent.list.PersistentList
import persistent.dict.PersistentDict

class PersistentAnything(PersistentMapping, PersistentList, PersistentDict):

I'm aware of BTrees and am/will always use it when size of objects
becomes "uncontrollable".

Am I just trying to make it too simple? Have I read one too many books
by Steve Krug?

--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] What attributes are made persistent

2006-02-14 Thread Peter Bengtsson
On 2/14/06, Lennart Regebro <[EMAIL PROTECTED]> wrote:
> On 2/14/06, Florian Lindner <[EMAIL PROTECTED]> wrote:
> > Hello,
> > in a class derived from Persistent, which attributes are stored? All or only
> > those thar are declared in the interface?
>
> All.
>
> > def __init__(self):
> > self.queue = {}
> >
> >
> > self.queue seem is empty each time I restart Zope.
>
> That's because dictionaries are not derived from Persistent. Try 
> PersistentDict.
>
D'oh! That's confusing. Isn't there a class that gathers all of these in one.

It seems confusing, you derive from Persistent but only some are accepted.
Does that mean that there's PersistentFloat and PersistentTuple too?
If not, why *only* dicts?

> --
> 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
>


--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Squid/Apache Caching

2006-02-14 Thread Peter Bengtsson
On 2/14/06, Chris Withers <[EMAIL PROTECTED]> wrote:
> Steve Wedig wrote:
> > I'm in the planning stages for developing a Zope 3 application. It
> > would be nice to know my http caching plan ahead of time. It seems
> > that the two main options are squid and apache. I was wondering if the
> > most flexible setup might be to have apache running behind squid, and
> > zope behind apache.
>
> My personal preference is apache -> squid -> zope
>
> But that's 'cos I like Apache's rewriting and have more faith in it as a
> front-end proxy for sanitizing requests and the like...
>
That's very interesting. If you understood Squid better do you think
you'd leave out apache? Or perhaps that not the issue at all for you.
I'm asking because in my company we've lots of apache experience but
less so in squid. It's therefore a potential security risk to leave
out apache.

And what about the performance overhead? Any experience you can share?

> cheers,
>
> Chris
>
> --
> Simplistix - Content Management, Zope & Python Consulting
> - http://www.simplistix.co.uk
>
> _______
> Zope3-users mailing list
> Zope3-users@zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
>


--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users