Commits

Jesper Nøhr committed 47be5fe

can exclude absolute_uri now

Comments (0)

Files changed (1)

piston/emitters.py

             """
             ret = { }
             handler = self.in_typemapper(type(data), self.anonymous)
+            get_absolute_uri = True
             
             if handler or fields:
                 v = lambda f: getattr(data, f.attname)
                     for exclude in exclude_fields:
                         if isinstance(exclude, basestring):
                             get_fields.discard(exclude)
+
+                            if exclude == 'absolute_uri':
+                                get_absolute_uri = False
+                            
                         elif isinstance(exclude, re._pattern_type):
                             for field in get_fields.copy():
                                 if exclude.match(field):
                 except: pass
             
             # absolute uri
-            if hasattr(data, 'get_absolute_url'):
+            if hasattr(data, 'get_absolute_url') and get_absolute_uri:
                 try: ret['absolute_uri'] = data.get_absolute_url()
                 except: pass
             
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.