A 'find' utility that continues through zipped directory structure?

2005-09-26 Thread B Mahoney
Is there a Python 'find' -like utility that will continue the file
search through any zippped directory structure on the find path?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A 'find' utility that continues through zipped directory structure?

2005-09-27 Thread B Mahoney
An effbot utility?  I'll try that.

Thank you

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Well written open source Python apps

2005-10-14 Thread B Mahoney
The paper on BitPim http://bitpim.sourceforge.net/papers/baypiggies/
lists and describes programs and ideas used for the project.  Some of
it is just bullet-points, but everything seems to be well chosen. I've
swiped a lot of these ideas.

-- 
http://mail.python.org/mailman/listinfo/python-list


Expat - how to UseForeignDTD

2005-10-19 Thread B Mahoney
I have a simple Kid template document:



http://www.w3.org/1999/xhtml";
  xmlns:py="http://purl.org/kid/ns#";
>
... (snip)


This runs as expected but now I would like to load a DTD without
tampering with this xml file

In the expat parser __init__  after setting other handlers
for parser, I have added:
parser.ExternalEntityRefHandler = self._ExternalEntityRefHandler
parser.UseForeignDTD(1)  (also tried True)

Which I understand at some point will call
self._ExternalEntityRefHandler
with None for args and I must have code to get this other dtd.
I have done regular ExternalEntityRefHandlers before.

As required, these two lines occur before my Parse() call.
Perhaps I misunderstand the sequence, or need something more in my
xml file, but my _ExternalEntityRefHandler is never called.  The
process behaves as if I never added these two lines.

Help?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Expat - how to UseForeignDTD

2005-10-20 Thread B Mahoney
I needed to set Entity Parsing, such as

parser.SetParamEntityParsing( expat.XML_PARAM_ENTITY_PARSING_ALWAYS )

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Understanding the arguments for SubElement factory in ElementTree

2005-10-29 Thread B Mahoney
Your SubElement call is lacking the attrib argument, but you can't set
text, anyway.

The elementtree source makes it clear, you can only set element attrib
attributes
with SubElement

def SubElement(parent, tag, attrib={}, **extra):
attrib = attrib.copy()
attrib.update(extra)
element = parent.makeelement(tag, attrib)
parent.append(element)
return element

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Invoking Python from Python

2005-11-09 Thread B Mahoney
I also think something along the lines of execfile() may serve the
original poster. There was a  thread last month about compile()
and exec() with a concise example from  Fredrik Lundh.
Google "Changing an AST" in this group.

With dynamically generated code I prefer the separate compile()
step so that I can catch the compile exceptions separately.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python-based Document Management System?

2005-11-10 Thread B Mahoney
If you search for CONTENT management system,  there is
Plone: A user-friendly and powerful open source Content Management ...
http://plone.org/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Can a function access its own name?

2005-11-19 Thread B Mahoney
Decorate any function with @aboutme(), which
will print the function name each time the function is called.

All the 'hello' stuff is in the aboutme() decorator code.
There is no code in the decorated functions themselves
doing anything to telling us the function name.


# The decorator
def aboutme():

def thecall(f, *args, **kwargs):
# Gets to here during module load of each decorated function

def wrapper( *args, **kwargs):
# Our closure, executed when the decorated function is called
print "Hello\nthe name of this function is '%s'\n" \
% f.func_name
return f(*args, **kwargs)

return wrapper

return thecall

@aboutme()
def testing(s):
print "string '%s' is argument for function" % s


@aboutme()
def truing():
return True

# Try these 
testing('x')

testing('again')

truing()

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Detect character encoding

2005-12-04 Thread B Mahoney
You may want to look at some Python Cookbook recipes, such as
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52257
"Auto-detect XML encoding"  by Paul Prescod

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Ant (with Python extensions) good replacement for distutils?

2005-12-07 Thread B Mahoney
>>No way. Ant sucks. Big-time. I actually enhance it with embedded jython
>>to get at least _some_ flexibility.

>>Diez 

Any pointers to this enhancement?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Should we still be learning this?

2006-02-18 Thread B Mahoney
I was initally annoyed that "Dive into Python" has the UserDict, but it
was so
easy to discover it was deprecated
http://docs.python.org/lib/module-UserDict.html
(althought the term 'deprecated' is not specifically used), that anyone
on the
ball (the OP seemed to know) would not based their next big project on
UserDict.

I agree that Python has so many good concepts, and improvements with
each new version, that something in a course will be outdated. I can
concur
that knowing Python made it much easier to go back to C++ and Java and
understand the OO.

My tip for an book on Python with only the latest information, nothing
beats the Python Pocket Reference, 3rd edition,  (O'Reilly) which
is updated for  2.4 and seems to clearly label any deprecated features.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Property In Python

2006-04-21 Thread B Mahoney
I started with the "How-To Guide for Descriptors" by Raymond Hettinger
http://users.rcn.com/python/download/Descriptor.htm

It is one of several docs on the "New-style Classes" page at python.org
http://www.python.org/doc/newstyle/

-- 
http://mail.python.org/mailman/listinfo/python-list