Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: CMF

Cleaning up imports, question about odd "feature"

 

 

Zope cmf RSS feed   Index | Next | Previous | View Threaded


tseaver at palladion

Dec 27, 2008, 10:45 AM

Post #1 of 8 (724 views)
Permalink
Cleaning up imports, question about odd "feature"

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

After spelunking through the maze of imports in the Zope2 core
indirected throught the Globals module, I resolved to rip out all such
imports (see a separate thread on zope-deve). I also want to clean them
out of the CMF trunk, and so have been hunting through code which does
'from Globals import' and 'import Globals'.

I have found a couple of oddities: both CMFCore.FSPropertiesObject and
CMFCore.FSSQLMethod use Globals.Development mode to decide whether or
not to give their class an '__of__' method. I don't recall the
rationale, but it has been around *forever*, AFAICT. I would like to
rip it out, and just make the '__of__' method there always, unless
somebody has a good argument for the current status.

I also plan to make all the currently relative imports absolute, since
relative imports break under later versions of Python, and I am making
some of them more precise: e.g.:

from AccessControl import ClassSecurityInfo

becomes:

from AccessControl.SecurityInfo import ClassSecurityInfo

This is largely in aid of improving the dependency analysis of the parts
of the Zope2 core, but I think the practice is better, anyway.


Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver[at]palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJVne1+gerLs4ltQ4RAiTeAJoDTy4CkmD3nJu5UDx2EPPR2FQYNgCfYpqm
mJnaA/TX1ZTcOm8Qzq6JMYw=
=T1st
-----END PGP SIGNATURE-----

_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


jens at dataflake

Dec 27, 2008, 11:03 AM

Post #2 of 8 (688 views)
Permalink
Re: Cleaning up imports, question about odd "feature" [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Dec 27, 2008, at 19:45 , Tres Seaver wrote:

> I have found a couple of oddities: both CMFCore.FSPropertiesObject
> and
> CMFCore.FSSQLMethod use Globals.Development mode to decide whether or
> not to give their class an '__of__' method. I don't recall the
> rationale, but it has been around *forever*, AFAICT. I would like to
> rip it out, and just make the '__of__' method there always, unless
> somebody has a good argument for the current status.

I always thought it was there to continually re-read the filesystem
representation upon access, so any filesystem changes are reflected
without restarting the instance. As to the usefulness, I'm not relying
on it when I do development. I always restart.


> I also plan to make all the currently relative imports absolute, since
> relative imports break under later versions of Python, and I am making
> some of them more precise: e.g.:
>
> from AccessControl import ClassSecurityInfo
>
> becomes:
>
> from AccessControl.SecurityInfo import ClassSecurityInfo

+1

jens



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

iEYEARECAAYFAklWfAsACgkQRAx5nvEhZLKF6gCfbAiOvshC/jieG8+4UmTsyYH7
AR8An2DsvoQ9ELqaRRG2LQPGFXOoIk+k
=9Md6
-----END PGP SIGNATURE-----
_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


charlie at begeistert

Dec 29, 2008, 6:18 AM

Post #3 of 8 (675 views)
Permalink
Re: Cleaning up imports, question about odd "feature" [In reply to]

Am 27.12.2008 um 20:03 schrieb Jens Vagelpohl:

> I always thought it was there to continually re-read the filesystem
> representation upon access, so any filesystem changes are reflected
> without restarting the instance. As to the usefulness, I'm not relying
> on it when I do development. I always restart.

If this is the case then it would be nice to have some way of
preserving that behaviour. We have a few people working almost
exclusively working with templates on Windows systems where restarts
are particularly slow. However, PageTemplates are probably the only
objects it's worth preserving this kind of behaviour for.

On another and only slightly related note: Tres, in September I seem
to remember you saying that the biggest stumbling block for moving to
Python 2.5 and beyond was support for RestrictedPython implements, ie.
PythonScripts. If this is the case, do we need to add deprecating
PythonScripts/untrusted code to the roadmap?

>> I also plan to make all the currently relative imports absolute,
>> since
>> relative imports break under later versions of Python, and I am
>> making
>> some of them more precise: e.g.:
>>
>> from AccessControl import ClassSecurityInfo
>>
>> becomes:
>>
>> from AccessControl.SecurityInfo import ClassSecurityInfo
>
> +1


I didn't realise this counts as a relative import but I'm all in
favour of spelling things out.
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


jens at dataflake

Dec 29, 2008, 7:02 AM

Post #4 of 8 (674 views)
Permalink
Re: Cleaning up imports, question about odd "feature" [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Dec 29, 2008, at 15:18 , Charlie Clark wrote:

>> I always thought it was there to continually re-read the filesystem
>> representation upon access, so any filesystem changes are reflected
>> without restarting the instance. As to the usefulness, I'm not
>> relying
>> on it when I do development. I always restart.
>
> If this is the case then it would be nice to have some way of
> preserving that behaviour. We have a few people working almost
> exclusively working with templates on Windows systems where restarts
> are particularly slow. However, PageTemplates are probably the only
> objects it's worth preserving this kind of behaviour for.

They have (and retain) that behavior. Tres was specifically mentioning
FSProperties.py and FSZSQLMethod.py, which implement the re-reading in
a somewhat awkward way using __of__.

jens


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

iEYEARECAAYFAklY5p0ACgkQRAx5nvEhZLJqGACfcpAUoT6GpN8sIiim/ATXTILX
OooAnir4vTeDRKznITzk3I+yIUMxEk3y
=cOhV
-----END PGP SIGNATURE-----
_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


charlie at begeistert

Dec 29, 2008, 7:18 AM

Post #5 of 8 (676 views)
Permalink
Re: Cleaning up imports, question about odd "feature" [In reply to]

Am 29.12.2008 um 16:02 schrieb Jens Vagelpohl:

>> If this is the case then it would be nice to have some way of
>> preserving that behaviour. We have a few people working almost
>> exclusively working with templates on Windows systems where restarts
>> are particularly slow. However, PageTemplates are probably the only
>> objects it's worth preserving this kind of behaviour for.
>
> They have (and retain) that behavior. Tres was specifically mentioning
> FSProperties.py and FSZSQLMethod.py, which implement the re-reading in
> a somewhat awkward way using __of__.


Yes, I looked at them afterwards. We are using some ZSQL files in one
project to keep them under version control but there are much fewer of
them and fewer changes to them than templates so could easily live
without live updatedness there just as we do with View classes.

+ 1 from me.
and
+ 1 to the changes import statements.

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


tseaver at palladion

Dec 29, 2008, 10:20 AM

Post #6 of 8 (669 views)
Permalink
Re: Cleaning up imports, question about odd "feature" [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Charlie Clark wrote:
> Am 27.12.2008 um 20:03 schrieb Jens Vagelpohl:
>
>> I always thought it was there to continually re-read the filesystem
>> representation upon access, so any filesystem changes are reflected
>> without restarting the instance. As to the usefulness, I'm not relying
>> on it when I do development. I always restart.
>
> If this is the case then it would be nice to have some way of
> preserving that behaviour. We have a few people working almost
> exclusively working with templates on Windows systems where restarts
> are particularly slow. However, PageTemplates are probably the only
> objects it's worth preserving this kind of behaviour for.

As Jens noted, this change is for FSProperties and FSSQLMethods only.

> On another and only slightly related note: Tres, in September I seem
> to remember you saying that the biggest stumbling block for moving to
> Python 2.5 and beyond was support for RestrictedPython implements, ie.
> PythonScripts. If this is the case, do we need to add deprecating
> PythonScripts/untrusted code to the roadmap?

I don't have that appetite at the CMF level: I think much of the work
has actually been done to ensure that RP works under Python 2.5+ already
at the Zope level.

>>> from AccessControl import ClassSecurityInfo
>>>
>>> becomes:
>>>
>>> from AccessControl.SecurityInfo import ClassSecurityInfo
>> +1
>
>
> I didn't realise this counts as a relative import but I'm all in
> favour of spelling things out.

That one isn't relative: it is just another "façade" import.


Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver[at]palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJWRTd+gerLs4ltQ4RAoHsAKCo5zw04ztXiDFGK9kqtc/mgqWesACgohZb
rUgUCzvuwrXNmaVGkM9gN4w=
=1ZzP
-----END PGP SIGNATURE-----

_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


charlie at begeistert

Dec 30, 2008, 4:17 AM

Post #7 of 8 (666 views)
Permalink
Re: Cleaning up imports, question about odd "feature" [In reply to]

Am 29.12.2008 um 19:20 schrieb Tres Seaver:

> As Jens noted, this change is for FSProperties and FSSQLMethods only.

Yep, and these aren't generally objects that need to be changed
frequently in the FS.

>> On another and only slightly related note: Tres, in September I seem
>> to remember you saying that the biggest stumbling block for moving to
>> Python 2.5 and beyond was support for RestrictedPython implements,
>> ie.
>> PythonScripts. If this is the case, do we need to add deprecating
>> PythonScripts/untrusted code to the roadmap?
>
> I don't have that appetite at the CMF level: I think much of the work
> has actually been done to ensure that RP works under Python 2.5+
> already
> at the Zope level.

It's good to know that they will still work with Python 2.5. My own
introduction to Zope was heavily dependent upon combining
PythonScripts and PageTemplates and I'm currently seconded to a .NET
based CMS which has something remarkably similar: they are a very
useful way of encapsulating site-specific behaviour so it would be
nice to have them around in one form or other if the associated issues
(security, global validity, etc. can be resolved) otherwise some
bright spark's bound to reinvent them!

You are, of course, right that this wouldn't be a CMF only issue but I
think that it's something we should be thinking of once we have a
complete set of "experimental" browser views. <looks appropriately
guilty/>

>>>> from AccessControl import ClassSecurityInfo
>>>>
>>>> becomes:
>>>>
>>>> from AccessControl.SecurityInfo import ClassSecurityInfo
>>> +1
>>
>>
>> I didn't realise this counts as a relative import but I'm all in
>> favour of spelling things out.
>
> That one isn't relative: it is just another "façade" import.


Façade imports are where classes and modules are populated through a
package's __init__.py or module?

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


dieter at handshake

Jan 6, 2009, 9:16 AM

Post #8 of 8 (631 views)
Permalink
Re: Cleaning up imports, question about odd "feature" [In reply to]

Charlie Clark wrote at 2008-12-30 13:17 +0100:
>Am 29.12.2008 um 19:20 schrieb Tres Seaver:
>
>> As Jens noted, this change is for FSProperties and FSSQLMethods only.
>
>Yep, and these aren't generally objects that need to be changed
>frequently in the FS.

But if possible, all FS* objects should behave identically with respect
to "debug-mode on". It should not be the case that, e.g., "FSPageTemplate"
is reread in debug mode but "FSProperties" is not.



--
Dieter
_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests

Zope cmf RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.