get_absolute_url not working anymore in tip version

Issue #141 new
jonozzz
created an issue

From what I've seen so far the following code in emitters.py is never executed. This used to work fine in 0.2.2 and 0.2.3rc1.

{{{

!python

                if 'absolute_uri' in get_fields:
                    get_absolute_uri = True

}}}

As a result if you have the special field 'absolute_uri' in your fields list it will be ignored by the emitter.

Comments (1)

  1. Anonymous

    yeah it needs to be moved outside that block to look like

                if handler or fields:
                    v = lambda f: getattr(data, f.attname)
    
                    if not fields:
                        """
                        Fields was not specified, try to find teh correct
                        version in the typemapper we were sent.
                        """
                        mapped = self.in_typemapper(type(data), self.anonymous)
                        get_fields = set(mapped.fields)
                        exclude_fields = set(mapped.exclude).difference(get_fields)
    
                        if not get_fields:
                            get_fields = set([ f.attname.replace("_id", "", 1)
                                for f in data._meta.fields ])
                    
                        # sets can be negated.
                        for exclude in exclude_fields:
                            if isinstance(exclude, basestring):
                                get_fields.discard(exclude)
                                
                            elif isinstance(exclude, re._pattern_type):
                                for field in get_fields.copy():
                                    if exclude.match(field):
                                        get_fields.discard(field)
                                        
                    else:
                        get_fields = set(fields)
    
                    if 'absolute_uri' in get_fields:
                        get_absolute_uri = True    
    
  2. Log in to comment