Cannot access the language API data anonymously

Bug #561355 reported by David Planella
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Low
Adi Roiban

Bug Description

I was trying to get some language data using the new languages API, but I didn't seem to be able to.

Here is what I tested:

>>> from launchpadlib.launchpad import Launchpad
>>> cachedir = "/home/dpm/.launchpadlib/cache/"
>>> launchpad = Launchpad.login_anonymously('just testing', 'production', cachedir)
>>> langs = launchpad.languages
>>> print len(langs)
383
>>> for lang in langs:
... print lang.code
...
>>>

I could neither get the list of all languages nor access specific language entries.

Related branches

Revision history for this message
Adi Roiban (adiroiban) wrote :

hm....

I have tested on Karmic and it is working.

Since your session already recognized there are 383 languages, it should be working,

Also the JSON output looks good on all API versions:
https://launchpad.net/api/1.0/+languages
https://launchpad.net/api/beta/+languages
https://launchpad.net/api/devel/+languages

here is my output.
----

>>> langs[0]
<language at https://api.edge.launchpad.net/beta/+languages/ab>
>>> langs[0].code
u'ab'
>>> for lang in langs:
... print lang.code
...
ab
ace
ach
ada
ALL_OTHER_LANGUAGES

Changed in rosetta:
status: New → Incomplete
Revision history for this message
William Grant (wgrant) wrote :

lazr.restful hides objects from results unless the user holds launchpad.View over the object. The default security adapter is ViewByLoggedInUser, so anonymous users won't be able to see ILanguages. You need a ViewLanguage adapter inheriting AnonymousAuthorization.

Revision history for this message
Adi Roiban (adiroiban) wrote :

Thanks William for this explanation. Much appreciated!

Changed in rosetta:
status: Incomplete → In Progress
assignee: nobody → Adi Roiban (adiroiban)
Revision history for this message
David Planella (dpm) wrote :

I can also confirm that with authenticaded access the output is fine.

Here's the output on Lucid:

>>> cachedir = "/home/dpm/.launchpadlib/cache/"
>>> from launchpadlib.launchpad import Launchpad
>>> launchpad = Launchpad.login_with('just testing', 'edge', cachedir)
>>> langs = launchpad.languages
>>> for lang in langs[:10]:
... print lang.english_name
...
Abkhazian
Acehnese
Acoli
Adangme
Adyghe; Adygei
Afar
Afrihili
Afrikaans
Akan
Albanian
>>>

summary: - Cannot access the language API data through launchpadlib
+ Cannot access the language API data anonymously
Changed in rosetta:
importance: Undecided → Low
Revision history for this message
Ursula Junque (ursinha) wrote : Bug fixed by a commit
Changed in rosetta:
milestone: none → 10.04
status: In Progress → Fix Committed
tags: added: qa-needstesting
Adi Roiban (adiroiban)
tags: added: qa-ok
removed: qa-needstesting
Changed in rosetta:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.