[issue42958] filecmp.cmp(shallow=True) isn't actually shallow when only mtime differs

2021-07-12 Thread Christof Hanke


Christof Hanke  added the comment:

Andrei,
cmp is the deep-compare part of filecmp. I thought we were taking about the 
shallow one.

Thus,
- shallow like rsync "quick": size + mtime.
- deep like cmp

--

___
Python tracker 
<https://bugs.python.org/issue42958>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42958] filecmp.cmp(shallow=True) isn't actually shallow when only mtime differs

2021-07-12 Thread Christof Hanke

Christof Hanke  added the comment:

Hi Andrei,

I would follow rsync. 
>From the man page:
"""
[...]
 -c, --checksum
  This changes the way rsync checks if the files have been changed 
and are in need of a transfer.   Without  this  option,  rsync
  uses  a  "quick  check" that (by default) checks if each file’s 
size and time of last modification match between the sender and
  receiver. 
[...]
"""

so, yes you can have false positives with a shallow comparison of size + mtime 
only. But that's usually ok for e.g. incremental backups. 


Wow, the bug is that old...

--

___
Python tracker 
<https://bugs.python.org/issue42958>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42958] filecmp.cmp(shallow=True) isn't actually shallow when only mtime differs

2021-07-12 Thread Christof Hanke


Christof Hanke  added the comment:

Hi,

this is also discussed in https://bugs.python.org/issue41354.

Ciao,
  Christof

--
nosy: +chanke

___
Python tracker 
<https://bugs.python.org/issue42958>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41354] filecmp.cmp documentation does not match actual code

2021-07-12 Thread Christof Hanke


Christof Hanke  added the comment:

Andrei,

See https://bugs.python.org/issue42958

Someone else stumbled over this topic.

Maybe you can merge these two requests?

Otherwise, I'm fine with a new arg.

Christof

--

___
Python tracker 
<https://bugs.python.org/issue41354>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41354] filecmp.cmp documentation does not match actual code

2020-12-27 Thread Christof Hanke


Christof Hanke  added the comment:

I understand that you are reluctant to change existing code.
But for me as a sysadmin, the current behavior doesn't make sense for two 
reasons:

* st.st_size is part of _sig.  why would you do a deep compare if  the two 
files have a different length ?

* comparing thousands of files, a proper shallow-only compare is required, 
since it takes a long time to compare large files (especially when they are 
migrated to a tape-backend), so a silent-fallback to a deep-compare is not good.

--

___
Python tracker 
<https://bugs.python.org/issue41354>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41354] filecmp.cmp documentation does not match actual code

2020-07-21 Thread Christof Hanke


Change by Christof Hanke :


--
keywords: +patch
pull_requests: +20722
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21580

___
Python tracker 
<https://bugs.python.org/issue41354>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41354] filecmp.cmp documentation does not match actual code

2020-07-21 Thread Christof Hanke


New submission from Christof Hanke :

help(filecmp.cmp) says:

"""
cmp(f1, f2, shallow=True)
Compare two files.

Arguments:

f1 -- First file name

f2 -- Second file name

shallow -- Just check stat signature (do not read the files).
   defaults to True.

Return value:

True if the files are the same, False otherwise.

This function uses a cache for past comparisons and the results,
with cache entries invalidated if their stat information
changes.  The cache may be cleared by calling clear_cache().
"""

However, looking at the code, the shallow-argument is taken only into account 
if the signatures are the same:
"""
s1 = _sig(os.stat(f1))
s2 = _sig(os.stat(f2))
if s1[0] != stat.S_IFREG or s2[0] != stat.S_IFREG:
return False
if shallow and s1 == s2:
return True
if s1[1] != s2[1]:
return False

outcome = _cache.get((f1, f2, s1, s2))
if outcome is None:
outcome = _do_cmp(f1, f2)
if len(_cache) > 100:  # limit the maximum size of the cache
clear_cache()
_cache[f1, f2, s1, s2] = outcome
return outcome
"""

Therefore, if I call cmp with shallow=True and the stat-signatures differ, 
cmp actually does a "deep" compare.
This "deep" compare however does not check the stat-signatures.

Thus I propose follwing patch:
cmp always checks the "full" signature.
return True if shallow and above test passed.
It does not make sense to me that when doing a "deep" compare, that only the 
size 
is compared, but not the mtime. 


--- filecmp.py.orig 2020-07-16 12:00:57.0 +0200
+++ filecmp.py  2020-07-16 12:00:30.0 +0200
@@ -52,10 +52,10 @@
 s2 = _sig(os.stat(f2))
 if s1[0] != stat.S_IFREG or s2[0] != stat.S_IFREG:
 return False
-if shallow and s1 == s2:
-return True
-if s1[1] != s2[1]:
+if s1 != s2:
 return False
+if shallow:
+return True
 
 outcome = _cache.get((f1, f2, s1, s2))
 if outcome is None:

--
components: Library (Lib)
messages: 374054
nosy: chanke
priority: normal
severity: normal
status: open
title: filecmp.cmp documentation does not match actual code
type: behavior

___
Python tracker 
<https://bugs.python.org/issue41354>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33638] condition lock not re-acquired

2018-05-24 Thread christof

christof <chbai...@gmail.com> added the comment:

In my previous comment, what I want to implement is not a timeout for a task to 
complete but more precisely a timeout triggered if the coroutine was not wake 
up by a notify on the condition.

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33638>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33638] condition lock not re-acquired

2018-05-24 Thread christof

New submission from christof <chbai...@gmail.com>:

Hello,

I have a simple code which triggers a timeout if a task did not complete

import asyncio

async def task_timeout():
condition = asyncio.Condition()
with await condition:
try:
await asyncio.wait_for(condition.wait(), timeout=4)
except asyncio.TimeoutError as e:
 
print("timeout reached")
# uncomment this line to make the code work
# await asyncio.sleep(0)


f = asyncio.ensure_future(task_timeout())

loop= asyncio.get_event_loop()
loop.run_until_complete(f)

It throws an exception when leaving the scope for the condition because it 
expects the lock to be acquired:

RuntimeError: Lock is not acquired.

If you uncomment the line to sleep, it will work because it will continue in 
the coroutine Condition.wait and call:
 yield from self.acquire() => locks.py line 355

I think this is a bug and that this behaviour is not the expected one.

--
components: asyncio
messages: 317604
nosy: asvetlov, christof, yselivanov
priority: normal
severity: normal
status: open
title: condition lock not re-acquired
type: behavior
versions: Python 3.6

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33638>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26047] argparse.ArgumentError documentation wrong

2016-01-08 Thread Christof Hanke

New submission from Christof Hanke:

On https://docs.python.org/2/library/argparse.html (and on those of the 
3.6-Version) it says at the bottom:

"""

ArgumentParser.error(message)

This method prints a usage message including the message to the standard 
error and terminates the program with a status code of 2.
"""

In fact, the returned staus code is 1.

--
assignee: docs@python
components: Documentation
messages: 257745
nosy: Christof Hanke, docs@python
priority: normal
severity: normal
status: open
title: argparse.ArgumentError documentation wrong
type: enhancement
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26047>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



ANN: cssutils 0.9.8a2

2011-06-11 Thread Christof

what is it
--
A Python package to parse and build CSS Cascading Style Sheets.
(Not a renderer though!)

about this release
--
0.9.8a2 is a bugfix release.

Compatibility to Python 3.x is currently in development. At the same 
time Python 2.4 and Python 2.5 compatibility will probably be lost...


0.9.8 will be the last version to support Python 2.4 and Python 2.5.

main changes

- BUGFIX: Fixed Issue #59 which showed a rather strange problem with 
longer space separated lists of font-family values being so slow to 
actually stop parsing.
- BUGFIX/IMPROVEMENT: Fixed Issue #48. ``CSSParser.parseUrl()`` uses the 
defined fetcher of this parser *for the initial stylesheet* at url too 
and not just the imported sheets *from* this sheet.
- BUGFIX: Fixed Issue #50 which prevented cssutils parsing the acid2.css 
file correctly. Problem were selectors starting directly with 
``[class]`` (an attribute selector).


+ **API CHANGE (major)**
(Known) named colors are parsed as ColorValue objects now. These 
are the 16 simple colors (black, white, etc) and `transparent` but not 
all Extended color keywords yet. Also changed ``ColorValue.type`` to 
``Value.COLOR_VALUE``. ColorValue has additional properties ``red, 
green, blue, alpha`` and ``colorType`` which is one of IDENT, HASH or 
FUNCTION for now.

+ API CHANGE (minor)
Removed already DEPRECATED ``cssutils.parse`` and 
``CSSParser.parse``. Use the more specific functions/methods ``parseFile 
parseString parseUrl`` instead.


Removed already DEPRECATED  ``cssutils.log.setlog`` and 
``.setloglevel``. Use ``.setLog`` and ``.setLevel`` instead.


Removed already DEPRECATED  ``cssutils.ser.keepUnkownAtRules`` 
(note the typo). Use ``.keepUnknownAtRules`` instead.


- IMPROVEMENT: Added validation profiles for some properties from `CSS 
Backgrounds and Borders Module Level 3 
http://www.w3.org/TR/css3-background/`__, `CSS3 Basic User Interface 
Module http://www.w3.org/TR/css3-ui/#resize`__, `CSS Text Level 3 
http://www.w3.org/TR/css3-text/`__

mainly  `cursor`, `outline`, `resize`, `box-shadow`, `text-shadow`

license
---
cssutils is published under the LGPL version 3 or later, see
http://cthedot.de/cssutils/

If you have other licensing needs please let me know.

download

For download options see http://cthedot.de/cssutils/

cssutils needs Python 2.4 and higher or Jython 2.5 and higher (tested 
with Python 2.7.1(x64), 2.6.5(x64), 2.5.4(x32), 2.4.4(x32) and Jython 
2.5.1 on Win7x64 only)



Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.


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

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


html5lib

2011-03-04 Thread Christof

http://code.google.com/p/html5lib/downloads/list

xhtml to html5
--
http://mail.python.org/mailman/listinfo/python-announce-list

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


ANN: cssutils 0.9.8a1

2010-12-12 Thread Christof

what is it
--
A Python package to parse and build CSS Cascading Style Sheets.
(Not a renderer though!)


about this release
--
0.9.8a1 is an early alpha release. Please note the *major* changes in 
the css value API.



main changes

+ **API CHANGE (major)**
replace CSSValue with PropertyValue, Value and other classes.

NEW CLASSES:
:class:`cssutils.css.PropertyValue`
replaces CSSValue and CSSValueList

- is iterable (iterates over all single Value objects which 
in soruce CSS might be separated by , / or  
- a comma separated list of IDENT values is no longer 
handled as a single String (e.g. ``Arial, sans-serif``)


:class:`cssutils.css.Value`
replaces CSSPrimitiveValue with separate ``value`` and 
``type`` info (value is typed, so e.g. string for e.g. STRING, IDENT or 
URI values, int or float) and is base class for more specific values like:


:class:`cssutils.css.URIValue`
replaces CSSPrimitiveValue, additional attribute ``uri``

:class:`cssutils.css.DimensionValue`
replaces CSSPrimitiveValue, additional attribute ``dimension``

:class:`cssutils.css.ColorValue`
replaces CSSPrimitiveValue, additional attribute ``red``, 
``green``, ``blue`` and ``alpha``


**TODO: Not yet complete, only rgb, rgba, hsl, hsla and has 
values use this object and color and alpha information no done yet!**


:class:`cssutils.css.CSSFunction`
replaces CSSPrimitiveValue function, not complete yet

also renamed ``ExpressionValue`` to 
:class:`cssutils.css.MSValue` with new API


- IMPROVEMENT/CHANGE: Validation of color values is tighter now. Values 
like ``hsl(1, 2, 3)`` do not validate as it must be ``hsl(1, 2%, 3%)``. 
This mostly effects HSL/A and RGB/A notation.


- **IMPROVEMENT**: New Value parsing and API accelerate parsing of style 
declarations which take about 20-30% less time now. Of course this 
depends on the complexity of your styles.


+ BUGFIX: fixes issue #41, #42, #45, #46
PropertyValue.value returns value without any comments now, else 
use PropertyValue.cssText


- FEATURE: ``cssutils.replaceUrls()`` accepts as first argument a 
`cssutils.css.CSSStyleSheet` but now also a

:class:`cssutils.css.CSSStyle


license
---
cssutils is published under the LGPL version 3 or later, see
http://cthedot.de/cssutils/

If you have other licensing needs please let me know.

download

For download options see http://cthedot.de/cssutils/

cssutils needs Python 2.4 and higher or Jython 2.5 and higher (tested with
Python 2.7.1(x64), 2.6.5(x64), 2.5.4(x32), 2.4.4(x32) and Jython 2.5.1 
on Win7x64

only)


Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.


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

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


ANN: cssutils 0.9.7final

2010-11-29 Thread Christof

what is it
--
A Python package to parse and build CSS Cascading Style Sheets.
(Not a renderer though!)

about this release
--
0.9.7 is the final 0.9.7 release. Work on 0.9.8 has begun.

main changes

No real change but CSSValue and related classes will not be supported in 
0.9.8
anymore. 0.9.8 will feature a simplified API. Please follow its 
development if

you need any currently supported or new feature. Thanks!

license
---
cssutils is published under the LGPL version 3 or later, see
http://cthedot.de/cssutils/

If you have other licensing needs please let me know.

download

For download options see http://cthedot.de/cssutils/

cssutils needs Python 2.4 and higher or Jython 2.5 and higher (tested with
Python 2.7(x64), 2.6.5(x64), 2.5.4(x32), 2.4.4(x32) and Jython 2.5.1 on 
Win7x64

only)


Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.


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

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


ANN: cssutils 0.9.7b3

2010-06-20 Thread Christof

what is it
--
A Python package to parse and build CSS Cascading Style Sheets. (Not a 
renderer though!)


about this release
--
0.9.7b3 is a beta release but quite stable.

main changes

0.9.7b3 100620
+ API CHANGE: Changed parameters of script/utility function 
``csscombine``.
- parameter ``resolveVariables=True`` now (default was 
``False`` before)
- ``minify = True`` will not parse Comments at all. This is 
not really a change as comments were not kept in a minified stylesheet 
anyway but this may speed up stylesheet combination a bit


+ **PERFORMANCE/IMPROVEMENT**: Added parameter 
``parseComments=True`` to CSSParser. If parsing with ``parser = 
cssutils.CSSParser(parseComments=False).parse...`` comments in a given 
stylesheet are simple omitted from the resulting stylesheet DOM.


+ **PERFORMANCE**: Compiled productions in cssutils tokenizer are 
cached now (to clear it use 
``cssutils.tokenize2._TOKENIZER_CACHE.clear()``) which results in a 
slight performance improvement. Thanks to moscovich!


license
---
cssutils is published under the LGPL version 3 or later, see 
http://cthedot.de/cssutils/


If you have other licensing needs please let me know.

download

For download options see http://cthedot.de/cssutils/

cssutils needs Python 2.4 or higher or Jython 2.5 and higher (tested 
with Python 2.6.5(x64), 2.5.4(x32), 2.4.4(x32) and Jython 2.5.1 on Win7 
64 only)



Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.


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

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


ANN: cssutils 0.9.7b2

2010-06-07 Thread Christof

what is it
--
A Python package to parse and build CSS Cascading Style Sheets. (Not a 
renderer though!)


about this release
--
0.9.7b2 is a beta release but quite stable...

main changes

0.9.7b2 100606
+ IMPROVEMENT/BUGFIX: CSSFunction value parameters may contain HASH 
values like ``#fff`` now. These are used in experimental properties like 
``-moz-linear-gradient(top,#fff,#fff 55%,#e4e4e4)``. Fixes issue #38.


+ API CHANGE: ``cssutils.ser.prefs.resolveVariables == True`` is 
the default from 0.9.7b2 as CSSVariables are not in any official 
specification yet and better reflects what you probably want after 
serializing a stylesheet...


license
---
cssutils is published under the LGPL version 3 or later, see 
http://cthedot.de/cssutils/


If you have other licensing needs please let me know.

download

For download options see http://cthedot.de/cssutils/

cssutils needs Python 2.4 or higher or Jython 2.5 and higher (tested 
with Python 2.6.5(x64), 2.5.4(x32), 2.4.4(x32) and Jython 2.5.1 on Win7 
64 only)



Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.


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

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


ANN: cssutils 0.9.7b1

2010-05-31 Thread Christof

what is it
--
A Python package to parse and build CSS Cascading Style Sheets. (Not a 
renderer though!)


about this release
--
0.9.7b1 is a beta release but quite stable now I guess...

main changes

0.9.7b1 optimizes handling speed of CSSVariables *a lot*...

changes
+ **API CHANGE**: Child objects like the ``cssRules`` of a 
``CSSStyleSheet`` or ``CSSMediaRule`` are no longer kept after resetting 
the complete contents of an object (setting ``cssText``). This should 
not be expected anyway but if you relied on something like the following 
please beware::


sheet = cssutils.parseString('a { color: red}')
initial_rules = sheet.cssRules
sheet.cssText = 'b { color: green}'
# true until 0.9.6a6: assert sheet.cssRules == 
initial_rules, but now:

assert sheet.cssRules != initial_rules

+ **IMPROVEMENT**: Massive speed improvement of handling of 
CSSVariables of a stylesheet which due to naive implementation was 
unbelievable slow when using a lot of vars... Should now scale a lot 
better, about factor 5-20 depending of amount of variables used.
+ IMPROVEMENT: Fair amount of refactoring resulting in a bit speed 
improvement generally too
+ CHANGE: If a CSS variable should be resolved 
(``cssutils.ser.prefs.resolveVariables == true``) but no value can be 
found a WARNING is logged now. Should be an ERROR actually but as 
currently lots of fake errors are reported would probably hurt more 
than help. A future release might improve this.
+ BUGFIX: Syntax of value of CSS Fonts Module Level 3 ``src`` 
property now validates if local font name is given with a quoted name, 
e.g.: ``src: local('Yanone Kaffeesatz')``


license
---
cssutils is published under the LGPL version 3 or later, see 
http://cthedot.de/cssutils/


If you have other licensing needs please let me know.

download

For download options see http://cthedot.de/cssutils/

cssutils needs Python 2.4 or higher or Jython 2.5 and higher (tested 
with Python 2.6.5(x64), 2.5.4(x32), 2.4.4(x32) and Jython 2.5.1 on Win7 
64 only)



Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.


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

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


ANN: cssutils 0.9.7a5

2010-05-24 Thread Christof

what is it
--
A Python package to parse and build CSS Cascading Style Sheets. (Not a 
renderer though!)


about this release
--
0.9.7a5 is an alpha release but quite stable now I guess...

main changes

0.9.7 is quite a bit faster than 0.9.6.

0.9.7a5 100523
+ **API CHANGE (major)**: When setting an objects ``cssText`` (or 
``selectorText`` etc) property the underlying object is replaced with a 
new one now. E.g. if setting ``cssutils.css.CSSStyleRule.selectorText`` 
the underlying ``cssutils.css.CSSStyleRule.selectorList`` object is 
swapped to a new ``SelectorList`` object. This should be expected but 
cssutils until now kept the exact same object and changed its content 
*in-place*. Please be aware! (Also the strange ``_absorb`` method of 
some objects is gone which was used for this.)


+ **API CHANGE (minor)**: Renamed 
``cssutils.ser.prefs.keepUnkownAtRules`` to 
``cssutils.ser.prefs.keepUnkownAtRules`` due to misspelling, see Issue 
#37. A DeprecationWarning is issued on use.


+ API CHANGES (minor):
- ``cssutils.css.CSSImportRule.media`` and 
``cssutils.css.CSSMediaRule.media`` are now writable (setting with a 
string or ``cssutils.stylesheets.MediaList``)
- msg level when setting 
``cssutils.stylesheets.MediaList.appendMedium`` changed to INFO (was 
WARNING)

- ``str(cssutils.css.CSSStyleRule)`` slightly changed

- **IMPROVEMENT/BUGFIX**: Improved distribution: Egg release should 
no longer include the tests package, source release still should. Also 
added dependency package for tests (minimock) and removed documenation 
txt files from distribution (HTML still included of course). This also 
fixes Issue #36.


- IMPROVEMENT: cssutils issues a warning if a page selector is not 
one of the defined in the spec (``:first``, ``:left``, ``:right``).


- IMPROVEMENT: Refactored quite a lot and added a few tests for 
variables



license
---
cssutils is published under the LGPL version 3 or later, see 
http://cthedot.de/cssutils/


If you have other licensing needs please let me know.

download

For download options see http://cthedot.de/cssutils/

cssutils needs Python 2.4 or higher or Jython 2.5 and higher (tested 
with Python 2.6.5(x64), 2.5.4(x32), 2.4.4(x32) and Jython 2.5.1 on Win7 
64 only)



Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.


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

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


ANN: cssutils 0.9.7a6

2010-05-24 Thread Christof
Due to an incomplete release (bug in setup.py) 0.9.7a6 replaces 0.9.7a5 
with the same changes, sorry for the inconvinience...


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

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


ANN: cssutils 0.9.7a2

2009-12-31 Thread Christof

what is it
--
A Python package to parse and build CSS Cascading Style Sheets. (Not a 
renderer though!)


about this release
--
0.9.7a2 is an alpha release.

main changes

0.9.7 is quite a bit faster than 0.9.6.

0.9.7a2 091230
- **API CHANGE**: Setting a style declarations' property to 
  ``None`` or the empty string effectively removes this property
  from the declaration. See also Issue #32.

+ **BUGFIX/FEATURE**: Fixed Issue 33: URL references (like ``url()``
  values) in combined sheets are now adjusted even if sheets are
  not in the same folder. Only relative paths are adjusted.

- **BUGFIX**: Fixed parsing of FUNCTIONS in CSSUnknownRule like
  `...@bottom { counter(page) }`` which raised a false error of a
  mismatch of parenthesis

license
---
cssutils is published under the LGPL version 3 or later, see 
http://cthedot.de/cssutils/


If you have other licensing needs please let me know.

download

For download options see http://cthedot.de/cssutils/

cssutils needs Python 2.4 or higher or Jython 2.5 and higher (tested 
with Python 2.6.4(64), 2.5.4(64), 2.4.4 and Jython 2.5.1 on Win 7 64bit 
only)



Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.


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

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


ANN: cssutils 0.9.6final

2009-10-07 Thread Christof Hoeke

what is it
--
A Python package to parse and build CSS Cascading Style Sheets. (Not a 
renderer though!)


about this release
--
0.9.6 is a full release.

main changes

+ BUGFIX: Definition of macro for `positivenum` in cssutils profiles 
actually did allow nagative numbers, fixed (thanks to Jason R. Coombs)


license
---
cssutils is published under the LGPL version 3 or later, see 
http://cthedot.de/cssutils/


If you have other licensing needs please let me know.

download

For download options see http://cthedot.de/cssutils/

cssutils needs Python 2.4 or higher or Jython 2.5 and higher (tested 
with Python 2.6.3, 2.5.2, 2.4.4 and Jython 2.5.1 on Vista only)



Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.


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

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


ANN: cssutils 0.9.6b5 (bugfix release)

2009-08-30 Thread Christof Hoeke

what is it
--
A Python package to parse and build CSS Cascading Style Sheets. (Not a 
renderer though!)


about this release
--
0.9.6b5 is a bugfix release.

main changes

+ BUGFIX: Issue #30 fixed. Setup from source did not work.

license
---
cssutils is published under the LGPL version 3 or later, see 
http://cthedot.de/cssutils/


If you have other licensing needs please let me know.

download

For download options see http://cthedot.de/cssutils/

cssutils needs Python 2.4 or higher (tested with Python 2.6.2, 2.5.2, 
2.4.4 and Jython 2.5 on Vista only)



Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.


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

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


ANN: cssutils 0.9.6b4

2009-08-29 Thread Christof Hoeke

what is it
--
A Python package to parse and build CSS Cascading Style Sheets. (Not a 
renderer though!)


about this release
--
0.9.6b4 is a bugfix release.

main changes

+ BUGFIX: Issue #29 fixed. Double defined namespaces are replaced with a 
single (the last one) now.


- IMPROVEMENT: ``cssutils.resolveImports`` now keeps media information 
when to be resolved @import rule uses these. It wraps the imported rules 
in an @media rule which uses the same media information from the @media 
rule in the original sheet.


  An xml.dom.HierarchyRequestErr may occur if an imported sheet itself 
contains @imports with media information or other rules which are not 
allowed in a @media rule like @namespace rules. In that case cssutils 
cannot resolve the @import rule and logs a WARNING but keeps the 
original @import.


license
---
cssutils is published under the LGPL version 3 or later, see 
http://cthedot.de/cssutils/


If you have other licensing needs please let me know.

download

For download options see http://cthedot.de/cssutils/

cssutils needs Python 2.4 or higher (tested with Python 2.6.2, 2.5.2, 
2.4.4 and Jython 2.5 on Vista only)



Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.


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

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


ANN: cssutils 0.9.6b3

2009-08-02 Thread Christof Hoeke

what is it
--
A Python package to parse and build CSS Cascading Style Sheets. (Not a 
renderer though!)


about this release
--
0.9.6b3 adds a few features and fixes quite a few bugs.

main changes

+ **FEATURE**: Added parsing support and new profile for details 
defined in module Fonts http://www.w3.org/TR/css3-fonts/


+ **FEATURE**: Added ``cssutils.parseStyle(cssText, 
encoding='utf-8')`` convienience function


+ **FEATURE** (experimental, request from issue #27): Added 
``css.CSSStyleDeclaration.children()`` which is a generator yielding any 
known children of a declaration including *all* properties, comments or 
CSSUnknownRules.


+ FEATURE: ``CSSStyleDeclaration.insertRule`` also accepts a 
``CSSRuleList`` now (same as ``CSSStyleSheet`` which does this for some 
time now).


+ FEATURE: Added ``CSSStyleDeclaration.keys()`` method which 
analoguous to standard dict returns property names which are set in the 
declaration.


- **API CHANGE**: Replaced attribute ``css.Property.parentStyle`` 
with ``css.Property.parent`` (``parentStyle`` is DEPRECATED now).


+ **BUGFIX**: Improved child and parent node referencing.

+ **BUGFIX**: Parsing of CSSValues with unknown function names with 
a specific length of 4 or 7 chars were resulting in a SyntaxErr. Also 
parsing of comma separated list of CSS FUNCTION values works now.


+ BUGFIX: Fixed validation problems:
- ``font-family: a   b`` (values with spaces in names without 
being quoted) are parsed now without emitting an ERROR. These are indeed 
valid but discouraged and you should use quotes (more than one space is 
compacted to a single space anyway so rather complicated without quotes)
- negative lengths for the ``font-size`` property are now 
properly reported as ERRORs


- IMPROVEMENT (minor): cssutils sets the HTTP header ``User-Agent`` 
now when fetching sheets over HTTP (with e.g. ``cssutils.parseUrl``).


- *FEATURE* (experimental): Added support to at least parse sheets 
with Microsoft only property values for ``filter`` which start with 
``progid:DXImageTransform.Microsoft.[...](``. To enable these you need 
to set::


 from cssutils import settings
 settings.set('DXImageTransform.Microsoft', True)
 cssutils.ser.prefs.useMinified()
 text = 'a {filter: 
progid:DXImageTransform.Microsoft.BasicImage( rotation = 90 )}'

 print cssutils.parseString(text).cssText

a{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=90)}


  This currently is a **major hack** but if you like to minimize 
sheets in the wild which use this kind of CSS cssutils at least can 
parse and reserialize them.


license
---
cssutils is published under the LGPL version 3 or later, see 
http://cthedot.de/cssutils/


If you have other licensing needs please let me know.

download

For download options see http://cthedot.de/cssutils/

cssutils needs Python 2.4 or higher (tested with Python 2.6.2, 2.5.2, 
2.4.4 and Jython 2.5 on Vista only)



Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.


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

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


ANN: W3C HTML batch Validator in Python

2009-06-21 Thread Christof Hoeke

what is it
--
A simple script calling the W3C HTML Validator in batch mode. Adapted 
from Perl version.



changes since the last full release
---
- BUGFIX: checks for Valid or Invalid adapted to changes of W3C HTML 
Validator HTML (the check is really naive!)

- BUGFIX: fixed saving of reports
- improvement of output
- added valid and invalid example HTML


download

download validate-1.7 - 090620 from http://cthedot.de/batchvalidator/

tested on Python 2.6.2 only but should work on other versions as it is 
really simple...


Included is a (modified) httplib_multipart.py script (originally from 
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146306) to be 
able to POST fields and files to an HTTP host as multipart/form-data.


any comment appreciated...

thanks,
Christof
--
http://mail.python.org/mailman/listinfo/python-announce-list

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


Re: Good books in computer science?

2009-06-14 Thread Christof Donat
Hi,

 Which are the classic books in computer science which one should
 peruse?

From having read this discussion up to now I'd recomend you to read code 
written by good programmers.

Christof


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


ANN: cssutils 0.9.6a4

2009-05-09 Thread Christof Hoeke

what is it
--
A Python package to parse and build CSS Cascading Style Sheets. (Not a 
renderer though!)


about this release
--
0.9.6a4 is an bugfix release.

main changes

- **API CHANGE**: Reverted handling of exceptions (issue #24) as 
this did not work with PyXML installed. You may again use ``str(e)`` on 
any raised xml.dom.Exception ``e``. Since 0.9.6a0 exceptions raised did 
raise a tuple of message, line and col information. Now the message 
alone is raised (again). Line and col information is still available as 
``e.line, e.col``.


+ BUGFIX: Fixed issues #22 and #23

+ BUGFIX: All examples at 
http://www.w3.org/TR/2009/CR-CSS2-20090423/syndata.html#illegalvalues 
should work now as expected


- **FEATURE**: Updated some parts to 
http://www.w3.org/TR/2009/CR-CSS2-20090423/changes.html#new (most 
changes decribed there were already done in cssutils)


- **FEATURE**: New preference option ``keepUnkownAtRules = False`` 
which defines if unknown atrules like e.g. `...@three-dee {...}`` are kept 
or not. Setting this pref to ``False`` in result removes unknown @rules 
from the serialized sheet which is the default for the minified settings.



license
---
cssutils is published under the LGPL version 3 or later, see 
http://cthedot.de/cssutils/


If you have other licensing needs please let me know.

download

For download options see http://cthedot.de/cssutils/

cssutils needs Python 2.4 or higher (tested with Python 2.6.2, 2.5.2 and 
2.4.4 on Vista only)



Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.


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

   Support the Python Software Foundation:
   http://www.python.org/psf/donations.html


ANN: cssutils 0.9.6a3

2009-04-27 Thread Christof Hoeke

what is it
--
A Python package to parse and build CSS Cascading Style Sheets. (Not a 
renderer though!)


about this release
--
0.9.6a3 is an bugfix release.

main changes

+ IMPROVEMENT: Fix for Python 2.6.2 (due to a backport from Python 2.7 
to 2.6.2 the reversed() iterator has no __length__ anymore which 
cssutils was using)


+ BUGFIX: New version of encutils (0.9)
+ BUGFIX: Fixed issue #21


license
---
cssutils is published under the LGPL version 3 or later, see 
http://cthedot.de/cssutils/


If you have other licensing needs please let me know.

download

For download options see http://cthedot.de/cssutils/

cssutils needs Python 2.4 or higher (tested with Python 2.6.2, 2.5.2 and 
2.4.4 on Vista only)



Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.


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

   Support the Python Software Foundation:
   http://www.python.org/psf/donations.html


ANN: encutils 0.9

2009-04-24 Thread Christof Hoeke

what is it
--
Encoding detection collection for Python developed mainly for use in 
cssutils but may be useful standalone too.


about this release
--
0.9 is a bugfix release.

license
---
encutils has a dual-license, please choose whatever you prefer:

* encutils is published under the LGPL 3 or later
* encutils is published under the Creative Commons License

download

For download options see http://cthedot.de/encutils/

encutils probably needs Python 2.4 or higher (tested with Python 2.6.2, 
2.5.2 and 2.4.4 on Vista only)



Bug reports, comments, etc are very much appreciated! Thanks.

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

   Support the Python Software Foundation:
   http://www.python.org/psf/donations.html


[issue5786] len(reversed([1,2,3])) does not work anymore in 2.6.2

2009-04-19 Thread Christof

Christof cthe...@gmail.com added the comment:

A compatibility break in a minor bugfix version is never a good idea I
guess. I understand the reasoning but this change may break quite a few
packages (at least it broke mine). A workaround in programs is easy but
for already released and deployed versions simply not possible. A change
for Python 2.7 would be at least annoying too but I guess could be
justified. Just my thoughts...

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5786
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



re-try 0.7: Try Python regular expressions online

2009-03-28 Thread Christof Hoeke

==
re-try
==
:version: 0.7

URL
---
http://re-try.appspot.com/


what is it
--
A small online browser application to try out Python regular expressions.
It is based on http://cthedot.de/retest/ which has been around for some 
years but I never had a Python hosting service available so was only 
availabel for download. Putting it online on GAE was very easy though. 
The source code is not available publicly, if you are interested I might 
put it on Google Code or so. It is strongly based on retest 0.6.1 so no 
real surprises anyway.


Please let me know what you think!

thanks
Christof
--
http://mail.python.org/mailman/listinfo/python-announce-list

   Support the Python Software Foundation:
   http://www.python.org/psf/donations.html


Re: Will multithreading make python less popular?

2009-02-16 Thread Christof Donat
Hi,

 But there is
 something interesting, something like multi processing. But is it a
 real alternative for multi threading. As i searched it is not, it
 requires heavy hardware requirements (lots of memory, lots of cpu
 power).

Not necessarily.

For the memory, modern operating Systems can ustilize a copy on write 
semantics in their Applications virtual memory space. That means that after 
starting a new process with fork(), the new Process shares all physical 
Memory Pages with the original one as long a none of them writes to wome 
Memory. The first write is cought by the OS. Then the Page will be copied 
and the writing process will in future use the new copy of that page while 
the other one (or eventually many) stay with the original. Multiprocessing 
needs more Memory than well optimized Multithreading, but it is not as bad 
as it is often said.

For the CPU: There are two things that make the difference here.

One ist Context Switching. When the OS switches between two threads of the 
same Process, it does not need to change the memory lookup table. When 
switching between Processes that is always necessary. Switching from a 
Thread of Process A to a Thread of Process B is just like switching from A 
to B.

Using Threads just increases the probability that the OS can do a faster 
Context Switch. So Threads are faster here, but it is not a too big issue as 
well.

The Second Thing is Communication. With Threds you can simply use variables 
to communicate between Threads. To Prevent conflicting access to those 
Variables you will use e.g. mutexes. That can be done with Shared Memory as 
well. Shared Memory is a bit more difficult to handle than simply using the 
heap, but again the impact is not really so big.

Google uses Processes for the Tabs in Chrome, because that way they get 
around many Memory Management Problems they would have with Threads or with 
a singlethreaded reactor. Using Processes is not per se a bad Idea. You pay 
a bit with Memory and CPU but in many situations you get a much simpler 
programming model.

Christof


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


ANN: cssutils 0.9.6a1

2009-02-07 Thread Christof Hoeke

what is it
--
A Python package to parse and build CSS Cascading Style Sheets. (Not a 
renderer  though!)


main changes

0.9.6a1 090207
- refactored validation

- added Profiles. See the docs and source of the cssutils.profiles 
module for details.


- should work on GAE now properly

- ``cssutils.resolveImports(sheet)`` returns a new stylesheet with 
all rules in given sheet but with all @import rules being pulled into 
the top sheet.


-  CSSCombine script and helper function resolve nested imports now.

-  ``csscombine`` has new option ``-u URL, --url=URL URL to 
parse (path is ignored if URL given)`` now


- New documentation in Sphinx format


license
---
cssutils is published under the LGPL version 3 or later, see 
http://cthedot.de/cssutils/


If you have other licensing needs please let me know.

download

For download options see http://cthedot.de/cssutils/


Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.


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

   Support the Python Software Foundation:
   http://www.python.org/psf/donations.html


Re: Bitwise 2009 ($5000 prize money)

2009-02-03 Thread Christof Donat
Hi,

 http://www.bitwise.iitkgp.ernet.in/

I'm having quite some fun reading the questions since I got this Post in 
comp.lang.c++ before. Here it is of topic and this crosspostings will 
definatelly not be a good advertisement for your contest.

Christof

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


Re: what IDE is the best to write python?

2009-02-02 Thread Christof Donat
Hi,

  Just to register a contrary opinion: I *hate* syntax highlighting
 
 With vim you simply don't turn it on. Would that be OK for you?
 
 No. Even the /possibility/ of having syntax highlighting would indicate
 wimpness and thus humiliate me.

Ah, I guess you are using butterflies then: http://xkcd.com/378/

Christof

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


Re: what IDE is the best to write python?

2009-02-02 Thread Christof Donat
Hi,

 Just to register a contrary opinion: I *hate* syntax highlighting

With vim you simply don't turn it on. Would that be OK for you?

Christof

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


Re: what IDE is the best to write python?

2009-02-01 Thread Christof Donat
Hi,

 IMHO, scripting languages like Python are generally better suited to
 working with a text editor than an IDE.
   
 I don't understand that, because in my opinion yields
   IDE = texteditor + (much) more
 please could you explain (as I'm very interested in user interfaces in
 general )

Try to think of the operating system as the IDE. At least with Unix and 
similar systems that is a really powerfull solution. It includes not only 
vim, bash and make, but also stuff like e.g. ctags, awk, sed, etc. Even 
python itsself is part of the system and can be used for special purpous 
utilities like e.g. code generators.

If you need User Interface Design, there are quite powerful stand alone 
tools, like e.g. the QtDesigner which can be used with that OS IDE.

Christof


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


ANN: cssutils 0.9.5.1

2008-08-11 Thread Christof Hoeke

what is it
--
A Python package to parse and build CSS Cascading Style Sheets. (Not a 
renderer  though!)


about this release
--
0.9.5.1 is a bugfix release.

main changes

0.9.5.1 080811
+ **BUGFIX**: Fixed parsing of ``}a,b`` which resulted in TypeError 
until now.


+ **BUGFIX**: A rule with a selector using an undefined and 
therefor invalid namespace prefix is ignored now.


+ **BUGFIX**: Removed typo in MediaList which resulted in Exception 
when parsing medialist containing ``all`` and another media.


+ **BUGFIX**: Reading imported styles may have failed under certain 
conditions with an AttributeError.


+ FEATURE: Added ``cssutils.VERSION`` which is the current release 
version, in this case e.g. ``0.9.5.1``


+ IMPROVEMENT: Optimized imports and partly removed circular ones 
which are a bit tricky...



Note:
CSSValue, CSSValueList, and CSSPrimitiveValue and the relevant 
methods/properties Property.cssValue and 
CSSStyleDeclaration.getPropertyCSSValue are more or less DEPRECATED and 
will probably be replaced with interfaces defined in CSSOM. For now use 
the properties and methods that handle values as simple strings, e.g. 
``Property.value``. As the aforementioned classes are not hardly that 
useful anyway this should not be a big problem but please beware if you 
use or have used them.


If you think this a bad idea please let me know!


license
---
cssutils is published under the LGPL version 3 or later, see 
http://cthedot.de/cssutils/


If you have other licensing needs please let me know.

download

For download options see http://cthedot.de/cssutils/

cssutils needs Python 2.4 or higher (tested with Python 2.5.2 on Vista only)


Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.


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

   Support the Python Software Foundation:
   http://www.python.org/psf/donations.html


ANN: cssutils 0.9.5final

2008-07-30 Thread Christof Hoeke

what is it
--
A Python package to parse and build CSS Cascading Style Sheets. (Not a 
renderer  though!)


release
---
0.9.5 had been in development for about half a year and this is the 
first *final* release for quite some time now - actually the last has 
been 0.6 ... It is nevertheless definitely not perfect but tests have 
been expanded, included scripts should all work and all examples on the 
website have been checked. 0.9.6 will start soon ...


main changes

0.9.5 080730
 - **API CHANGE**: If a new medium is trying to be appended to a 
``MediaList`` already set to ``all`` an 
``xml.dom.InvalidModificationErr`` is raised. The exception to this 
handling is adding ``handheld`` which is a special case for Opera and 
kept for now. This special handling may be removed in the future. A 
``WARNING`` is logged in any case.


- **BUGFIX**: Fixed reference error in @import rule preventing 
change of the used ``MediaList``.


- **BUGFIX**: Deeply nested ``CSSImportRule``\ s with different 
encodings  should keep the encoding as defined (via HTTP, parendSheet, 
@charset etc) now.  Therefor ``cssutils.util._readUrl`` does return 
``(encoding, enctype, decodedCssText)`` now where ``enctype`` is a 
number from 0 to 5 indicating which encoding type was used: 0 for 
encoding override, 1 for HTTP encoding, 2 for BOM or @charset rule, (3 
is unused currently), 4 for encoding of the parent sheet and 5 if 
encoding defaults to UTF-8 as no other information is available. (This 
may later be done as constants but this function should not be used from 
programs generally).


- **BUGFIX**: Replaced usage of ``WindowsError`` with ``OSError``. 
I (naively ;) thought ``WindowsError`` at least be present in 
environments other than Windows but it just results in a 
``NameError``... The part of the API which triggered this Exception is 
an @import rule with an invalid or local (file) URI so should have 
happened quite rarely anyway.


+ IMPROVEMENT: Standalone scripts ``csscombine`` and ``csscapture`` 
are available for programmatic use in ``cssutils.script.csscombine`` and 
``cssutils.script.CSSCapture`` res.
+ IMPROVEMENT: ``cssutils.script.csscombine`` and ``csscombine`` 
script do use the cssutils log now instead of just writing messages to 
``sys.stderr``

+ IMPROVEMENT: Optimized and refactored tokenizer (CHARSET_SYM).

Note:
CSSValue, CSSValueList, and CSSPrimitiveValue and the relevant 
methods/properties Property.cssValue and 
CSSStyleDeclaration.getPropertyCSSValue are more or less DEPRECATED and 
will probably be replaced with interfaces defined in CSSOM. For now use 
the properties and methods that handle values as simple strings, e.g. 
``Property.value``. As the aforementioned classes are not hardly that 
useful anyway this should not be a big problem but please beware if you 
use or have used them.


If you think this a bad idea please let me know!


license
---
cssutils is published under the LGPL version 3 or later, see 
http://cthedot.de/cssutils/


If you have other licensing needs please let me know.

download

For download options see http://cthedot.de/cssutils/

cssutils needs Python 2.4 or higher (tested with Python 2.5.2 on Vista only)


Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.


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

   Support the Python Software Foundation:
   http://www.python.org/psf/donations.html


SOAPpy WSDL problem: namespace of schema and import match error

2008-07-28 Thread Christof Winter

I am trying to use a webservice with SOAPpy:

import SOAPpy
intact_wsdl = http://www.ebi.ac.uk/intact/binary-search-ws/binarysearch?wsdl;
intact_serv = SOAPpy.WSDL.Proxy(intact_wsdl)

The resulting error message is posted below. If I understand it right, 
XMLSchema.py complains about the imported XSD namespace being the same as the 
existing targetNamespace.


Perl and Java have no problems with the WSDL document (see sample code at 
http://www.ebi.ac.uk/~intact/devsite/remote/binarysearch_ws.html)


My question:
- Is there a problem with the WSDL file being not valid?
- Is there a problem with the Python SOAP/WSDL implementation?

Any suggestions?

Christof


Traceback (most recent call last):
  File testEBIIntactWebservice.py, line 3, in module
intact_serv = SOAPpy.WSDL.Proxy(intact_wsdl)
  File /var/lib/python-support/python2.5/SOAPpy/WSDL.py, line 62, in __init__
self.wsdl = reader.loadFromStream(stream, wsdlsource)
  File /var/lib/python-support/python2.5/SOAPpy/wstools/WSDLTools.py, line 
34, in loadFromStream
wsdl.load(document)
  File /var/lib/python-support/python2.5/SOAPpy/wstools/WSDLTools.py, line 
260, in load
schema = reader.loadFromNode(WSDLToolsAdapter(self), item)
  File /var/lib/python-support/python2.5/SOAPpy/wstools/XMLSchema.py, line 
80, in loadFromNode
schema.load(reader)
  File /var/lib/python-support/python2.5/SOAPpy/wstools/XMLSchema.py, line 
1076, in load
tp.fromDom(node)
  File /var/lib/python-support/python2.5/SOAPpy/wstools/XMLSchema.py, line 
1177, in fromDom
raise SchemaError, 'namespace of schema and import match'
SOAPpy.wstools.XMLSchema.SchemaError: namespace of schema and import match


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


Re: SOAPpy WSDL problem: namespace of schema and import match error

2008-07-28 Thread Christof Winter

Christof Winter wrote, On 28.07.2008 12:32:

I am trying to use a webservice with SOAPpy:

import SOAPpy
intact_wsdl = http://www.ebi.ac.uk/intact/binary-search-ws/binarysearch?wsdl;
intact_serv = SOAPpy.WSDL.Proxy(intact_wsdl)


[...]


My question:
- Is there a problem with the WSDL file being not valid?


I just figured out that this could indeed be true. The WSDL document contains an 
XML Schema import that probably should be an XML Schema include:


The import element is used to add multiple schemas with different target 
namespace to a document.

http://www.w3schools.com/schema/el_import.asp

The include element is used to add multiple schemas with the same target 
namespace to a document.

http://www.w3schools.com/schema/el_include.asp

Maybe I should post this to comp.text.xml

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


ANN: cssutils 0.9.5rc1

2008-07-09 Thread Christof Hoeke

what is it
--
A Python package to parse and build CSS Cascading Style Sheets. (Not a 
renderer  though!)


As there have been quite a few bugfixes and also some minor changes this 
is a release candidate and not the final release yet.



main changes

0.9.5rc1 080709
- **API CHANGE/FEATURE**: ``The cssutils.log`` may be partly used 
like a standard logging log. The following methods are available: 
('setLevel', 'getEffectiveLevel', 'addHandler', 'removeHandler') as well 
as all messaging calls like 'error', 'warning' etc.


  Therefor ``cssutils.log.setloglevel`` has been *DEPRECATED* and 
should be used via ``cssutils.log.setLevel``. The old method is still 
available though.


  ``cssutils.log.setlog`` has been renamed to 
``cssutils.log.setLog`` but is still available but *DEPRECATED* too.


- **FEATURE**: All three decoders in the codec now have an 
additional ``force`` argument. If ``force`` is false, the encoding from 
the input will only by used if is is detected explicitely via BOM or 
@charset rule.


- **FEATURE**: ``cssparse`` script has new option ``-m --minify`` 
which results in the parsed CSS to be serialized minified


- **FEATURE**: ``CSSCapture`` and ``csscombine`` are now available 
not only as standalone scripts but also via 
``cssutils.script.CSSCapture`` and ``cssutils.script.csscombine`` 
repectively so you can use them programmatically now.


- **BUGFIX**: A space after @rule keyword is added when serializing 
minified something like [EMAIL PROTECTED] all{}``. Until now it was 
[EMAIL PROTECTED] which is recognized by Safari only and may not be valid 
at all.


- **BUGFIX**: Properties of rules set via ``css.CSSStyleSheet.add`` 
or ``.insert`` were not set properly, e.g. ``parentStyleSheet`` or the 
stylesheet handling of new @import rules was buggy.


- BUGFIX: Encountering OSError during resolving @import does not 
throw an error anymore but the resulting CSSImportRule.styleSheet will 
have a value of ``None``. OSError will probably only happen when using 
``parseFile``.


- **BUGFIX/IMPROVEMENT**: A style sheet with ``href == None`` (e.g. 
parsed with ``parseString()`` or build completely from scratch) uses 
``os.getcwd()`` as its base href now to be able to resolve CSSImportRules.


- **BUGFIX/IMPROVEMENT**: Rewrote ``csscombine`` script which 
should be much more stable now and handles namespaces correctly. Nested 
imports are still not resolved yet but this may come in the next release.


- BUGFIX/IMPROVEMENT: Added catching of WindowsError to default 
fetcher (e.g. is a file URL references a file not present).


- **BUGFIX/CHANGE**: Redone ``csscapture`` script. A few minor 
method changes (parameter ``ua`` of ``capture`` has been replaced by 
init parameter) and lots of internal improvement has been done.


- CHANGE: ``CSSStyleSheet.add(rule)`` simply appends rules with no 
specific order in the sheet to the end of it. So e.g. COMMENTs, 
STYLE_RULEs, etc are appended while rules with a specific place are 
ordered-in as before (e.g. IMPORT_RULE or NAMESPACE_RULE). Until now 
rules of a specific type like COMMENTs were ordered together which does 
not really make sense. The ``csscombine`` script needs this 
functionality and the resulting combined sheets should be more readable 
and understandable now.


- CHANGE: Default URL fetcher emits an ERROR instead of a warning 
if finding a different mine-type than ``text/css``.

- a few other changes, bugfixes  and improvements

Note:
CSSValue, CSSValueList, and CSSPrimitiveValue and the relevant 
methods/properties Property.cssValue and 
CSSStyleDeclaration.getPropertyCSSValue are more or less DEPRECATED and 
will probably be replaced with interfaces defined in CSSOM. For now use 
the properties and methods that handle values as simple strings, e.g. 
``Property.value``. As the aforementioned classes are not hardly that 
useful anyway this should not be a big problem but please beware if you 
use or have used them.


If you think this a bad idea please let me know!


license
---
cssutils is published under the LGPL version 3 or later, see 
http://cthedot.de/cssutils/


If you have other licensing needs please let me know.

download

For download options see http://cthedot.de/cssutils/

cssutils needs Python 2.4 or higher (tested with Python 2.5.2 on Vista only)


Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.


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

   Support the Python Software Foundation:
   http://www.python.org/psf/donations.html


ANN: cssutils 0.9.5b3

2008-06-07 Thread Christof Hoeke

what is it
--
A Python package to parse and build CSS Cascading Style Sheets. (Not a 
renderer  though!)


main changes

0.9.5b3
- **API CHANGE**: ``parse()`` is *DEPRECATED*, use ``parseFile()`` 
instead. I know this should not happen in a release already in beta but 
better now than later and currently both ways are still possible.


- **FEATURE'**: CSSStyleDeclatation objects may be used like 
dictionaries now. The value during setting a property may be a single 
value string or a tuple of ``(value, priority)``


- **FEATURE**: While reading an imported styleSheet all relevant 
encoding parameters (HTTP headers, BOM/@charset, etc) are used now as 
defined in http://www.w3.org/TR/CSS21/syndata.html#charset


Additionally a given parameter ``encoding`` for 
``parseString``, ``parseFile`` and ``parseUrl`` functions/methods 
**overrides** any detected encoding of read sheet like HTTP information 
or @charset rules. Useful if e.g. HTTP information is not set properly. 
The given ``encoding`` is used for **all** imported sheets of the parsed 
one too! This is a cssutils only addition to the rules defined at 
http://www.w3.org/TR/CSS21/syndata.html#charset.


- **FEATURE**: A custom URL fetcher may be used during parsing via 
``CSSParser.setFetcher(fetcher)`` (or as an init parameter). The so 
customized parser is reusable (as all parsers are). The fetcher is 
called when an [EMAIL PROTECTED] rule is found and the referenced stylesheet 
is about to be retrieved.


- **FEATURE**: Added option ``-s --string`` to cssparse script 
which expects a CSS string to be parsed.


- **FEATURE/BUGFIX**: Parsing of CSSStyleDeclarations is improved. 
Invalid ``/color: red;color: green`` is now correctly parsed as ``color: 
green`` now. At the same time the until now parsed but invalid ``$color: 
red`` (an IE hack) is not parse anymore but correctly dismissed!


  Unknown rules in CSSStyleDeclaration are parsed now. So e.g [EMAIL PROTECTED]; 
color: red;`` which is syntactically valid is kept completely.


- **LICENSE**: cssutils is licensed under the **LGPL v3** now 
(before LGPL v2.1). This should not be a problem I guess but please be 
aware. So the former mix of LGPL 2.1 and 3 is resolved to a single LGPL 
3 license for both cssutils and the included encutils.


- a few other changes, bugfixes  and improvements

Note:
CSSValue, CSSValueList, and CSSPrimitiveValue and the relevant 
methods/properties Property.cssValue and 
CSSStyleDeclaration.getPropertyCSSValue are more or less DEPRECATED and 
will probably be replaced with interfaces defined in CSSOM. For now use 
the properties and methods that handle values as simple strings, e.g. 
``Property.value``. As the aforementioned classes are not hardly that 
useful anyway this should not be a big problem but please beware if you 
use or have used them.


If you think this a bad idea please let me know!


license
---
cssutils is published under the LGPL version 3 or later, see 
http://cthedot.de/cssutils/


If you have other licensing needs please let me know.

download

For download options see http://cthedot.de/cssutils/

cssutils needs Python 2.4 or higher (tested with Python 2.5.2 on Vista only)


Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.


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

   Support the Python Software Foundation:
   http://www.python.org/psf/donations.html


KeyError in pickle

2008-05-23 Thread christof
Hi,

I am using pickle/unpickle to let my program save its documents to
disk. While this it worked stable for a long time, one of my users now
complained, that he had a file which can't be loaded.

The traceback is:

File pickle.pyo, line 1374, in loads
File pickle.pyo, line 858, in load
KeyError: 'A'


Does anybody know this problem. How this can happen and how can I
avoid it?

Thanks,
Christof
--
http://mail.python.org/mailman/listinfo/python-list


Re: KeyError in pickle

2008-05-23 Thread christof
On 23 Mai, 10:48, Peter Otten [EMAIL PROTECTED] wrote:
 christof wrote:
  I am using pickle/unpickle to let my program save its documents to
  disk. While this it worked stable for a long time, one of my users now
  complained, that he had a file which can't be loaded.

  The traceback is:

  File pickle.pyo, line 1374, in loads
  File pickle.pyo, line 858, in load
  KeyError: 'A'

  Does anybody know this problem. How this can happen and how can I
  avoid it?

 Is this reproducible? How? If not I would guess that the file is corrupted.

 Peter

I found the problem: the user did a text export and gave the exported
file the wrong extension. So: the file was not valid python pickle. I
should add a type signature to fhe file format to avoid this.

Thanks anyway,
Christof
--
http://mail.python.org/mailman/listinfo/python-list


ANN: cssutils 0.9.5b2

2008-03-23 Thread Christof Hoeke
what is it
--
A Python package to parse and build CSS Cascading Style Sheets. (Not a 
renderer  though!)

main changes

0.9.5b2
 - **API CHANGE**: ``cssutils.parseURL`` has been renamed to 
``parseUrl`` for consistency with ``getUrls`` or ``replaceUrls``. 
Parameter ``href`` (before called ``url``) is the first and mandatory 
parameter now.

 + **BUGFIX**: Fix the streamreader in the codec: Honor the encoding 
if one is passed to the constructor instead of trying to detect it from 
the stream.

 + **BUGFIX**: Reading referenced styleSheet in CSSImportRule did 
not succeed as no encoding information is passed along. Encoding of 
referenced sheets is always retrieved via HTTP or from imported sheet 
itself. Fixed lots of unchecked cases and simplified exception handling 
when reading a referenced sheet.

 + BUGFIX: Setting ``atkeyword`` of @rules checks if it is a valid 
keyword for the specific rule. E.g. an @import rule accepts [EMAIL PROTECTED] 
but not [EMAIL PROTECTED]
 + BUGFIX: Fixed setting ``name`` of CSSImportRule. Setting ``name`` 
other than with a string results in xml.dom.SyntaxErr raised now
 + BUGFIX: ``CSSStyleSheet.type`` with a fixed value of text/css 
and other readonly properties are really readonly now



Note:
 CSSValue, CSSValueList, and CSSPrimitiveValue and the relevant 
methods/properties Property.cssValue and 
CSSStyleDeclaration.getPropertyCSSValue are more or less DEPRECATED and 
will probably be replaced with interfaces defined in CSSOM. For now use 
the properties and methods that handle values as simple strings, e.g. 
``Property.value``. As the aforementioned classes are not hardly that 
useful anyway this should not be a big problem but please beware if you 
use or have used them.

 If you think this a bad idea please let me know!


license
---
cssutils is published under the LGPL version 2.1 or later, see 
http://cthedot.de/cssutils/

The included `encutils http://cthedot.de/encutils/`__ has been updated 
to version 0.8.2 with a compatible LGPL license. `restserver.py 
http://cthedot.de/restserver/`__ has been updates to version 2.1 which 
is in the public domain now (no Creative Commons license anymore). So 
only a single license (the LGPL) is used throughout cssutils now. If you 
have other licensing needs please let me know.

download

For download options see http://cthedot.de/cssutils/

cssutils needs Python 2.4 or higher (tested with Python 2.5.2 on Vista only)


Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.

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

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


ANN: cssutils 0.9.5b1

2008-03-20 Thread Christof Hoeke
what is it
--
A Python package to parse and build CSS Cascading Style Sheets. (Not a 
renderer though!)

main changes

0.9.5b1
 - **API CHANGE**: 
``cssutils.css.CtyleSheet.replaceUrls(replacer)`` has been 
**DEPRECATED** but is available as an utility function so simply use 
``cssutils.replaceUrls(sheet, replacer)`` instead. For the why see 
``getUrls(sheet)`` below.

 - **API CHANGE/FEATURE**: ``parseString`` has a new parameter 
``encoding`` now which is used if a ``str`` is given for cssText. 
Otherwise it is ignored. (patch by doerwalter)

 - API CHANGE/FEATURE: ``.parse() .parseString()`` and constructor 
of ``CSSStyleSheet`` have a new parameter ``title`` needed for the 
cascade (yet to be implemented ;).

 + **FEATURE**: Referenced stylesheet in an @import rule is read and 
parsed now if possible. Therefor the ``href`` given during parsing 
(parameter ``href`` to the ``parse*`` functions is used. It is also 
properly set on imported rules. The ``name`` property of the @import 
rule is set as the imported sheets ``title`` property.

 + **FEATURE**: Added ``cssutils.getUrls(sheet)`` utility method to 
get all ``url(urlstring)`` values in ``CSSImportRules`` and 
``CSSStyleDeclaration`` objects (properties). As this function and the 
above mentioned ``replaceUrls(sheet, replacer)`` are useful not only for 
a single sheet but (later) also for a stylesheet list they are not 
methods of CSSStyleSheet anymore (also because they are not part of the 
official DOM spec). (patch by doerwalter)

 + FEATURE: Added ``cssutils.parseURL(url, encoding=None, ...)``

 + BUGFIX: Fixes Issue #10, using full ``$LastChangedDate: 
2008-03-19 22:47:34 +0100 (Mi, 19 Mrz 2008) $`` in source files breaks 
code for some locales. Now only in a few files this svn:keywords 
replacement is used and only to a fixed length without the problematic 
part. In all other files ``$Id: ANN.txt 1164 2008-03-19 21:47:34Z 
cthedot $`` is used which also includes simple but sufficient date 
information.

 + **BUGFIX/IMPROVEMENT**: Handling of trailing content, WS and 
comments in rules should be more consistent and properly handled now, 
added tests. Exception is ``CSSCharsetRule`` where no comments are 
allowed at all.

 - TESTS: **Tests need ``minimock`` now!** Install with 
``easy_install minimock``


Note:
 CSSValue, CSSValueList, and CSSPrimitiveValue and the relevant 
methods/properties Property.cssValue and 
CSSStyleDeclaration.getPropertyCSSValue are more or less DEPRECATED and 
will probably be replaced with interfaces defined in CSSOM. For now use 
the properties and methods that handle values as simple strings, e.g. 
``Property.value``. As the aforementioned classes are not hardly that 
useful anyway this should not be a big problem but please beware if you 
use or have used them.

 If you think this a bad idea please let me know!


license
---
cssutils is published under the LGPL version 2.1 or later, see 
http://cthedot.de/cssutils/

The included `encutils http://cthedot.de/encutils/`__ has been updated 
to version 0.8.2 with a compatible LGPL license. `restserver.py 
http://cthedot.de/restserver/`__ has been updates to version 2.1 which 
is in the public domain now (no Creative Commons license anymore). So 
only a single license (the LGPL) is used throughout cssutils now. If you 
have other licensing needs please let me know.

download

For download options see http://cthedot.de/cssutils/

cssutils needs Python 2.4 or higher (tested with Python 2.5.2 on Vista only)


Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.

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

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


SimpleHTTPServer send wrong Content-Length for text/* on Windows?

2008-02-26 Thread Christof Hoeke
hi,
I noticed while trying a simple (but still very useful) server based on 
SimpleHTTP that it does report a wrong Content-Length for text/* 
files if Windows line-end \r\n is used.

Most clients (e.g. browsers) do simply ignore a wrong Content-Length but 
there are programs that do care and simply abort handling a file given 
with a wrong Content-Length and not sending enough content afterwards. I 
had this problem specifically with Prince-XML but that seems to be based 
on curl which therefor might also be affect other products/libs.

I found this via Google:
http://mail.python.org/pipermail/python-bugs-list/2005-January/027157.html

It seems this is not a new bug and I somehow recall that in an older 
version of Python (2.4?) it did work. But in 2.5 (also 2.5.1 and 2.5.2) 
this is not working anymore.

Does anyone know if this is maybe being looked into already? I could not 
find anything in the Python Bug tracker but wanted to ask here first (I 
actually am not sure if I can add a bug report anyway).

Thanks!
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: cssutils 0.9.5a4

2008-02-22 Thread Christof Hoeke
what is it
--
A Python package to parse and build CSS Cascading Style Sheets.

main changes

0.9.5a4
 + **FEATURE**: Defining a namespace with a prefix but an empty 
namespaceURI is not allowed in XML 1.0 (but in XML 1.1). It is allowed 
in CSS and therefor also in cssutils.

 + **FEATURE**: Added property ``css.CSSImportRule.name`` and 
``css.CSSMediaRule.name`` as decribed in 
http://www.w3.org/TR/css3-cascade/#cascading. It is parsed, serialized 
and available in this new property now. Property ``name`` is a 
constructor parameter now too.

 + **FEATURE**: ``css.UnknownRule`` is now parsed properly ...

 - **BUGFIX**: Improved escaping ...

 - **BUGFIX**: Fixed serialization of namespaces in Selector 
objects. Actually all possible namespaced selectors should be preserved 
now ...

 - **BUGFIX**: Default namespace is no longer used by attribute 
selectors.

 - IMPROVEMENT: Added simple testtool for functional tests in 
/examples plus lots of smaller bugfixes, improvements and refactorings


For full details for 0.9.5a4 see the relevant CHANGELOG: 
http://cssutils.googlecode.com/svn/tags/TAG_0.9.5a4/CHANGELOG.txt

A few (minor) non-backwards compatible changes have been made, please 
see 
http://cssutils.googlecode.com/svn/tags/TAG_0.9.5a4/documentation/migrate.txt 
for migration help.


Note:
 CSSValue, CSSValueList, and CSSPrimitiveValue and the relevant 
methods/properties Property.cssValue and 
CSSStyleDeclaration.getPropertyCSSValue are more or less DEPRECATED and 
will probably be replaced with interfaces defined in CSSOM. For now use 
the properties and methods that handle values as simple strings, e.g. 
``Property.value``. As the aforementioned classes are not hardly that 
useful anyway this should not be a big problem but please beware if you 
use or have used them.

 If you think this a bad idea please let me know!


license
---
cssutils is published under the LGPL.

download

For download options for see http://cthedot.de/cssutils/

cssutils needs Python 2.4 or higher (tested with Python 2.5.1 on Vista only)


Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.

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

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


ANN: cssutils 0.9.5a2

2008-01-16 Thread Christof Hoeke
what is it
--
A Python package to parse and build CSS Cascading Style Sheets.

main changes since 0.9.5a1
--
0.9.5a2 is a Bugfix release fixing a few minor issues

for full details for 0.9.5a2 see the relevant CHANGELOG: 
http://cssutils.googlecode.com/svn/tags/TAG_0.9.5a2/CHANGELOG.txt

A few (minor) non-backwards compatible changes have been made in 0.9.5, 
please see 
http://cssutils.googlecode.com/svn/tags/TAG_0.9.5a2/documentation/migrate.txt 
for migration help.


license
---
cssutils is published under the LGPL.

download

for download options for see http://cthedot.de/cssutils/

cssutils needs Python 2.4 or higher (tested with Python 2.5 on Vista only)


bug reports, comments, etc are very much appreciated!

thanks, Christof
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


Javascript parser

2008-01-08 Thread Christof Hoeke
hello,
is there any Javascript (not just JSON) parser for Python? I saw 
http://wwwsearch.sourceforge.net/python-spidermonkey/ which seems to be 
from 2003 and unmaintained and seems to be quite complicated to get to 
work anyway :(

Using Rhino from Jython is not really an option as I'd like to work in 
(C)Python only.

thanks for any hint

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


ANN: cssutils 0.9.4b1

2007-12-29 Thread Christof Hoeke
what is it
--
A Python package to parse and build CSS Cascading Style Sheets.

main changes since 0.9.4a4
--
for full details for 0.9.4b1 see the relevant CHANGELOG: 
http://cssutils.googlecode.com/svn/tags/TAG_0.9.4b1/CHANGELOG.txt

0.9.4b1
 - **FEATURE**: Added ``csscombine`` script which currently resolves 
@import rules into the input sheet. No nested @imports are resolved yet 
and @namespace rules do not work yet though!

 + **BUGFIX**: Serializing escape sequences add a single SPACE after 
each escape. This was not present until now so a sequence like \\74 a 
did come out as \\74a which was not as intended. Also as a SPACE 
is inserted in any case all escapes are not padded to 6 digits anymore 
but are only as long as needed.

 + **BUGFIX**: Handling of illegal selectors is now same as the W3C 
CSS validator (and according the selector spec - I hope ;). Illegal 
selectors result the complete rule being dropped. Fixed are the 
following (edge) cases:

   ``a/**/b``
 Meant was probably a space between a and b (plus maybe the 
comment) but it MUST be inserted. IE and Safari nevertheless seem to 
parse this rule as ``a b`` so as if a space would be present. cssutils 
now parses this selector as intented by the spec as ``ab``.
   ``a*b``
 Again spaces around the UNIVERSAL ``*`` were probably meant by 
the author. IE and Safari seem to parse this **invalid** selector as ``a 
b``. cssutils ignores this rule completely!

 + BUGFIX: ``css.CSSRuleList`` is still a Python list but setting 
methods like ``__init__``, ``append``, ``extend`` or 
``__setslice__`` are added later on instances of this class if so 
desired. E.g. CSSStyleSheet adds ``append`` which is not available in a 
simple instance of this class! This has been changed as no validation is 
possible in CSSRuleList itself.

 + IMPROVEMENT: Added better ``str`` and ``repr`` to 
cssutils.serializer.Preferences

 + IMPROVEMENT: Added position information to some error reportings 
(Property, CSSMediaRule

 + some internal changes

license
---
cssutils is published under the LGPL.

download

for download options for see http://cthedot.de/cssutils/

cssutils needs Python 2.4 or higher (tested with Python 2.5 on Vista only)


bug reports, comments, etc are very much appreciated!

thanks, Christof
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


state of XSLT2/XPath2 or XQuery in CPython

2007-12-26 Thread Christof Hoeke
hi,
I was wondering if there is any way to use XSLT2 or maybe even XQuery 
with normal CPython. Using Saxon/XSLT2 with Jython is no problem (I 
have not tried Saxon.NET with IronPython but suspect no problem?) but I 
could not find any way to use XSLT2 or XPath Features with CPython. All 
the usual suspects 4suite or libxslt (via lxml) seem to have no support 
yet. Is there any hope I oversaw something?

Would be especially interesting for a WSGI application, so a more or 
less complicated hack via CPython-Jython-Saxon and back would probably 
not be very useful (if that is possible at all).

thanks!
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: state of XSLT2/XPath2 or XQuery in CPython

2007-12-26 Thread Christof Hoeke
Stefan Behnel wrote:
 Christof Hoeke wrote:
 I was wondering if there is any way to use XSLT2 or maybe even XQuery
 with normal CPython. Using Saxon/XSLT2 with Jython is no problem (I
 have not tried Saxon.NET with IronPython but suspect no problem?) but I
 could not find any way to use XSLT2 or XPath Features with CPython. All
 the usual suspects 4suite or libxslt (via lxml) seem to have no support
 yet. Is there any hope I oversaw something?
 
 I wouldn't know any implementation. Are you looking for a specific feature?
 Using Python functions in XPath/XSLT might get you pretty close to XPath2.

Almost full XSLT2 Support (minus XML Schema support, IMHO not too useful 
part of XSLT2) would be the best as writing templates in a general 
templating lang as XSLT is great if you use the same ones in cross-lang 
systems which are e.g. usable in Java or Python environment.

Especially XPath Support with temporary trees (and not just fragments) 
is very useful (I know EXSLT is an option, but still not quite as good 
as XSLT2). Or stuff like sequences in XPAth2 simplifies development 
quite a bit (I think the following is possible, have not used it in the 
last weeks though):
(a, b, c)[EMAIL PROTECTED]'123']

Or using sequences for ordering stuff like e.g.:

in XSLT1:
xsl:apply-templates select=a/
xsl:apply-templates select=b/

which in XSLT2 simply is:
xsl:apply-templates select=a, b/

I used the Python extension functions some years ago in Pyana and later 
in LXML which is great but these naturally very much depend on Python 
then...

I know XML and therefor also XSLT seem not the most favourite of tools 
in the Python community but for e.g. document based systems like CMS 
systems XML and XSLT is at least in my experience a great combination.

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


Re: list (range) syntax

2007-10-26 Thread Christof Winter
Ryan Ginstrom wrote:
 On Behalf Of Steven D'Aprano
 Because in common English, counting starts at 1 and ranges 
 normally include both end points (that is, it is a closed 
 interval). If you say I'll be away from the 4th to the 7th 
 and then turn up on the 7th, nearly everyone will wonder why 
 you're back a day early.
 
 Actually, I think this illustrates the point about confusion, because in the
 United States at least, the 4th to the 7th will not necessarily include
 the 7th. That's why it's common to use circumlocutions like the 4th through
 the 7th and the 4th to the 7th, inclusive when one wants to be sure.

[slightly OT]
A better example would be 10 to 12 people, which translates to 10, 11, or 12 
people and hardly ever 10 or 11 people.
-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: cssutils 0.9.4a1

2007-10-20 Thread Christof Hoeke
what is it
--
A Python package to parse and build CSS Cascading Style Sheets.


main changes since 0.9.3
-
for full details see the relevant README file 
http://cssutils.googlecode.com/svn/tags/TAG_0.9.4a1/README.txt

main changes
- **FEATURE**: Added a new module ``cssutils.codec`` that registers 
a codec that can be used for encoding and decoding CSS. 
(http://www.w3.org/TR/2006/WD-CSS21-20060411/syndata.html#q23)

 - **FEATURE**: Added implementation of ``stylesheets.MediaQuery`` 
which are part of  stylesheets.MediaList. See the complete spec at 
http://www.w3.org/TR/css3-mediaqueries/ for details.

 + **API CHANGE**: ``CSSNamespacerule.uri`` is renamed to 
``CSSNamespaceRule.namespaceURI`` which is defined is CSSOM. ``uri`` is 
deprecated and still available but the constructor parameter is named 
``namespaceURI`` in any case now.

 + **API CHANGE**: As ``stylesheets.MediaQuery`` is implemented now 
all classes using an instance of ``stylesheets.MediaList`` are presented 
slightly different. Until now a simple list of string was given, now the 
list contains MediaQuery objects.

 + **API CHANGE**: ``_Property`` has been renamed to 
``css.Property`` and is used in context of ``CSSStyleDeclaration`` and 
``MediaQuery``. Attribute ``Property.value`` has been *de-deprecated* 
and may be used normally now (again). The Property constructor has only 
optional parameters now.

 + **API CHANGE**: Removed experimental class 
``SameNamePropertyList`` which was used in ``CSSStyleDeclaration`` and 
also method ``CSSStyleDeclaration.getSameNamePropertyList``. A new 
method ``CSSStyleDeclaration.getProperties()`` has been added which is 
simpler and more useful

 + **API CHANGE**: renamed attribute ``namespaces`` of CSSStyleSheet 
and Selector to ``prefixes`` as they really are the prefixes of declared 
namespaces

 + BUGFIX: Tantek hack (using ``voice-family``) should work now as 
SameNamePropertyList is removed and properties are kept in order

 - **CHANGE**: A completely new tokenizer and mostly also the parser 
have been reimplemented in this release. Generally it should be much 
more robust and more compliant now. It will have new errors and also 
some slight details in parsing are changed.

 + **Documentation**: Added some docs in reStructuredText format 
including a basic server to view it as HTML. The HTML may be published 
as well.


license
---
cssutils is published under the LGPL.


download

for download options for cssutils 0.9.4a1 - 071020 see 
http://cthedot.de/cssutils/

cssutils needs
* Python 2.4 or higher (tested with Python 2.5 on Vista only)


bug reports, comments, etc are very much appreciated!
thanks
Christof
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


Re: 2 python questions!

2007-09-05 Thread Christof Winter
[EMAIL PROTECTED] wrote:
[...]

 Now the second question has to do with images retrieval and 
 manipulation. Which libraries do you propose to work with to 
 retrieve and resize images from the web? 

urllib.urlretrieve() and
Python Imaging Library (PIL)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to optimise this code?

2007-08-21 Thread Christof Winter
David N Montgomery wrote:
 class testCase:
 def __init__(self, tc):
 if tc == 1:self.testCase1()
 if tc == 2:self.testCase2()
 if tc == 3:self.testCase3()
 if tc == 4:self.testCase4()
 if tc == 5:self.testCase5()
 if tc == 6:self.testCase6()
 
 def testCase1(self):
 print tc1
 
 def testCase2(self):
 print tc2
 
 def testCase3(self):
 print tc3
 
 def testCase4(self):
 print tc4
 
 def testCase5(self):
 print tc5
 
 def testCase6(self):
 print tc6
 
 
 def testCaseX(self):
 print tcX
 
 totalNumberOfTestCases = 6
 x = 0
 while x = totalNumberOfTestCases:
 x += 1
 testCase(x)
 
 
 This template code is working, but I envisage having 100+ test cases and
 am concerned about my useage of if statements. I would be grateful for
 any pointers as to how I can run all tests cases, regardless of how
 many, in a more efficient manner.
 
 Thank you in advance.

To get rid of the if statements, replace __init__ function with:

 def __init__(self, tc):
 functionToCall = eval(self.testCase%s % tc)
 functionToCall()

HTH,

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


ANN: cssutils 0.9.2b3

2007-08-05 Thread Christof Hoeke
what is it
--
A Python package to parse and build CSS Cascading Style Sheets.

Partly implements the DOM Level 2 Style Stylesheets and CSS interfaces. 
An implementation of the WD CSS Module: Namespaces which has no official 
DOM yet is included from v0.9.1.

changes since 0.9.2b2
-
- added patch from Issue #6
- Issue #5 and #7 fixed

see the relevant README file 
http://cssutils.googlecode.com/svn/tags/TAG_0.9.2b3/README.txt

license
---
cssutils is published under the LGPL.

download

for download options for cssutils 0.9.2b3 - 0708004 see 
http://cthedot.de/cssutils/

cssutils needs
* Python 2.4 (tested with Python 2.5 on Windows XP only)


bug reports, comments, etc are very much appreciated!
thanks
christof
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


ANN: cssutils 0.9.2b2

2007-07-28 Thread Christof Hoeke
what is it
--
A Python package to parse and build CSS Cascading Style Sheets.

Partly implements the DOM Level 2 Style Stylesheets and CSS interfaces. 
An implementation of the WD CSS Module: Namespaces which has no official 
DOM yet is included from v0.9.1.

changes since 0.9.2b1
-
- Issue #4 fixed see the relevant README file 
http://cssutils.googlecode.com/svn/tags/TAG_0.9.2b2/README.txt

license
---
cssutils is published under the LGPL.

download

for download options for cssutils 0.9.2b2 - 070728 see 
http://cthedot.de/cssutils/

cssutils needs
* Python 2.4 (tested with Python 2.5 on Windows XP only)


bug reports, comments, etc are very much appreciated!
thanks
christof
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


Re: Want to learn Python

2007-06-15 Thread Christof Winter
Amol wrote:
 Hi, I want to learn Python in less than a month which resources should
 I use. I prefer to read books . Please give me a list of *recognized*
 resources. Thank You all

This is an excellent resource:
http://rgruet.free.fr/PQR24/PQR2.4.html

Although it's quite different from a book, I must admit.

Cheers,
Christof

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


Re: Method much slower than function?

2007-06-14 Thread Christof Winter
Gabriel Genellina wrote:
[...]
 py import timeit
 py
 py def f1():
 ...   a=
 ...   for i in xrange(10):
 ...   a+=str(i)*20
 ...
 py def f2():
 ...   a=[]
 ...   for i in xrange(10):
 ...   a.append(str(i)*20)
 ...   a=.join(a)
 ...
 py print timeit.Timer(f2(), from __main__ import f2).repeat(number=1)
 [0.42673663831576358, 0.42807591467630662, 0.44401481193838876]
 py print timeit.Timer(f1(), from __main__ import f1).repeat(number=1)
 
 ...after a few minutes I aborted the process...
 

Using

Python 2.4.4 (#2, Jan 13 2007, 17:50:26)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2

f1() and f2() also virtually take the same amount of time, although I must 
admit 
that this is quite different from what I expected.

Cheers,
Christof
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Help!!!

2007-06-13 Thread Christof Winter
Elfine Peterson Tjio wrote:
 I'm trying to make a program that reads Fasta file and print it out. I used
 the SeqIO module and the results is:
 
 'ATGGTCATSingleAlphabet()'
 
 For this purpose, should I use SeqIO or Fasta?
 
 for example:
 
 from Bio import SeqIO
 
 or
 
 from Bio import Fasta
 
 I want it to print every letter. Can anyone point me to the right direction.
 The newest biopython tutorial or book recommendation will be appreciated,
 too.

Dear Elfine:

The correct place for such a question is the BioPython discussion list at
[EMAIL PROTECTED]

You can subscribe to it here:
http://lists.open-bio.org/mailman/listinfo/biopython/

The newest BioPython tutorial (last updated 16 March 2007) can be found at
http://biopython.org/DIST/docs/tutorial/Tutorial.pdf

SeqIO and Fasta should both work fine. You could also try

  help(SeqIO)
  help(Fasta)

after your import for some further information.

Cheers,
Christof
-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: W3C batchvalidator script 1.6

2006-06-07 Thread Christof Höke
what is it
--
A short script which calls the W3C HTML Validator in batch mode. 
Adapted from a Perl version.

changes since the last release
--
New option ``UPLOADFROMURL`` to retrieve files from e.g. a local server 
which the w3 validator may not be able to access. Useful if dynamic 
pages like .php or .jsp pages need to be validated.

download

download validate-1.6 - 060606 from http://cthedot.de/batchvalidator/

tested on Python 2.4 only but should work on other versions as it is 
really quite simple...

Included is a (modified) httplib_multipart.py script (originally from 
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146306) to be 
able to POST fields and files to an HTTP host as multipart/form-data.


any comment will be appreciated, thanks
christof
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


ANN: encutils 0.4

2005-08-18 Thread Christof
Some basic helper functions to deal with encodings of text files (like 
HTML, XHTML, XML) via HTTP. Developed for cssutils but looked worth an 
independent release.

Download from http://cthedot.de/encutils/
Included are some unittests.


License
Creative Commons License
http://creativecommons.org/licenses/by/2.0/


Functions:
Note: All encodings returned are uppercase.


encodingByMediaType(media_type, log=None)

 Returns a default encoding for the given Media-Type, e.g. 'UTF-8' 
   for media-type='application/xml'. If no default encoding is available 
returns None.


getHTTPInfo(HTTPResponse, log=None)

 Returns (media_type, encoding) information from the response' 
Content-Type HTTP header (case of headers is ignored.) May be (None, 
None) e.g. if no Content-Type header is available.

getMetaInfo(text, log=None)

 Returns (media_type, encoding) information from (first) X/HTML 
Content-Type meta element if available.


getXMLEncoding(text, log=None)

 Parses XML declaration of a document (if present) (simplified). 
Returns (encoding, explicit).
 No autodetection of BOM is done yet. If no explicit encoding is 
found returns ('UTF-8', False).


guessEncoding(HTTPResponse, text, log=None)

 Tries to find the encoding of given text. Uses information in 
headers of supplied HTTPResponse, possible XML declaration and X/HTML 
meta elements.
 Returns (encoding, mismatch). Encoding is the explicit or implicit 
encoding or None and returned always uppercase. Mismatch is True if any 
mismatches between media_type, XML declaration or textcontent are found. 
More detailed mismatch reports are written to the optional log.
 Mismatches are not nessecarily errors! For details see the 
specifications..


Plan is to integrate XML autodetection (of BOM) in the next release.


I would very much welcome any feedback about spec compliance, errors or 
other problems with the functions (or the tests!).
Please use http://cthedot.de/blog/?cat=14 or http://cthedot.de/contact/.

Thanks a lot!
chris


PA HREF=http://cthedot.de/encutils/;encutils 0.4/A - basic helper 
functions to deal with encodings of text files (17-Aug-05)
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


ANN: cssutils 0.8a2 (alpha release)

2005-08-01 Thread Christof
what is it
--
A Python package to parse and build CSS Cascading Style Sheets. Partly 
implements the DOM Level 2 Stylesheets  and DOM Level 2 CSS interfaces.

The implementation uses some Python standard features like standard 
lists for classes like css.CSSRuleList and is hopefully a bit easier to use.


changes since the last release
--
**MAJOR API CHANGE**
reflecting DOM Level 2 Stylesheets and DOM Level 2 CSS
see http://cthedot.de/cssutils/ for a complete list of changes, 
examples, etc.


license
---
cssutils is published under the LGPL.


download

download cssutils 0.8a2 alpha - 050731 from http://cthedot.de/cssutils/

This is an alpha release so use at your own risk! Some parts will not 
work as expected... Any bug report is welcome.

cssutils needs
* Python 2.3 (tested with Python 2.4.1 on Windows XP only)
* maybe PyXML (tested with PyXML 0.8.4 installed)


any comment will be appreciated, thanks
christof hoeke



PA HREF=http://cthedot.de/cssutils/;cssutils 0.8a2/A - cssutils - 
CSS Cascading Style Sheets library for Python (31-Jul-05)


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

Support the Python Software Foundation:
http://www.python.org/psf/donations.html