[Zope3-dev] zope.app.twisted.main?

2007-01-31 Thread Chris Withers
Is there a non-twisted main.py of does zope.app.twisted.main get used 
for all Zope 3 instances?


cheers,

Chris

--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] [German Zope Conference] Call for papers open

2007-01-31 Thread Andreas Jung

From: Andreas Jung <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED], zope@zope.org, 
zope-announce@zope.org,

zope-dev@zope.org
Subject: [Zope-Annce] [German Zope Conference] Call for Papers open
Date-Sent: 1. Februar 2007 08:06:52

Dear Zope Community,

the eighth Zope conference organized by the German Zope User Group (DZUG) 
will be held this year at the Potsdam Institute for Climate Impact Research

from 4. to 5 June 2007 (near Berlin). The topic of the conference will be

   Zope in sciences.

Proposals for talks and workshops can be submitted until 01.04.2007;

http://www.zope.de/redaktion/dzug/tagung/potsdam-2007/dzug-conference-2007-call-for-papers-zope-in-science

or

http://www.zope.de/redaktion/dzug/tagung/potsdam-2007/dzug-conference-2007-call-for-papers-zope-in-science

Both German and English proposals are highly welcome.

You can find further information about the Zope conference here:

  http://www.zope.de/8-dzug-tagung


Regards,
Andreas Jung
Assistant Chairman DZUG e.V.


pgpjdTLS7YlH1.pgp
Description: PGP signature
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] Patch that adds domain verification to zope.app.locales.extract py_strings

2007-01-31 Thread Ignas Mikalajunas

 Hi, this patch adds the capability to turn on translation domain
verification if files that are being translated can be imported from
the pythonpath you are running the extraction with. In SchoolTool we
have more than one domain in python files and I just needed to add the
verification (was getting all the msgids that were in python source
code in all the pot files that were generated).

As i have no commit rights it would be nice if someone would commit it
into Zope3 repository after reviewing the patch.

Ignas Mikalajūnas
Index: src/zope/app/locales/extract.py
===
--- src/zope/app/locales/extract.py	(revision 71976)
+++ src/zope/app/locales/extract.py	(working copy)
@@ -31,6 +31,7 @@
 
 DEFAULT_CHARSET = 'UTF-8'
 DEFAULT_ENCODING = '8bit'
+_import_chickens = {}, {}, ("*",) # dead chickens needed by __import__
 
 pot_header = '''\
 ##
@@ -342,13 +343,79 @@
 os.path.walk(dir, visit, files)
 return files
 
-def py_strings(dir, domain="zope", exclude=()):
+
+def module_from_filename(filename, sys_path=None):
+"""Translate a filename into a name of a module.
+
+We are using the python path to determine what the shortest module
+name should be:
+
+   >>> sys_path = ["/home/pete/src/project/Zope3/src/",
+   ... "/home/pete/src/project/src/schooltool",
+   ... "/home/pete/python2.4/site-packages"]
+
+   >>> module_from_filename("/home/pete/src/project/src/schooltool/module/__init__.py",
+   ...  sys_path=sys_path)
+   'module'
+
+   >>> module_from_filename("/home/pete/src/project/src/schooltool/module/file.py",
+   ...  sys_path=sys_path)
+   'module.file'
+
+   >>> module_from_filename("/home/pete/src/project/Zope3/src/zope/app/locales/extract.py",
+   ...  sys_path=sys_path)
+   'zope.app.locales.extract'
+
+"""
+if sys_path is None:
+sys_path = sys.path
+
+filename = os.path.abspath(filename)
+common_path_lengths = [
+len(os.path.commonprefix([filename, path]))
+for path in sys_path]
+l = sorted(common_path_lengths)[-1]
+if filename[l - 1] == os.path.sep: # a path in sys.path ends with a separator
+l = l - 1
+# remove .py ending from filenames
+# replace all path separators with a dot
+# remove the __init__ from the import path
+return filename[l+1:-3].replace(os.path.sep, ".").replace(".__init__", "")
+
+
+def py_strings(dir, domain="zope", exclude=(), verify_domain=False):
 """Retrieve all Python messages from `dir` that are in the `domain`.
+
+Retrieves all the messages in all the domains if verify_domain is
+False.
 """
 eater = TokenEater()
 make_escapes(0)
 for filename in find_files(
 dir, '*.py', exclude=('extract.py', 'pygettext.py')+tuple(exclude)):
+
+if verify_domain:
+module_name = module_from_filename(filename)
+try:
+module = __import__(module_name, *_import_chickens)
+except ImportError, e:
+# XXX if we can't import it - we assume that the domain is
+# the right one
+print >> sys.stderr, ("Could not import %s, "
+  "assuming i18n domain OK" % module_name)
+else:
+mf = getattr(module, '_', None)
+# XXX if _ is has no _domain set we assume that the domain
+# is the right one, so if you are using something non
+# MessageFactory you should set it's _domain attribute.
+if hasattr(mf, '_domain'):
+if mf._domain != domain:
+# domain mismatch - skip this file
+continue
+elif mf:
+print >> sys.stderr, ("Could not figure out the i18n domain"
+  "for module %s, assuming it is OK" % module_name)
+
 fp = open(filename)
 try:
 eater.set_filename(filename)
@@ -359,11 +426,6 @@
 e[0], filename, e[1][0], e[1][1])
 finally:
 fp.close()
-# One limitation of the Python message extractor is that it cannot
-# determine the domain of the string, since it is not contained anywhere
-# directly. The only way this could be done is by loading the module and
-# inspect the '_' function. For now we simply assume that all the found
-# strings have the domain the user specified.
 return eater.getCatalog()
 
 def zcml_strings(dir, domain="zope", site_zcml=None):
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] Re: View permissions

2007-01-31 Thread Martijn Faassen

Philipp von Weitershausen wrote:

Marius Gedminas wrote:

and which causes registration as an adapter without the need for ZCML.


I am not sure I like that.  When does the registration take effect?  On
module import?


No, that would be quite terrible. It would mean you could never import 
anything without having registration going on.


The registration happens during "grok time", in other words, when you 
explicitly grok something. E.g.:


  

or:

  >>> grok.grok('foobar')


Grok-time means we are able to support ZCML style actions and anything 
you can do with ZCML overrides. We intend to think that set of features 
through at some point and support it in Grok somehow, though aren't 
there yet.


The idea in Grok is to keep the benefits of ZCML without ZCML actually 
being there. :)


Regards,

Martijn

___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] customizing accesslog format

2007-01-31 Thread Sascha Ottolski
Hi,

it appears as if the format for the access log is somewhat hardcoded. I 
see that there exists (at least)

zope.app.server.accesslog
zope.app.twisted.accesslog
zope.app.twisted.log

and

twisted.web2.log

From discussions I found it seems as if the latter would be the place to 
hack the actual logging format (like suggested in 
http://mail.zope.org/pipermail/zope3-dev/2006-January/017771.html).

I'm wondering, is patching twisted really the way to go?

Would it be feasible to make the acceslog format be customizable via a 
zope.conf entry, in a way similar to what possible with apache & co.?


Thanks,

Sascha

-- 
Lalisio GmbH                                          www.lalisio.com

Puschkinstraße 1                             fon +49-(0)361/541 43 80
99084 Erfurt                                 fax +49-(0)361/541 43 79
                                                 [EMAIL PROTECTED]
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] sys._getframe magic and z.a.t.functional.defineLayer

2007-01-31 Thread Baiju M

Hi,
  We are using sys._getframe magic in many places.
Sometimes it is the only way.
But I wonder why we required a function like :
'z.a.t.functional.defineLayer'

Yes, it saves few typing, but if we are defining
layers directly using LayerName = ZCMLLayer(...)
It will be more explicit and understandable code.

I wrote an example here: http://pastey.net/5739-48en

Regards,
Baiju M
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com