Re: [Zope3-Users] Overriding formlib field size
On 2/17/06, Brett Haydon <[EMAIL PROTECTED]> wrote: > I am just starting with zope 3.2 and am using the zope.formlib to generate a > simple form. Where and how do I override the presentation aspect of > the input field length in html. > e.g. size="20" > name="form.full_name" size="20" type="text" value="Brett Haydon" /> Perhaps the easiest way is to extend setUpWidgets(): class MyForm(zope.formlib.form.PageForm): form_fields = ... def setUpWidgets(self, ignore_request=False): super(MyForm, self).setUpWidgets(ignore_request=ignore_request) self.widgets['somefield'].displayWidth = 40 -Fred -- Fred L. Drake, Jr. "There is no wealth but life." --John Ruskin ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Overriding formlib field size
Hi, I am just starting with zope 3.2 and am using the zope.formlib to generate a simple form. Where and how do I override the presentation aspect of the input field length in html. e.g. size="20" Thanks in advance, Brett ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
RE: [Zope3-Users] question: can I make a view trusted: A BUG
Ok everyone: it is a zope bug. The following should be included in zope.app.schema.fields.zcml: PS -- Jim -- I sent in my contributor form almost two weeks ago? Have you received it yet? I'd be happy to put this in myself, if I could. - Shaun ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
RE: [Zope3-Users] question: can I make a view trusted?
Ah, Here's something to note: When I print out the schema objects just before attempting to access their titles, I get: --- 2006-02-16T23:20:35 ERROR SiteError... --- In other words, I have no problem accessing the fields of the schema objects that are defined in _bootstrapfields, but I get an error when I access Date, which lives in _field! I defer to those who know more, but whether I'm supposed to be allowed to access the title or not, the current behavior seems like a bug, as it is inconsistent. - Shaun Cutts ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] question: can I make a view trusted?
I'd be grateful for an answer to the following: I have a container class that displays rows from a database. I have a default view for those containers that I want to have display a table of rows with column headers being the titles of the fields in the interface supported by the contained objects support. My container has a class variable "containedInterface" which can be specialized to subclasses to specify the interface to the rows of the contained object. In the view, I have the following code to get the column names: def getColumnNames( self ): def getNameForField( pair ): fname, fld = pair if IField.providedBy( fld ): return fld.title else: return unicode( fname ) return map( getNameForField, self.context.containedInterface.namesAndDescriptions( all = True ) ) The problem is that "fld.title" access gives me a ForbiddenAttribute error when I access the schema.Date object (as it happens). It would seem nonsensical to declare permissions on IDate in order to do this. I guess I could add an accessor to either the container or the contained object that did the dirty work, and then passed the result to the view, and declare that accessible(?). But from a design point of view, neither the container nor the contained object should be concerned with how they are displayed. That's the whole point of views, right? So I think its better not to clutter up their definitions with extra accessors. (? Again) Thus as far as I can tell, given some dubious assumptions perhaps, the only way to do this is if I somehow made the view trusted (or at least this function), so it wouldn't have to worry about the security restrictions. Is this possible? Is it a good idea? Thanks very much, - Shaun Cutts PS... perhaps I could declare the "containedInterface" itself to be content? I'm going to try fiddling around with that, but I'm sending this message anyway, because even if that works, it seems too strange to be the right solution, and surely this is a common problem. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Making content into a resource
I have content objects, i.e. images (IImage), css files (IFile) contained in a site utility to provide customisations for each site. How can I present these as resources? e.g. I'd like to locate these as mysite/++resource++some_image rather than mysite/++etc++site/tools/mytool/some_image TIA -Tom ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Recipe with default values
In chapter 5.4 of the cooking book, Philipp says: [...] We could now implement a custom factory, for example one that allows us to set initial attribute values of the recipe. (We would normally extend the Recipe class with a constructor to do that, but let us implement a factory here for demonstration purposes.) How should I write the constructor? I've tried the naive __init__ method but I must be missing something, as it doesn't get passed any argument. For instance, I'd like to have an attribute recipe.creation_date which is editable in the addform but has datetime.datetime.now() as a default value. Of course if I simply add creation_date=datetime.datetime.now() in the class definition, it gets the time once at the start. thanks for the help, the shiny release, the book and the appetizers. i'm getting hungry :-) ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Squid/Apache Caching
If you have needs for Apache, use Apache - but there is no need for it just for rewriting urls. There are plenty of ways to rewrite in Squid - and you can always write your own. See http://www.squid-cache.org/related-software.html for a list of redirectors that are available out there. Having used Squid heavily over the years, there is no need for added complexity of adding Apache in the mix unless there is something specifically you need from it. >From your description, Apache is YAGNI. Andrew Sawyers On Tue, 2006-02-14 at 23:44 +, Peter Bengtsson wrote: > 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 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Please Guido, pick me, pick me!
Hi Gary, Thanks for pointing me over there I subscribed to the list and will repost. Cheers, Pete Gary Poster wrote: On Feb 15, 2006, at 9:40 PM, Peter Simmons wrote: I haven't seen it before in the Zope 3 community but maybe we could start a thing on Fundable.org to get some money for this thing. Or would ZF be the place to approach about this? I am not really up with the play on where ZF is at and what its going to do. Anyway my company could contribute $1000 NZD (about $700 USD at the moment) to this to get the ball rolling. Should I try to organise this myself or is there already people responsible for this type of thing? This sounds fantastic to me, Peter. I think the ZF, which should easily be launched soon enough to be a part of this, certainly should be involved. I have no idea about fundable.org, and how that might interact with ZF. If you have not already been directed to the zope-web list, I understand that people are working on this there. In general, I'd suggest starting to organize and plan now, and planning to try and fit it within the ZF once it emerges. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Announcement: zsqlmap
Announcement zsqlmap-project: zsqlmap - it's Zope3-wrapper for SQLObject. i borrow idea from sqlos (http://codespeak.net/z3/sqlos) and add features. Homepage: https://code.keysolutions.ru/trac/zsqlmap/ Enjoy. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Please Guido, pick me, pick me!
On Feb 15, 2006, at 9:40 PM, Peter Simmons wrote: I haven't seen it before in the Zope 3 community but maybe we could start a thing on Fundable.org to get some money for this thing. Or would ZF be the place to approach about this? I am not really up with the play on where ZF is at and what its going to do. Anyway my company could contribute $1000 NZD (about $700 USD at the moment) to this to get the ball rolling. Should I try to organise this myself or is there already people responsible for this type of thing? This sounds fantastic to me, Peter. I think the ZF, which should easily be launched soon enough to be a part of this, certainly should be involved. I have no idea about fundable.org, and how that might interact with ZF. If you have not already been directed to the zope-web list, I understand that people are working on this there. In general, I'd suggest starting to organize and plan now, and planning to try and fit it within the ZF once it emerges. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Lists dont accept default values
On Feb 16, 2006, at 3:55 AM, Frank Burkhardt wrote: I wrote a schema like this to have a list of objects on a content object: class IMyContent(Interface): mynumbers=List( title=_(u"Cool Numbers"), required=True, value_type=Int( title=_("integer") ) default=[1,2,3,5,7] ) FWIW, I just think it's a bug that this doesn't work. Have you put it in the collector? Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] What attributes are made persistent
Peter Bengtsson wrote: 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. good try:-) but that's a totally different ethymology, "to mute" is to make silent, to tone down ("muet" in French) "mutate" c.1374, "action of changing," from L. mutationem (nom. mutatio) http://www.etymonline.com/index.php?search=mutate /JM ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] What attributes are made persistent
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] Re: Zope 3 Developer's LiveBook
Fred Drake wrote: 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. Indeed, but I'm guessing there's maybe a script that can be run to turn OpenDocument into DocBook and vice versa? 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
Re: [Zope3-Users] What attributes are made persistent
Peter Bengtsson wrote: 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. PersistentX classes also usually subclass Persistent which means they get their own pickle jar. This can slow ZODB growth if you have lots of "big" attributes but where only one of them regularly changes: make the changing one a PersistentWhatever instance. 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
Re: [Zope3-Users] Lists dont accept default values
Hi, On Wed, Feb 15, 2006 at 06:18:48PM +0100, Florian Lindner wrote: [snip] > > I wrote a schema like this to have a list of objects on a content object: > > > > class IMyContent(Interface): > > mynumbers=List( > >title=_(u"Cool 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. No it doesn't. default=1 generates this error: ConfigurationError: ('Invalid value for', 'mynumbers', "(1, )") > 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. I don't really need Int as list items but some more complex objects. This works quite well - except of the missing default. Regards, Frank ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] How to get started?
Dear Zope 3 users and developers I have been using Zope 2 in the past and was very enthusiastic about the Zope 3.0 release some time ago. Therefore, I bought both books by Stephan and Philipp. Unfortunately, I didn't have the time to actually start developing. But now, a colleague of mine does have time and interest to get started with a Web interface to our Spyse system (http://spyse.sf.net/). BUT I read on this list that the books that cover Zope 3.0 are outdated for the current 3.2 release. How should one get started now? Use the books with 3.0 and try to upgrade later? Try to figure out what changed while learning from the books? Where is up to date easily readable information about the changes and their impact on "old" code and the books? Will we see updated and documented sample code soon? thanks for your help André ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users