Changeset 2227:697604d99409 in livinglogic.python.xist

Show
Ignore:
Timestamp:
12/13/04 18:25:47 (15 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Fix: attr is a set now in Attrs.checkvalid() => don't use keys().

Remove duplicate code in Attrs.publish (call checkvalid() instead).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • _xist/xsc.py

    r2226 r2227  
    18441844        # are there any required attributes remaining that haven't been specified? => warn about it 
    18451845        if attrs: 
    1846             warnings.warn(errors.RequiredAttrMissingWarning(self, attrs.keys())) 
     1846            warnings.warn(errors.RequiredAttrMissingWarning(self, list(attrs))) 
    18471847 
    18481848    def publish(self, publisher): 
    1849         # collect required attributes 
    1850         attrs = {} 
    1851         for (key, value) in self.iteralloweditems(): 
    1852             if value.required: 
    1853                 attrs[key] = None 
     1849        if publisher.validate: 
     1850            self.checkvalid() 
    18541851        for (attrname, attrvalue) in self.iteritems(): 
    18551852            publisher.write(u" ") 
    1856             # if a required attribute is encountered, remove from the list of outstanding ones 
    1857             try: 
    1858                 del attrs[attrname] 
    1859             except KeyError: 
    1860                 pass 
    18611853            attrvalue.publish(publisher) 
    1862         # are there any required attributes remaining that haven't been specified? => warn about it 
    1863         if attrs: 
    1864             warnings.warn(errors.RequiredAttrMissingWarning(self, attrs.keys())) 
    18651854 
    18661855    def __unicode__(self):