Re: minor errors in the docstring of dsml.py

2008-12-17 Thread Michael Ströder
Yves Dorfsman wrote:
> There are minor errors in the doc string of dsm.py, such as:
> 
>   |  input_file
>   |  File-object to read the LDIF input from
> 
> Which obviously has been copied from the ldif.py.

Uuumh, thanks. Checked in corrected version in CVS HEAD.

Ciao, Michael.

--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
Python-LDAP-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev


Re: DSMLParser example

2008-12-17 Thread Michael Ströder
Yves Dorfsman wrote:
> Is there a simple example for dsml.DSMLParser() somewhere ?

No, this module is rather unmaintained.

IIRC it mainly works like module ldif: You should sub-class
dsml.DSMLParser implementing a custom method .handle(). Note that it
only supports DMSLv1 which is not what you want today.

> I have tried:
> x = dsml.DSMLParser(input_file, dsml.DSMLv1Handler)
> 
> But eventually it fails with an HTTP 404 error...

???

Ciao, Michael.

--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
Python-LDAP-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev


Re: DSMLParser example

2008-12-17 Thread Yves Dorfsman
Michael Ströder wrote:
> Yves Dorfsman wrote:
>> Is there a simple example for dsml.DSMLParser() somewhere ?
> 
> No, this module is rather unmaintained.
> 
> IIRC it mainly works like module ldif: You should sub-class
> dsml.DSMLParser implementing a custom method .handle(). Note that it
> only supports DMSLv1 which is not what you want today.

I did subclass it, the Writer works (I manage to convert from ldfi to dsml), 
but I never get to use the handler method, because it fails when I try to 
parse().

> 
>> I have tried:
>> x = dsml.DSMLParser(input_file, dsml.DSMLv1Handler)
>>
>> But eventually it fails with an HTTP 404 error...
> 
> ???

Yes I was confused too. The documentation does not indicate what the 
ContentHandler should be... is dsml.DSMLv1Handler the right thing to put there ?


   File "./ieLDAP.py", line 106, in main
 parser.parse()
   File "/usr/lib/python2.5/site-packages/dsml.py", line 300, in parse
 self._parser.parse(self._input_file)
   File "/usr/lib/python2.5/site-packages/_xmlplus/sax/expatreader.py", line 
109, in parse
 xmlreader.IncrementalParser.parse(self, source)
   File "/usr/lib/python2.5/site-packages/_xmlplus/sax/xmlreader.py", line 
123, in parse
 self.feed(buffer)
   File "/usr/lib/python2.5/site-packages/_xmlplus/sax/expatreader.py", line 
216, in feed
 self._parser.Parse(data, isFinal)
   File "/usr/lib/python2.5/site-packages/_xmlplus/sax/expatreader.py", line 
395, in external_entity_ref
 "")
   File "/usr/lib/python2.5/site-packages/_xmlplus/sax/saxutils.py", line 
524, in prepare_input_source
 f = urllib2.urlopen(source.getSystemId())
   File "/usr/lib/python2.5/urllib2.py", line 124, in urlopen
 return _opener.open(url, data)
   File "/usr/lib/python2.5/urllib2.py", line 387, in open
 response = meth(req, response)
   File "/usr/lib/python2.5/urllib2.py", line 498, in http_response
 'http', request, response, code, msg, hdrs)
   File "/usr/lib/python2.5/urllib2.py", line 425, in error
 return self._call_chain(*args)
   File "/usr/lib/python2.5/urllib2.py", line 360, in _call_chain
 result = func(*args)
   File "/usr/lib/python2.5/urllib2.py", line 506, in http_error_default
 raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 404: Not Found



-- 
Yves.
http://www.sollers.ca/blog


--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
Python-LDAP-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev


Re: DSMLParser example

2008-12-17 Thread Michael Ströder
Yves Dorfsman wrote:
> Michael Ströder wrote:
>> Yves Dorfsman wrote:
>>> But eventually it fails with an HTTP 404 error...
>> ???
> 
> Yes I was confused too.
> [..]
>File "/usr/lib/python2.5/urllib2.py", line 506, in http_error_default
>  raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
> urllib2.HTTPError: HTTP Error 404: Not Found

Maybe the underlying modules try to download a DTD via HTTP for DSMLv1
which is no longer available at the OASIS site? Frankly I'd recommend
not to bother with DSMLv1 since OASIS does not support it anymore.

Ciao, Michael.

--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
Python-LDAP-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev


Re: DSMLParser example

2008-12-17 Thread Yves Dorfsman
Michael: Can you confirm this is the way it was supposed to be used, I mean, 
is this class the sort of argument that should be used for ContentHandler ?

> Yves Dorfsman wrote:
> 
>> I have tried:
>> x = dsml.DSMLParser(input_file, dsml.DSMLv1Handler)

I have noted your observation about dsml v1, and will look at the new 
version, and see how far I get into implementing that.



-- 
Yves.



--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
Python-LDAP-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev


LDIF version

2008-12-17 Thread Yves Dorfsman

I'd like to propose:

1) adding the ldif.LDIFWriter.writeFooter(self) method
which would simply write:

version: x

with x the version number of the LDIF format (1 for now).


2) Add a variable 'version' to the ldif.LDIFParser, ldif.LDIFWriter classes 
as well as an option in the constructor of the ldif.LDIFWriter:

__init__(self, output_file, base64_attrs=None, cols=76, line_sep='\n', 
version=1)


This should be a trivial change, but I can submit patches if needed.

-- 
Yves.



--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
Python-LDAP-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev