[Zope] how to do this?

2007-03-15 Thread javi lopez

Hello everyone and thaks for your help:

I have this things:
Zdatabase Conection
zsql method
Controller page template(form)
Controller python script(call zsql method)
controller validator
page template

it´s a form, it stores email and comments in database and it works. I
need put all this inside a product i did,  and when I have to push a
button from a page template (of the product), show me the form, i fill
in it, and it stores data in db.
Can i do it?Can you help me please?Thanks
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-21 Thread Garito

Dieter Maurer escribió:

Garito wrote at 2006-10-20 14:20 +0200:
  

Dieter Maurer escribió:


You remember I have warned you: __getattr__ is difficult and error prone!

   Even me, I have spend hours to understand why I get occasional
   __getattr__ infinite loops...
   And I know, in principle, all the potential caveats...

  
  
Can you point me to some example/product to try to avoid this kind of 
errors?



It is quite difficult to learn all kinds of problems from an example.

I think I already have publicly described my __getattr__ problems.
Thus, you can search the mailing list archive...

An example product where __getattr__ is used is BTreeFolder2.


  

Thank you! I'll try and I will be back with new questions!!

--
Mis Cosas
http://blogs.sistes.net/Garito


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-20 Thread Chris Withers

Garito wrote:
Sure, but I don't need only localization, I need to preprocess the 
properties before read them


I'm afraid your entire approach is likely to end you in a world of pain...

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-20 Thread Garito

Dieter Maurer escribió:

Garito wrote at 2006-10-18 20:27 +0200:
  


How can I create an accessor to read (not to write) and preprocess all 
properties?



If you are only willing to write a single method that should do for
all properties, then you will need to use __getattr__.


You remember I have warned you: __getattr__ is difficult and error prone!

   Even me, I have spend hours to understand why I get occasional
   __getattr__ infinite loops...
   And I know, in principle, all the potential caveats...

  
Can you point me to some example/product to try to avoid this kind of 
errors?

Thanks a lot!

--
Mis Cosas
http://blogs.sistes.net/Garito


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-20 Thread Andreas Jung



--On 20. Oktober 2006 14:20:51 +0200 Garito [EMAIL PROTECTED] wrote:



   And I know, in principle, all the potential caveats...



Can you point me to some example/product to try to avoid this kind of
errors?



You got already multiple useful advices how to proceed. Take one!
Follow the road that almost all reasonable Zope developers would use:
write your own accessor  methods or use ComputedAttribute or
work with Python properties. But you should forget your (weird) idea.
Get it out of your head. Now!

-aj

pgpMBeIHKADVd.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-20 Thread Garito

Andreas Jung escribió:



--On 20. Oktober 2006 14:20:51 +0200 Garito [EMAIL PROTECTED] wrote:



   And I know, in principle, all the potential caveats...



Can you point me to some example/product to try to avoid this kind of
errors?



You got already multiple useful advices how to proceed. Take one!
Follow the road that almost all reasonable Zope developers would use:
write your own accessor  methods or use ComputedAttribute or
work with Python properties. But you should forget your (weird) idea.
Get it out of your head. Now!

-aj

Sorry but you don't know the whole project
If there are a test to do I'll do it because I need to evaluate if Zope 
is my solution or not


There are things on Zope that I like a lot but there are things I don't

If Zope is not my solution I need to found the right solution

No weird anything: Zope could do the work or not, easy, don't you thing so?

Perhaps Zope 3?

I don't know (I'm asking to you)

But, please, don't tell me to forget my idea is like if I tell you what 
I think about the things I don't like about Zope and the I says: Zopers, 
forget Zope because I don't like ZClass or DTML


Sorry again (for my expressions fault)

--
Mis Cosas
http://blogs.sistes.net/Garito


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-20 Thread Andreas Jung



--On 20. Oktober 2006 14:41:58 +0200 Garito [EMAIL PROTECTED] wrote:


-aj

Sorry but you don't know the whole project


No project can be as scary as your requirements of your original posting :-)


If there are a test to do I'll do it because I need to evaluate if Zope
is my solution or not


Zope and Python are likely a prefect choice to your (unknown) problem but
you need to understand some basic principles of both.



But, please, don't tell me to forget my idea is like if I tell you what I
think about the things I don't like about Zope and the I says: Zopers,
forget Zope because I don't like ZClass or DTML



So why don't you follow the standard way? Dieter pointed you using
__getattr__() but I doubt that it is the right choice for you because you
with your small Python background you will definitely run into problems
that will be hard for you to be resolved on your own. So take the common 
road. This is less painful.


-aj

pgpPW2uTs7mgF.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-20 Thread Garito

Andreas Jung escribió:



--On 20. Oktober 2006 14:41:58 +0200 Garito [EMAIL PROTECTED] wrote:


-aj

Sorry but you don't know the whole project


No project can be as scary as your requirements of your original 
posting :-)



If there are a test to do I'll do it because I need to evaluate if Zope
is my solution or not


Zope and Python are likely a prefect choice to your (unknown) problem but
you need to understand some basic principles of both.


But, please, don't tell me to forget my idea is like if I tell you 
what I

think about the things I don't like about Zope and the I says: Zopers,
forget Zope because I don't like ZClass or DTML



So why don't you follow the standard way? Dieter pointed you using
__getattr__() but I doubt that it is the right choice for you because you
with your small Python background you will definitely run into problems
that will be hard for you to be resolved on your own. So take the 
common road. This is less painful.


-aj
I agree with you: my Python background is uncompleted but I'll learn 
Python/Zope as deep as I need to create the product I'm looking for


There are some Zope standard ways to do the job but my experience tells 
me to avoid some programmers responsability because programmers make 
mistakes (I know it because I make mistakes ;-) )


The requieriment of my product is to be simple to use even if the 
morphology of this product is a little hard or weird


The simplest way is to implement the general accessor as I thing but I 
don't know if Zope do it possible


If not I can find another way to do the same but the accessor way seems 
the *simplest* one


I try to find the mother cell to describe *every* entity. Is that goal 
what is weird but, boys, weird problems wants weird solutions


Perhaps new ways begins as weird projects

If you thing __getattr__ will be the solutions perhaps I could try it 
but if you point me to avoid the recursive problems I could do the job


Can you point me to a product or a paper to understand the __getattr__ 
problems?


Thanks!

--
Mis Cosas
http://blogs.sistes.net/Garito


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-20 Thread Andreas Jung



--On 20. Oktober 2006 15:08:26 +0200 Garito [EMAIL PROTECTED] wrote:


If you thing __getattr__ will be the solutions perhaps I could try it but
if you point me to avoid the recursive problems I could do the job

Can you point me to a product or a paper to understand the __getattr__
problems?



Dieter told you already that you will into infinite recursions when 
accessing attrs of the same instance within __getattr__(). You should be 
able to find about related threads by using Google. I hope you can extract 
the magic Google words from this thread.


-aj

pgpfJBYrkyLwT.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-20 Thread Garito

Andreas Jung escribió:



--On 20. Oktober 2006 15:08:26 +0200 Garito [EMAIL PROTECTED] wrote:


If you thing __getattr__ will be the solutions perhaps I could try it 
but

if you point me to avoid the recursive problems I could do the job

Can you point me to a product or a paper to understand the __getattr__
problems?



Dieter told you already that you will into infinite recursions when 
accessing attrs of the same instance within __getattr__(). You should 
be able to find about related threads by using Google. I hope you can 
extract the magic Google words from this thread.


-aj

A, ok! Sure

I'll search at google and I'll be back with more explicit questions

Thanks a lot!

--
Mis Cosas
http://blogs.sistes.net/Garito


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-20 Thread Dieter Maurer
Garito wrote at 2006-10-20 14:20 +0200:
Dieter Maurer escribió:
 You remember I have warned you: __getattr__ is difficult and error prone!

Even me, I have spend hours to understand why I get occasional
__getattr__ infinite loops...
And I know, in principle, all the potential caveats...

   
Can you point me to some example/product to try to avoid this kind of 
errors?

It is quite difficult to learn all kinds of problems from an example.

I think I already have publicly described my __getattr__ problems.
Thus, you can search the mailing list archive...

An example product where __getattr__ is used is BTreeFolder2.


-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-19 Thread Chris Withers

Garito wrote:

object.Property2 and retrieve the data with the current locale

For spanish locale I would like to retrieve 18-10-2006


Rather than torturing yourself with all this weirdness, maybe you should 
look at using Zope 3's locale support in your app, whether it's zope 2 
or zope 3...


cheers,

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-19 Thread Garito

Chris Withers escribió:

Garito wrote:

object.Property2 and retrieve the data with the current locale

For spanish locale I would like to retrieve 18-10-2006


Rather than torturing yourself with all this weirdness, maybe you 
should look at using Zope 3's locale support in your app, whether it's 
zope 2 or zope 3...


cheers,

Chris

Sure, but I don't need only localization, I need to preprocess the 
properties before read them


Is this possible?

--
Mis Cosas
http://blogs.sistes.net/Garito


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-19 Thread Jonathan


- Original Message - 
From: Garito [EMAIL PROTECTED]

To: Chris Withers [EMAIL PROTECTED]
Cc: Lista Zope Internacional zope@zope.org
Sent: Thursday, October 19, 2006 8:46 AM
Subject: Re: [Zope] How to do...



Chris Withers escribió:

Garito wrote:

object.Property2 and retrieve the data with the current locale

For spanish locale I would like to retrieve 18-10-2006


Rather than torturing yourself with all this weirdness, maybe you should 
look at using Zope 3's locale support in your app, whether it's zope 2 or 
zope 3...


cheers,

Chris

Sure, but I don't need only localization, I need to preprocess the 
properties before read them


Is this possible?


I am not sure what you mean when you say you want to preprocess the 
properties before reading them.  There are 2 possible cases (that I can 
think of) in which preprocessing could occur:


1) in response to a user request, you access the stored data, process the 
data, then display the data.  However, you are still 'reading' the data 
before you can process it.


2) you need to process stored data as a result of some external or timed 
event (ie. not in response to a user request).  In this case you use 
cron/wget/stepper/etc. to activate a routine which accesses the stored data, 
processes the data, saves the data (either overwriting the old data or 
creating a new data element).  However, you are still 'reading' the data 
before you can process it.


Before you can process data you need to 'read' (access) the data.  If you 
mean something different when you say 'read' let us know, it may eliminate 
some confusion!


Jonathan 



___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-19 Thread Dieter Maurer
Garito wrote at 2006-10-18 20:27 +0200:
 
How can I create an accessor to read (not to write) and preprocess all 
properties?

If you are only willing to write a single method that should do for
all properties, then you will need to use __getattr__.


You remember I have warned you: __getattr__ is difficult and error prone!

   Even me, I have spend hours to understand why I get occasional
   __getattr__ infinite loops...
   And I know, in principle, all the potential caveats...

-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] How to do...

2006-10-18 Thread Garito

Hi all!

How can I control the way an attribute of a product is readed? 
__getattr__? __getattribute__?


I try the __getattribute__ way but it modifies the property pages

Example:

I create an object instance of the product and like:

Property1 = 'Some text'
Property2 = 2006-10-18

I would like to call Property2 like

object.Property2 and retrieve the data with the current locale

For spanish locale I would like to retrieve 18-10-2006

But if I read the property pages of this object I would like to conserve 
the given data


Is this possible?

Thanks!

--
Mis Cosas
http://blogs.sistes.net/Garito


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-18 Thread Andreas Jung



--On 18. Oktober 2006 16:15:37 +0200 Garito [EMAIL PROTECTED] wrote:


Hi all!

How can I control the way an attribute of a product is readed?
__getattr__? __getattribute__?

I try the __getattribute__ way but it modifies the property pages

Example:

I create an object instance of the product and like:

Property1 = 'Some text'
Property2 = 2006-10-18

I would like to call Property2 like

object.Property2 and retrieve the data with the current locale


Don't do that. Make a clear separation between the storage layer and any 
kind of presentation issues. If you need your internal data represented in 
a fancy way, write a dedicated accessor method and use this one inside your 
templates (or whatever) instead of accessing the data directly.


-aj


pgpT0b4D9f9Xi.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-18 Thread Jonathan


- Original Message - 
From: Garito [EMAIL PROTECTED]

To: Lista Zope Internacional zope@zope.org
Sent: Wednesday, October 18, 2006 10:15 AM
Subject: [Zope] How to do...



Hi all!

How can I control the way an attribute of a product is readed? 
__getattr__? __getattribute__?


I try the __getattribute__ way but it modifies the property pages

Example:

I create an object instance of the product and like:

Property1 = 'Some text'
Property2 = 2006-10-18

I would like to call Property2 like

object.Property2 and retrieve the data with the current locale

For spanish locale I would like to retrieve 18-10-2006

But if I read the property pages of this object I would like to conserve 
the given data


Is this possible?


Reading/displaying stored data should not change the stored data!  You 
should determine what internal data storage format you want and keep it 
consistent.  When you retrieve data for presentation/display you can 
reformat the data prior to display (eg. for localization), but you should 
not overwrite the stored data with the new format (this will cause you 
serious difficulties as your data 'reading' routines will never know what 
format the data is stored in - unless you also store some formatting 
information, but in most cases this is a bad idea!)


Jonathan 



___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-18 Thread Garito

Andreas Jung escribió:



--On 18. Oktober 2006 16:15:37 +0200 Garito [EMAIL PROTECTED] wrote:


Hi all!

How can I control the way an attribute of a product is readed?
__getattr__? __getattribute__?

I try the __getattribute__ way but it modifies the property pages

Example:

I create an object instance of the product and like:

Property1 = 'Some text'
Property2 = 2006-10-18

I would like to call Property2 like

object.Property2 and retrieve the data with the current locale


Don't do that. Make a clear separation between the storage layer and 
any kind of presentation issues. If you need your internal data 
represented in a fancy way, write a dedicated accessor method and use 
this one inside your templates (or whatever) instead of accessing the 
data directly.


-aj

Then I can't create a property that stores a tal expression for example?

I would like to write things like:

object.property = 'here/anotherproperty'
object.anotherproperty = 'Barcelona'

and ask it like:

print object.property - 'Barcelona'

or

tal:city tal:replace='here/property' / - 'Barcelona'

Is this possible?

Thanks!!!

--
Mis Cosas
http://blogs.sistes.net/Garito


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-18 Thread Andreas Jung



--On 18. Oktober 2006 18:53:05 +0200 Garito [EMAIL PROTECTED] wrote:


Andreas Jung escribió:



--On 18. Oktober 2006 16:15:37 +0200 Garito [EMAIL PROTECTED] wrote:


Hi all!

How can I control the way an attribute of a product is readed?
__getattr__? __getattribute__?

I try the __getattribute__ way but it modifies the property pages

Example:

I create an object instance of the product and like:

Property1 = 'Some text'
Property2 = 2006-10-18

I would like to call Property2 like

object.Property2 and retrieve the data with the current locale


Don't do that. Make a clear separation between the storage layer and
any kind of presentation issues. If you need your internal data
represented in a fancy way, write a dedicated accessor method and use
this one inside your templates (or whatever) instead of accessing the
data directly.

-aj

Then I can't create a property that stores a tal expression for example?

I would like to write things like:

object.property = 'here/anotherproperty'
object.anotherproperty = 'Barcelona'

and ask it like:

print object.property - 'Barcelona'

or

tal:city tal:replace='here/property' / - 'Barcelona'



This posting is totally weird. Sorry, but I have really no idea
what you're trying to do. It makes absolutely no sense.

-aj



pgpuAUwWVj1Fl.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-18 Thread Garito

Andreas Jung escribió:



--On 18. Oktober 2006 18:53:05 +0200 Garito [EMAIL PROTECTED] wrote:


Andreas Jung escribió:



--On 18. Oktober 2006 16:15:37 +0200 Garito [EMAIL PROTECTED] wrote:


Hi all!

How can I control the way an attribute of a product is readed?
__getattr__? __getattribute__?

I try the __getattribute__ way but it modifies the property pages

Example:

I create an object instance of the product and like:

Property1 = 'Some text'
Property2 = 2006-10-18

I would like to call Property2 like

object.Property2 and retrieve the data with the current locale


Don't do that. Make a clear separation between the storage layer and
any kind of presentation issues. If you need your internal data
represented in a fancy way, write a dedicated accessor method and use
this one inside your templates (or whatever) instead of accessing the
data directly.

-aj

Then I can't create a property that stores a tal expression for example?

I would like to write things like:

object.property = 'here/anotherproperty'
object.anotherproperty = 'Barcelona'

and ask it like:

print object.property - 'Barcelona'

or

tal:city tal:replace='here/property' / - 'Barcelona'



This posting is totally weird. Sorry, but I have really no idea
what you're trying to do. It makes absolutely no sense.

-aj


I only try to create a model but I'm searching the best way to create it

I try to create properties like this is (in the last example):

object.property is like object.anotherproperty

Is this possible?

--
Mis Cosas
http://blogs.sistes.net/Garito


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-18 Thread Jens Vagelpohl

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On 18 Oct 2006, at 12:53, Garito wrote:
Then I can't create a property that stores a tal expression for  
example?


I would like to write things like:

object.property = 'here/anotherproperty'
object.anotherproperty = 'Barcelona'

and ask it like:

print object.property - 'Barcelona'

or

tal:city tal:replace='here/property' / - 'Barcelona'


Google for ComputedAttribute.

jens


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFFNmNuRAx5nvEhZLIRAkRcAJ4lfb9YMZGCgMnyhwokS9b9JocsEQCdEMh1
FSIjkr9Ijvr6LpR1vIPXrHI=
=ugZY
-END PGP SIGNATURE-
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-18 Thread Andreas Jung



--On 18. Oktober 2006 19:17:42 +0200 Garito [EMAIL PROTECTED] wrote:


I only try to create a model but I'm searching the best way to create it


I try to create properties like this is (in the last example):

object.property is like object.anotherproperty



You got already multiple advices. Write a method anotherproperty() and
do whatever you like with in this method. You can call it from
TALES as here/anotherproperty. TALES bascially deals with attributes
and methods in the same way.

-aj

pgpQEhmY3CKov.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-18 Thread Garito

Andreas Jung escribió:



--On 18. Oktober 2006 19:17:42 +0200 Garito [EMAIL PROTECTED] wrote:

I only try to create a model but I'm searching the best way to 
create it


I try to create properties like this is (in the last example):

object.property is like object.anotherproperty



You got already multiple advices. Write a method anotherproperty() and
do whatever you like with in this method. You can call it from
TALES as here/anotherproperty. TALES bascially deals with attributes
and methods in the same way.

-aj
Sure! But I need to write a method for every like property but I would 
like (if is possible) a way to evaluate if a property is a TALES 
property automatically


Perhaps the property could begin like tal:expression

If a property begins with tal: I would like to pre-process automatically

Is this possible?

--
Mis Cosas
http://blogs.sistes.net/Garito


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-18 Thread Andreas Jung



--On 18. Oktober 2006 19:41:07 +0200 Garito [EMAIL PROTECTED] wrote:


You got already multiple advices. Write a method anotherproperty() and
do whatever you like with in this method. You can call it from
TALES as here/anotherproperty. TALES bascially deals with attributes
and methods in the same way.

-aj

Sure! But I need to write a method for every like property but I would
like (if is possible) a way to evaluate if a property is a TALES property
automatically



Do you *really*, *really*, *really* need this feature? You can of course
implement your own __getattr__() methodbut every Python programmer 
would likely slap you left and right...these are the last comments on this 
issue..

it's still to weird in my opinion.

-aj 

pgp2e2ObIyVAF.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-18 Thread Garito

Andreas Jung escribió:



--On 18. Oktober 2006 19:41:07 +0200 Garito [EMAIL PROTECTED] wrote:


You got already multiple advices. Write a method anotherproperty() 
and

do whatever you like with in this method. You can call it from
TALES as here/anotherproperty. TALES bascially deals with attributes
and methods in the same way.

-aj

Sure! But I need to write a method for every like property but I would
like (if is possible) a way to evaluate if a property is a TALES 
property

automatically



Do you *really*, *really*, *really* need this feature? You can of course
implement your own __getattr__() methodbut every Python programmer 
would likely slap you left and right...these are the last comments on 
this issue..

it's still to weird in my opinion.

-aj 
Yes I think about __getattr__() method but I don't have any idea about 
how to retrive the original property


And another question about this is if implementing __getattr__ method 
the property manager works ok or not (for me works ok if property 
manager displays the tal expression instead of the process of the expression


will __getattr_ be the method I'm looking for?

Thanks Aj and sorry for my weird questions

--
Mis Cosas
http://blogs.sistes.net/Garito


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-18 Thread Dieter Maurer
Garito wrote at 2006-10-18 16:15 +0200:
 ...
How can I control the way an attribute of a product is readed? 
__getattr__? __getattribute__?

A product is an extension mechanism for Zope. Usually, a
product does not have attributes (you are interested in).

But inside your product you may have defined classes
instances of which you place into the Zope hierarchy
(http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html
speaks about site building objects).

The standard Python way to access their attributes (__getattr__
and __getattribute__) will work but has caveats: It is *very* easy
to create infinite loops with it and their self with not be
acquisition wrapped.

The Zope specific safer way is to implement __bobo_traverse__.
Both the publisher as well as [un]restrictedTraverse (which
is internally used by TALES path expressions) use __bobo_traverse__
when defined. However, Python's getattr will not use it.



-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do...

2006-10-18 Thread Garito

Dieter Maurer escribió:

Garito wrote at 2006-10-18 16:15 +0200:
  

...
How can I control the way an attribute of a product is readed? 
__getattr__? __getattribute__?



A product is an extension mechanism for Zope. Usually, a
product does not have attributes (you are interested in).

But inside your product you may have defined classes
instances of which you place into the Zope hierarchy
(http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html
speaks about site building objects).

The standard Python way to access their attributes (__getattr__
and __getattribute__) will work but has caveats: It is *very* easy
to create infinite loops with it and their self with not be
acquisition wrapped.

The Zope specific safer way is to implement __bobo_traverse__.
Both the publisher as well as [un]restrictedTraverse (which
is internally used by TALES path expressions) use __bobo_traverse__
when defined. However, Python's getattr will not use it.



  

Hi, Dieter!

How can I create an accessor to read (not to write) and preprocess all 
properties?


Thanks!

--
Mis Cosas
http://blogs.sistes.net/Garito


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do this trick..

2006-03-28 Thread Chris Withers

Hi Jason,

I see a few people have had a stab at this, but I have a feeling I know 
what you really meant ;-)


Jason C. Leach wrote:

I'm wondering how I can do this little trick (sp_info is a globaly devide
var, it's a dictionary obj):

option tal:repeat=group groups/existing/high
tal:content=group
tal:attributes=onmouseover string:doTooltip(event,
'${sp_info/${group}/common_name}')
   onmouseout=hideTip()
/option

So based on my the value of 'group' from my repeat, I want to use the value
to look up another value in a different dictionary.  It works if I do this:
(event, '${sp_info/whatever/common_name}') but does not like me using the
embedded ${group}.


try this:

tal:i repeat=group groups/existing/high
  option tal:define=event sp_info/?group/common_name
  tal:content=group
  tal:attributes=onmouseover string:doTooltip(event,'$event')
  onmouseout=hideTip()
  /option
/tal:i

cheers,

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] How to do this trick..

2006-03-27 Thread Jason C. Leach
Hi,I'm wondering how I can do this little trick (sp_info is a globaly devide var, it's a dictionary obj): option tal:repeat=group groups/existing/high  tal:content=group
 tal:attributes=onmouseover string:doTooltip(event, '${sp_info/${group}/common_name}')  > /option
So based on my the value of 'group' from my repeat, I want to use the value to look up another value in a different dictionary. It works if I do this: (event, '${sp_info/whatever/common_name}') but does not like me using the embedded ${group}.
Thanks,Jason.--  Jason C. Leach PGP Key: 0x62DDDF75 Keyserver: gpg.mit.edu
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do this trick..

2006-03-27 Thread Ross Patterson
tal:repeat repeat=group groups/existing/high
option tal:define=js_arg python:sp_info[group];
tal:content=group
tal:attributes=onmouseover string:doTooltip(event, 
'${js_arg}/common_name}') 
onmouseout=hideTip()
/option
/tal:repeat

The tal:repeat tags are to make sure the order of TAL operations
works properly with the tal:define being done *after* the tal:repeat.
Hope this helps.

Ross
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to do this trick..

2006-03-27 Thread J Cameron Cooper

Jason C. Leach wrote:

I'm wondering how I can do this little trick (sp_info is a globaly 
devide var, it's a dictionary obj):


option tal:repeat=group groups/existing/high
tal:content=group
tal:attributes=onmouseover string:doTooltip(event, 
'${sp_info/${group}/common_name}') 
   onmouseout=hideTip()

/option

So based on my the value of 'group' from my repeat, I want to use the 
value to look up another value in a different dictionary.  It works if 
I do this:  (event, '${sp_info/whatever/common_name}') but does not 
like me using the embedded ${group}. 


The ${var} syntax is only for inserting a value in a string expression. 
Path expressions only take known names. If you want to look up a value 
based on a variable, you must use Python. Look at the first half of this:


http://plone.org/documentation/how-to/addContentProgrammatically

  --jcc

--
Building Websites with Plone
http://plonebook.packtpub.com

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How exactly do I restart zope?

2000-11-20 Thread Dieter Maurer

NYNewMedia writes:
How exactly do I restart zope?
Under Unix, "./stop; ./start" in the Zope installation directory.

Under Windows:
  "Shutdown" from Zope's Control Panel (to stop Zope)
  "start" (in Zope's installation directory) to start Zope.

  There is a way to start Zope at NT service.
  I am not an expert for this. Look at the upcoming
  Zope book (http://www.zope.org/members/michel/ZB) (or something
  similar).


Dieter

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] How exactly do I restart zope?

2000-11-19 Thread NYNewMedia

  How exactly do I restart zope?
  I have an eight month old zope box running on Linux 5.1 We had to
manually restart the server. The question for us now is how exactly to
restart zope? 
  We tried to restart http, and tried some of the intructions on zope.org,
but have not been able to get it to run, mainly because we are not zope
experienced. Result: we are not able to run the web site or the content
admin tool.
  Can anyone give exact instructions?
Thanks,

Wil

__
Do You Yahoo!?
Yahoo! Calendar - Get organized for the holidays!
http://calendar.yahoo.com/

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )