Re: [Zope] rename meta_type

2008-02-09 Thread David Chelimsky
On Feb 8, 2008 3:34 PM, Dieter Maurer <[EMAIL PROTECTED]> wrote:
> David Chelimsky wrote at 2008-2-7 13:17 -0600:
> >I have a product in use on many of my client sites. I'd like to rename
> >the meta_type of one of the classes, but I notice that when I do, the
> >pre-existing objects retain their old meta_type.
>
> Then these instances misbehave: they have assigned the "meta_type"
> attribute themselves rather than used the class level attribute
> (which they should have done).
>
> >Is there a way for me to force a zope object to "reset" itself
> >according to a modified class definition?
>
> You must locate the object and delete the instance level
> attribute.

Thanks for the reply, Dieter. Through further exploration I discovered
that they in fact *had* the correct meta_type. The problem I was
experiencing was that when I called objectValues('New MetaType') on
the object's parent, I didn't get anything back. It turns out that
this method operates on a dictionary maintained in the parent rather
than actually interrogating its children for their meta_type.

So I'm now using my own version of objectValues and all is well in my
application. It's an old version of zope (2.7.9), so I'm guessing that
a patch would be a waste of time at this point, yes?

>
>
>
> --
> 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] rename meta_type

2008-02-07 Thread David Chelimsky
Hello,

I have a product in use on many of my client sites. I'd like to rename
the meta_type of one of the classes, but I notice that when I do, the
pre-existing objects retain their old meta_type.

Is there a way for me to force a zope object to "reset" itself
according to a modified class definition?

Thanks in advance,
David
___
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] Intercept request

2008-01-07 Thread David Chelimsky
On Jan 7, 2008 8:35 AM, David Chelimsky <[EMAIL PROTECTED]> wrote:
>
> On Jan 7, 2008 8:23 AM, Andreas Jung <[EMAIL PROTECTED]> wrote:
> >
> >
> > --On 7. Januar 2008 08:18:14 -0600 David Chelimsky <[EMAIL PROTECTED]>
> > wrote:
> >
> > > On Jan 7, 2008 8:06 AM, Andreas Jung <[EMAIL PROTECTED]> wrote:
> > >> --On 7. Januar 2008 08:00:27 -0600 David Chelimsky <[EMAIL PROTECTED]>
> > >> wrote:
> > >>
> > >> > Hi,
> > >> >
> > >> > I want to show different things to different viewers based on their IP
> > >> > addresses. How can I do this?
> > >>
> > >>
> > >> Basically you look at the clients ip address (from the REQUEST object)
> > >> and perform any action you need (redirections, conditions within scripts,
> > >> templates)...but no idea what the sense of this usecase is. If you have
> > >> different audiences, setup sites with different content or something
> > >> similar. In addition: using Zope behind proxy will lead in request coming
> > >> from the IP address of your reverse proxy. Additional
> > >> configuration/programming is necessary to get hold of the original IP.
> > >
> > > Thanks for the reply.
> > >
> > > The use case is that my client wants to block a range of IP addresses
> > > from being able to view their site.
> >
> > You have a firewall for this purpose or you use apache rewrite rules for
> > performing URL rewriting.
>
> Our host uses nginx, not apache. We can still do this w/ nginx
> configuration, but it means maintaining a configuration file rather
> than application code (which in my experience is more
> flexible/maintainable). Right now I'm just exploring options, so I'd
> still like to know how I can do this with Zope.

BTW - I'm using ZPT, not DTML. I'm guessing I can do this with a
simple script that I include on every page, yes? That could work, but
seems a bit error prone - that's why I'm looking for some sort of
request hook. But maybe that's my best option within Zope. Thoughts?

>
> Thanks,
> David
>
> >
> > -aj
> >
> >
>
___
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] Intercept request

2008-01-07 Thread David Chelimsky
On Jan 7, 2008 8:23 AM, Andreas Jung <[EMAIL PROTECTED]> wrote:
>
>
> --On 7. Januar 2008 08:18:14 -0600 David Chelimsky <[EMAIL PROTECTED]>
> wrote:
>
> > On Jan 7, 2008 8:06 AM, Andreas Jung <[EMAIL PROTECTED]> wrote:
> >> --On 7. Januar 2008 08:00:27 -0600 David Chelimsky <[EMAIL PROTECTED]>
> >> wrote:
> >>
> >> > Hi,
> >> >
> >> > I want to show different things to different viewers based on their IP
> >> > addresses. How can I do this?
> >>
> >>
> >> Basically you look at the clients ip address (from the REQUEST object)
> >> and perform any action you need (redirections, conditions within scripts,
> >> templates)...but no idea what the sense of this usecase is. If you have
> >> different audiences, setup sites with different content or something
> >> similar. In addition: using Zope behind proxy will lead in request coming
> >> from the IP address of your reverse proxy. Additional
> >> configuration/programming is necessary to get hold of the original IP.
> >
> > Thanks for the reply.
> >
> > The use case is that my client wants to block a range of IP addresses
> > from being able to view their site.
>
> You have a firewall for this purpose or you use apache rewrite rules for
> performing URL rewriting.

Our host uses nginx, not apache. We can still do this w/ nginx
configuration, but it means maintaining a configuration file rather
than application code (which in my experience is more
flexible/maintainable). Right now I'm just exploring options, so I'd
still like to know how I can do this with Zope.

Thanks,
David

>
> -aj
>
>
___
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] Intercept request

2008-01-07 Thread David Chelimsky
On Jan 7, 2008 8:06 AM, Andreas Jung <[EMAIL PROTECTED]> wrote:
> --On 7. Januar 2008 08:00:27 -0600 David Chelimsky <[EMAIL PROTECTED]>
> wrote:
>
> > Hi,
> >
> > I want to show different things to different viewers based on their IP
> > addresses. How can I do this?
>
>
> Basically you look at the clients ip address (from the REQUEST object)
> and perform any action you need (redirections, conditions within scripts,
> templates)...but no idea what the sense of this usecase is. If you have
> different audiences, setup sites with different content or something
> similar. In addition: using Zope behind proxy will lead in request coming
> from the IP address of your reverse proxy. Additional
> configuration/programming is necessary to get hold of the original IP.

Thanks for the reply.

The use case is that my client wants to block a range of IP addresses
from being able to view their site. So I need to access the
originating IP address and filter appropriately.

I've written a few custom zope products before, but I've not done
anything that really modifies zope's behaviour on every request - just
on requests for the specific objects I'm publishing. So I'm familiar
with the request object, but I don't know how to intercept *every*
request. Are there any global request life-cycle hooks? If you can
point me to those that would be a great help.

Cheers,
David
___
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] Intercept request

2008-01-07 Thread David Chelimsky
Hi,

I want to show different things to different viewers based on their IP
addresses. How can I do this?

Cheers,
David
___
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 )