Re: [Zope3-Users] Zope 3 Developer's LiveBook

2006-02-15 Thread Chris Withers

Reinoud van Leeuwen wrote:

On Tue, Feb 14, 2006 at 09:15:42PM +0100, Florian Lindner wrote:
I also think that pure Latex would be the best choice. It's convertible into a 
lot different formats and can be edited just using a simple text editor.


Isn't Docbook a better choice? Is is specially designed for documents like 
this, and easily parsable. lots of tools around. 
It can (AFAIK) be read and written by Open Office or any text editor. 


If I can use a real word processor to edit stuff (ie: OpenOffice) then 
I'd much prefer to see this...


I find it ironic the one of the first uses of PCs was to do word 
processing, and yet we seem to always strive to edit plain text of one 
variety or another, and yes, that includes latex ;-)


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


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

2006-02-15 Thread Chris Withers

Peter Bengtsson wrote:

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.


Urm, Peter, the rules of persistence w.r.t. mutable objects have been 
documented for a _long_ time. There's nothing Zope 3-specific here, and 
someone who's been using Zope as long as you should know better ;-)


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


Re: [Zope3-Users] Squid/Apache Caching

2006-02-15 Thread Chris Withers

Peter Bengtsson wrote:

That's very interesting. If you understood Squid better do you think
you'd leave out apache? 


Maybe, I guess I just have a soft spot for Apache though ;-)


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


Nope, Plone gives me all the performance overhead I need...

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


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


[Zope3-Users] Lists dont accept default values

2006-02-15 Thread Frank Burkhardt
Hi,

I wrote a schema like this to have a list of objects on a content object:

 class IMyContent(Interface):
mynumbers=List(
   title=_(uCool Numbers),
   required=True,
   value_type=Int(
title=_(integer)
   )
   default=[1,2,3,5,7]
)
myline=TextLine(
   title=_(A line of text),
   required=True,
   default=u'default test'
)

I'm using an 'addform' to add self made objects to my site but unfortunately
the list mynumbers is not initialized with those 5 default numbers. The
default value of myline is displayed correctly on the add form.

Does anyone know, how this can be fixed?

Regards,

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


Re: [Zope3-Users] Zope 3 Developer's LiveBook

2006-02-15 Thread Fred Drake
On 2/15/06, Stephan Richter [EMAIL PROTECTED] wrote:
 So with that in mind, if you do not know how to do professional desktop
 publishing, then LaTeX is a much better options, since it results look really
 professional.

We also have lots of cool support for Python documentation in LaTeX,
which makes it really easy to work with after learning only some
basics of LaTeX.


  -Fred

--
Fred L. Drake, Jr.fdrake at gmail.com
There is no wealth but life. --John Ruskin
___
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 Paul Winkler
On Wed, Feb 15, 2006 at 01:21:14PM +, 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) 

-- 

Paul Winkler
http://www.slinkp.com
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Re: Zope 3 Developer's LiveBook

2006-02-15 Thread Philipp von Weitershausen
Reinoud van Leeuwen wrote:
I also think that pure Latex would be the best choice. It's convertible into 
a 
lot different formats and can be edited just using a simple text editor.
 
 Isn't Docbook a better choice? Is is specially designed for documents like 
 this, and easily parsable. lots of tools around. 
 It can (AFAIK) be read and written by Open Office or any text editor. 

I have used and continue to happily use DocBook for my book. I indeed
use db2latex to convert it to LaTeX because that's what the publisher
wants. You can also easily create HTML, manpages or PDFs (via XSL-FO).

I use emacs and nxml-mode to edit DocBook. nxml-mode gives me on-the-fly
validation and schema-based auto-completion. It makes me very
productive. I've never tried using OpenOffice and I'm not sure whether
its changes would actually leave existing whitespace intact (this would
be crucial for decent diffs).

By the way (1), I would very much recommend against LaTeX. I don't think
everyone knows how to use it properly (I sure don't). I also think it
does too much at a time (being a typesetting tool that also stores the
content you're trying to typeset). With DocBook or similar formats, you
can edit what matters, the content, and worry about what it's going to
look like later.

By the way (2), I also don't totally agree with Stephan on reST. I think
reST is a powerful tool and often underestimated. When parsing reST
text, docutils builds a DOM-like object structure which can easily be
serialized into XML and then to anything. The standard rst2html and
rst2latex scripts provided by docutils are only two possibilities. The
thought of switching my book to reST has crossed my mind two or three
times even, but for now I'm staying with the technology that I know and
that works.

Philipp

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


[Zope3-Users] Re: Zope 3 Developer's LiveBook

2006-02-15 Thread Philipp von Weitershausen
Fred Drake wrote:
So with that in mind, if you do not know how to do professional desktop
publishing, then LaTeX is a much better options, since it results look really
professional.
 
 We also have lots of cool support for Python documentation in LaTeX,
 which makes it really easy to work with after learning only some
 basics of LaTeX.

I wish the standard library was using reST.

___
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 +, 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] Lists dont accept default values

2006-02-15 Thread Florian Lindner
Am Mittwoch, 15. Februar 2006 14:40 schrieb Frank Burkhardt:
 Hi,

 I wrote a schema like this to have a list of objects on a content object:

  class IMyContent(Interface):
 mynumbers=List(
title=_(uCool Numbers),
required=True,
value_type=Int(
   title=_(integer)
)
default=[1,2,3,5,7]
 )

I think the default property expects one item of your list, so either 1, 2, 3, 
5 or 7, not all of them.
If you want to define the set of selectable values you maybe rather want to 
use a Choice field and specify the values property. Or set a Choice field as 
value for value_type.
See Stephans book [1], chapther 8.3 Core Schema Fields

[1] 
http://www.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/FrontPage/Zope3Book

Regards,

Florian


 myline=TextLine(
title=_(A line of text),
required=True,
default=u'default test'
 )

 I'm using an 'addform' to add self made objects to my site but
 unfortunately the list mynumbers is not initialized with those 5 default
 numbers. The default value of myline is displayed correctly on the add
 form.

 Does anyone know, how this can be fixed?
___
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 Lennart Regebro
On 2/15/06, Peter Bengtsson [EMAIL PROTECTED] wrote:
 D'oh! That's confusing. Isn't there a class that gathers all of these in one.

All of who?

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

Because floats and tuples are not mutable. You can't change them, so
the don't need to know that they should be persisted when changed.

 If not, why *only* dicts?

There is also PersistentList.

--
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] What attributes are made persistent

2006-02-15 Thread Shaun Cutts
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


Re: [Zope3-Users] Re: Zope 3 Developer's LiveBook

2006-02-15 Thread Fred Drake
On 2/15/06, Philipp von Weitershausen [EMAIL PROTECTED] wrote:
 I've never tried using OpenOffice and I'm not sure whether
 its changes would actually leave existing whitespace intact (this would
 be crucial for decent diffs).

I've worked a bit with generating OpenDocument documents for use with
OpenOffice, and have no expectation that the document will be edited
in a way that a plain-text user will be happy with.  Since the files
are ZIP files that contain XML, it's not like supporting plain text
users is a use-case for OpenDocument.


  -Fred

--
Fred L. Drake, Jr.fdrake at gmail.com
There is no wealth but life. --John Ruskin
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Zope 3 Developer's LiveBook

2006-02-15 Thread Igor Stroh
Igor Stroh wrote:
 Reinoud van Leeuwen wrote:
 
On Tue, Feb 14, 2006 at 09:15:42PM +0100, Florian Lindner wrote:


I also think that pure Latex would be the best choice. It's convertible into 
a 
lot different formats and can be edited just using a simple text editor.


Isn't Docbook a better choice? Is is specially designed for documents like 
this, and easily parsable. lots of tools around. 
It can (AFAIK) be read and written by Open Office or any text editor. 
 
 
 +1
 
 DocBook is definitely a better choice, there's db2latex for LaTeX
 (and PDF) conversion and various XSLT stylesheets for HTML.

To prove this statement, I've created a simple source tree that can
be used to automate the whole process:

z3lb-docbook/
|-- Makefile
|-- html-styles.xsl
|-- src/
|   |-- intro.xml
|   |-- new_chapter.py
|   |-- z3livebook.css
|   `-- z3livebook.xml
`-- tex-styles.xsl

Just run `make html` or `make pdf` to produce HTML or PDF respectively.

Dependencies (as Debian packages):
   o docbook-xml (pdf+html)
   o tetex-bin (pdf)
   o xsltproc (pdf+html)
   o docbook-xsl (html)

I'm using a similar setup to write my diploma thesis, so far it
works quite well.

Cheers,
Igor

P.S.:
DocBook - The Definitive Guide
http://www.docbook.org/tdg5/en/html/docbook.html


z3lb-docbook.tar.gz
Description: GNU Zip compressed data
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Swiss Easter Sprint - Announcement

2006-02-15 Thread Roger Ineichen
Swiss Easter Sprint

Sorry for cross posting, I just will make sure that 
nobody feels like not invited and has a chance to 
participate.


When

The sprint starts on Saturday, April 8, at 9:00am and will end 
on Wednesday, April 12 in the afternoon. The official welcome 
activity will be at noon on April 8.


Where

The workshop will be located in Cham. Cham is a Town near Zug, 
Switzerland. Yeah, Zug is a town and doesn't mean Zope User Group!
http://www.cham.ch/de/portrait/sehenswuerdigkeiten


What

Zope 3 Strategy Workshop

The future of Zope 3 and its role for other frameworks

With the recent interest of the wider community in Zope 3, it is important
to define Zope 3 in light of this. Discussions could be held about what
should be the Zope 3 core, how can other development shape the core and how
Zope 3 can best support high-level frameworks, such as Cubed.

In previous sprints we have also worked on a new face for Zope 3, a new Web
site. This and other Zope 3 marketing material could be developed during the
sprint, making the event also interesting for non-developers. It would be
really great to have a Zope 3 promotion leam at the sprint.

This is a great opportunity for Zope 3 core developers and framework
builders to meet and have discussions. We will define more concrete topics
to work on and discuss as we come closer to the sprint date.

Zope 3 Core Development

We have recently seen and will see a lot of reorganization of the
core. However, a lot of the changes (with exception of Jim's adapter
registry rewrite) are cosmetic, leaving some tougher technical challenges
open. Since this sprint will be a true Zope 3 sprint, we could address some
really hard-core issues, like menues, new widget package, formlib work,
etc. The actual topics will depend on the participants, of course.

Zope 3 Experimentation

Recently, there have been several experimental packages under development,
like the boston skin and the WebDev package while others have been proposed
like Shane's Web root or indirection tool. While not directly usable in a
release, this research work is necessary to give Zope 3 the cutting edge in
the future.


You can register yourself on the sprint page at:
http://www.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/SwissEaster
Sprint


Or send me a mail if you don't have access for editing the Wiki-Page
and add yourself to the participant list.

Regards
Roger Ineichen
_
Projekt01 GmbH
www.projekt01.ch
Langackerstrasse 8
6330 Cham
phone +41 (0)41 781 01 78
mobile+41 (0)79 340 52 32
fax   +41 (0)41 781 00 78
email [EMAIL PROTECTED]
_
END OF MESSAGE 

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