def parse_addon(pkg, addon=None, check=True):
 name = getattr(pkg, 'name', pkg)
 if name.endswith('.xml'):
  parsed = parse_search(pkg, addon)
 else:
  parsed = parse_xpi(pkg, addon, check)
 if (addon and (addon.type != parsed['type'])):
  msg = _('<em:type> in your install.rdf (%s) does not match the type of your add-on on AMO (%s)')
  raise forms.ValidationError((msg % (parsed['type'], addon.type)))
 return parsed

def parse_addon ( pkg , addon = None , check = True ) : name = getattr ( pkg , 'name' , pkg ) if name . endswith ( '.xml' ) : parsed = parse_search ( pkg , addon ) else : parsed = parse_xpi ( pkg , addon , check ) if ( addon and ( addon . type != parsed [ 'type' ] ) ) : msg = _ ( '<em:type> in your install.rdf (%s) does not match the type of your add-on on AMO (%s)' ) raise forms . ValidationError ( ( msg % ( parsed [ 'type' ] , addon . type ) ) ) return parsed
pkg is a filepath or a django .