Re: [Zope3-Users] Zope 3 and menus

2007-03-14 Thread eXt
Dnia wtorek, 13 marca 2007 15:12, Tom Gross napisał:
 Hi there,
 
 I override BrowserMenu from zope.app.publisher.browser.menu and add 
 a entry 'abs_action' to the resulting dictionary.
Nice solution. Thanks a lot!


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


[Zope3-Users] keeping GET data in a formlib based form

2007-03-14 Thread Lorenzo Gil Sanchez
Hi everybody,

I have a formlib based form. It is not accesible from an application
menu because it is part of a wizard like process.

The first time it gets called the url looks something like this:

http://localhost:8080/myapp/mycontent/myform?myarg=23

So in the update() method of the form I read the myarg argument from the
request and use it to setup some widgets in a particular way.

The problem is that when the action buttons of the form are clicked, and
the form is reloaded, the 'myarg' argument is lost and I run into
problems.

I need a way to keep 'myarg' information in my form for subsequent
calls. Ideally I would like some mechanism that ends writing an input
type=hidden id=myarg value=23/ tag in the html because that way
my code:

def update(self):
  [..]
  data = self.request['myarg']
  [..]

will still work, right?

I have thought about extending the formlib template to just do that or
maybe adding a form.Field to my form with a special Widget associated to
it. No idea of what's the best aproach.

Anyone has pointer for this?

thanks

Lorenzo Gil

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


Re: [Zope3-Users] correct display of Text field in a view

2007-03-14 Thread Ivan Horvath

Darryl, Frank,

thank you your answers, but finally i keep the widget solution
instead of TextAreaWidget i inherited my widget from DisplayWidget, and 
of course used your replace solution.


class IMultiLineText(IText):
   this field will be used for the comment because of the correct 
display of html tags
 
   pass


class MultiLineText(Text):
   the field implementation
   implements(IMultiLineText)
  
class MultiLineTextWidget(DisplayWidget):

   the widget to display the description

   def __call__(self):
   return super(MultiLineTextWidget, 
self).__call__().replace(\n,br \)




Darryl Cousins wrote:

On Fri, 2007-03-09 at 10:06 +0100, Ivan Horvath wrote:
  
- modify the description widget data with 
PlainTextToHTMLRenderer.render(), but then in the browser i can see
only 
encoded chars instead of br 



Hi,

As for Frank's suggestion try:

p tal:content=structure view/description /

when rendering the text2html content. That should allow the html tags
through.

Regards,
Darryl



  


--

Best Regards,

Iván Horváth
Chief Programmer

/Anyone who has never made a mistake has never tried anything new./

/

/Albert Einstein/

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


Re[2]: [Zope3-Users] correct display of Text field in a view

2007-03-14 Thread Adam Groszer
Hello Ivan,

I don't think that you'll need IMultiLineText and MultiLineText.
That's why IText and Text are there for. You'll have to register the
widget for IText or use it directly in your view with
CustomWidgetFactory.

In fact it's a good question why Z3 doesn't provide such a widget for
Text. The current widget is just Displaywidget which eats the
newlines.

BTW: br \ should be br /

Wednesday, March 14, 2007, 9:30:19 AM, you wrote:

 Darryl, Frank,

 thank you your answers, but finally i keep the widget solution
 instead of TextAreaWidget i inherited my widget from DisplayWidget, and
 of course used your replace solution.

 class IMultiLineText(IText):
 this field will be used for the comment because of the correct 
 display of html tags
   
 pass

 class MultiLineText(Text):
 the field implementation
 implements(IMultiLineText)

 class MultiLineTextWidget(DisplayWidget):
 the widget to display the description

 def __call__(self):
 return super(MultiLineTextWidget, 
 self).__call__().replace(\n,br \)



 Darryl Cousins wrote:
 On Fri, 2007-03-09 at 10:06 +0100, Ivan Horvath wrote:
   
 - modify the description widget data with 
 PlainTextToHTMLRenderer.render(), but then in the browser i can see
 only 
 encoded chars instead of br 
 

 Hi,

 As for Frank's suggestion try:

 p tal:content=structure view/description /

 when rendering the text2html content. That should allow the html tags
 through.

 Regards,
 Darryl



   




-- 
Best regards,
 Adammailto:[EMAIL PROTECTED]

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


Re: [Zope3-Users] keeping GET data in a formlib based form

2007-03-14 Thread Maciej Wisniowski

 I need a way to keep 'myarg' information in my form for subsequent
 calls. Ideally I would like some mechanism that ends writing an input
 type=hidden id=myarg value=23/ tag in the html because that way
 my code:

 def update(self):
   [..]
   data = self.request['myarg']
   [..]

 will still work, right?

 I have thought about extending the formlib template to just do that or
 maybe adding a form.Field to my form with a special Widget associated to
 it. No idea of what's the best aproach.

 Anyone has pointer for this?
Maybe the simplest solution is to use session for storing this data,
eg.:

in update you check if there is 'myarg' in request, and if so then
put this into session. If there is no 'myarg' in request
you get this from session.

If you want this passed via POST/GET then you may try with
hidden() method of widgets, or write own widget that
renders as a hidden input, like:

class EntryWidget(SimpleInputWidget):   
   
def _toFieldValue(self, input):
return unicode(input)   
   
def __call__(self):
return self.hidden()

and assign this widget to field that will represent 'myarg':

self.form_fields['myarg'].custom_widget=EntryWidget

You will possibly have to change the line:
data = self.request['myarg']

because your input will have form prefix.
I'm not sure, but you may have some issues with this solution
when doing resetForm etc.

-- 
Maciej Wisniowski

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


[Zope3-Users] Formlib and action conditions

2007-03-14 Thread Daniel Nouri
Currently, when you have a condition on an action, and it is satisfied on
render time, you'll get a button.  However, if you click that button and the
condition happens to be false in the subsequent request, the action will not
be executed, with no error message or notice.

Is this intended?


Daniel

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


[Zope3-Users] Re: [Zope3-dev] Community opinion about workflow engine

2007-03-14 Thread Philipp von Weitershausen

Stephan Richter wrote:

class Application(Contained, Persistent):
...
@apply
def stati():
See IApplication
def getStati(self):
return self._stati
def setStati(self, value):
removed = set(self._stati) - set(value)
added = set(value) - set(self._stati)
self._stati = tuple(value)
for item in removed:
zope.event.notify(StatusRemovedEvent(self, item))
for item in added:
zope.event.notify(StatusAddedEvent(self, item))
return property(getStati, setStati)


Apart from the quite confusing spelling of this property (I suggest 
something like http://cheeseshop.python.org/pypi/rwproperty for better 
readability), I just wanted to point out that stati is an incorrect 
Latin plural for status. The plural is simply status (the u being 
long in the plural, as opposed to being short in the singular). But as 
far as I know, the only accepted plural form in English is statuses.



--
http://worldcookery.com -- Professional Zope documentation and training

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


Re: [Zope3-Users] Community opinion about search+filter

2007-03-14 Thread Christophe Combelles

Adam Groszer a écrit :

Hello,

I'd like to ask your opinion, your experiences about searching and
filtering in quite large object DBs.
We need to add search and filter functions to our current app, where
the user might be able to create quite _sophisticated_ filter criterias.
(The app is a pure Z3 app, subject is document management)

Currently we're looking at something based on catalog/indexes.
As I checked the most comfortable solution would be based on
hurry.query.
Some questions arose:
- Is it necessary/worth adding indexes on all attributes?


it depends on what you need to search. You may want to index everything as a 
whole in each object, in which case you just need one index, based on an 
adapter's getsearchabletext method that returns some kind of concatenation of 
all attributes;
or you may want to be able to search in one particular attribute, so you have to 
create an index for this particular attribute.

The most important is deciding how is built the indices.
But I think there is no problem changing the indexation method, since reindexing 
is just a matter of clicking on a button, and waiting a some time.



- How does the index perform on modification and retrieval?


not sure to understand the question.

Christophe



The biggest problem is that this will be our first try, so we're
missing experiences and are a bit puzzled about the right solution.
Certain is that moving to RDB is not an option.

Thanks,



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


[Zope3-Users] Community opinion about search+filter

2007-03-14 Thread Adam Groszer
Hello,

I'd like to ask your opinion, your experiences about searching and
filtering in quite large object DBs.
We need to add search and filter functions to our current app, where
the user might be able to create quite _sophisticated_ filter criterias.
(The app is a pure Z3 app, subject is document management)

Currently we're looking at something based on catalog/indexes.
As I checked the most comfortable solution would be based on
hurry.query.
Some questions arose:
- Is it necessary/worth adding indexes on all attributes?
- How does the index perform on modification and retrieval?

The biggest problem is that this will be our first try, so we're
missing experiences and are a bit puzzled about the right solution.
Certain is that moving to RDB is not an option.

Thanks,

-- 
Best regards,
 Adam  mailto:[EMAIL PROTECTED]

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


[Zope3-Users] formlib with no zodb

2007-03-14 Thread tyson
Is it possible to build a page with formlib, widgets, and a page 
template without using the ZODB or ZMI.  I have been trying for awhile 
to accomplish this with no luck.  I want to build an edit form that 
shows results from a postgresql database which does not add any objects 
within the zodb.  If anyone can help or has any examples I would really 
appreciate it. 


--
Tyson Wenger
Computer Programmer
VL Tool,Inc.

2021 MacArthur Rd.
Waukesha, WI 53188
(262)547-1226 x178

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


[Zope3-Users] i18n question

2007-03-14 Thread Dominique Lederer
i have a viewlet where this method resides:

def title(self):
from zope.i18nmessageid import MessageFactory
_ = MessageFactory('my_domain')
return _(self.__name__)

the pagetemplates for the viewlet renders the title like
p tal:content=view/title /

the templates renders without errors, but if i use i18nextract to get the
message catalog, my title(s) never get cataloged.

what am i missing?

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


Re: [Zope3-Users] i18n question

2007-03-14 Thread Dominique Lederer
Dominique Lederer schrieb:
 i have a viewlet where this method resides:
 
 def title(self):
   from zope.i18nmessageid import MessageFactory
   _ = MessageFactory('my_domain')
   return _(self.__name__)
 
 the pagetemplates for the viewlet renders the title like
 p tal:content=view/title /
 
 the templates renders without errors, but if i use i18nextract to get the
 message catalog, my title(s) never get cataloged.
 
 what am i missing?

i just tried a bit more, so i guess the problem is, that self.__name__ is in my
case dynamically filled.

is the only way there to add these entries by hand to the .mo file, or are there
other approaches to this?

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


Re: [Zope3-Users] formlib with no zodb

2007-03-14 Thread Kapil Thangavelu


you don't need anything special.. if you have orm mapped objects just  
write formlib forms for them, with a custom traversal to retrieve. if your  
doing sql by hand, then just write adapters for the form context that  
update the relevant rdb data.


as an example, alchemist constructs formlib forms that work against  
objects mapped from a relational database with no zodb footprint. its all  
z3 tech, but its targeting deployment for plone/z2.


http://svn.objectrealms.net/view/public/browser/Products.alchemist/trunk/browser/

hth,

kapil

On Wed, 14 Mar 2007 10:23:53 -0400, tyson [EMAIL PROTECTED] wrote:

Is it possible to build a page with formlib, widgets, and a page  
template without using the ZODB or ZMI.  I have been trying for awhile  
to accomplish this with no luck.  I want to build an edit form that  
shows results from a postgresql database which does not add any objects  
within the zodb.  If anyone can help or has any examples I would really  
appreciate it.



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


[Zope3-Users] object hierarchy

2007-03-14 Thread Ivan Horvath

Dear All,

i'm really new to zope, but i have learning application, where the
object stru is little bit complex.

App
 |
 + Categories
   |
   +--Categ1
|
+Type1
  |
  +-Article1
 |
 +--Article2
+-Type2

   +--Categ2
+- Administration
etc

i could manage the administration part and in the categories container
i can add new category objects.
but i cannot add into a category object a type container.
i don't really know how to define an interface which is contained and
container too.

thanks in advance

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


Re: [Zope3-Users] object hierarchy

2007-03-14 Thread FB
On Wed, Mar 14, 2007 at 04:35:53PM +0100, Ivan Horvath wrote:
 Dear All,
 
 i'm really new to zope, but i have learning application, where the
 object stru is little bit complex.
 
 App
  |
  + Categories
|
+--Categ1
 |
 +Type1
   |
   +-Article1
  |
  +--Article2
 +-Type2
 
+--Categ2
 +- Administration
 etc
 
 i could manage the administration part and in the categories container
 i can add new category objects.
 but i cannot add into a category object a type container.
 i don't really know how to define an interface which is contained and
 container too.

I'm not sure, if I understand your problem correctly. It's possible to
define a set of valid subobjects for each interface:

class IType(IContainer):
   pass

class ICategory(IContainer):
   contains(IType)

class ICategoryContainer(IContainer):
   contains(IType)

[...]

class Type(BTreeContainer):
   implements(IType)

class Category(BTreeContainer):
   implements(ICategory)

class CategoryContainer(BTreeContainer):
   implements(ICategoryContainer)

There's nothing special about those kind of constraint-trees. Now I'm
guessing: did you forget to specify a browser:containerViews and a
browser:addMenuItem ZCML-directive per class?

Regards,

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


Re: [Zope3-Users] object hierarchy

2007-03-14 Thread Ivan Horvath

Dear Frank,

i think i did something similar
first to define the category container, and contained
and this is working fine, i can add new category objects into the
category container.

i have problem with the next level, whereas the category, which is
contained from the category point of view, but it is a container from
the type point of view.
how can i define this ?

On 3/14/07, FB [EMAIL PROTECTED] wrote:

On Wed, Mar 14, 2007 at 04:35:53PM +0100, Ivan Horvath wrote:
 Dear All,

 i'm really new to zope, but i have learning application, where the
 object stru is little bit complex.

 App
  |
  + Categories
|
+--Categ1
 |
 +Type1
   |
   +-Article1
  |
  +--Article2
 +-Type2

+--Categ2
 +- Administration
 etc

 i could manage the administration part and in the categories container
 i can add new category objects.
 but i cannot add into a category object a type container.
 i don't really know how to define an interface which is contained and
 container too.

I'm not sure, if I understand your problem correctly. It's possible to
define a set of valid subobjects for each interface:

class IType(IContainer):
   pass

class ICategory(IContainer):
   contains(IType)

class ICategoryContainer(IContainer):
   contains(IType)

[...]

class Type(BTreeContainer):
   implements(IType)

class Category(BTreeContainer):
   implements(ICategory)

class CategoryContainer(BTreeContainer):
   implements(ICategoryContainer)

There's nothing special about those kind of constraint-trees. Now I'm
guessing: did you forget to specify a browser:containerViews and a
browser:addMenuItem ZCML-directive per class?

Regards,

Frank
___
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] imports cleanup

2007-03-14 Thread Christophe Combelles

Hello,

As I'm experimenting with various components, I'm adding more and more imports 
in the beginning of the python files, but at the end, most of them are unused.


Is there a tool or a method to automatically clean or detect unused imports ?

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


Re: [Zope3-Users] imports cleanup

2007-03-14 Thread Albertas Agejevas
On Thu, Mar 15, 2007 at 01:52:51AM +0100, Christophe Combelles wrote:
 As I'm experimenting with various components, I'm adding more and more 
 imports in the beginning of the python files, but at the end, most of them 
 are unused.
 
 Is there a tool or a method to automatically clean or detect unused imports 
 ?

Well, people have been using tools like that to clean up Zope 3 itself
in the past.  Googling for 'python import checker' finds at least two
tools that should do the job: PyChecker, python-import-check.

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