cofounders / freyalove

Love is in the air.
2 stars 1 forks source link

API: GET /users/:id/profile/ #39

Open njyo opened 12 years ago

njyo commented 12 years ago

Returns: User

Currently, this returns an incorrect object.

njyo commented 12 years ago

Also, we need to return, if this user has a current match request pending… TBD.

sebdeckers commented 12 years ago

Add that flag to the API definition of a user

sebdeckers commented 12 years ago

Add that flag to the API definition of a user.

qoelet commented 12 years ago

Fixed in https://github.com/cofounders/freyalove/commit/b21106bd1628ae7e555884b09f634421523d006c

njyo commented 12 years ago

Seb, please verify.

sebdeckers commented 12 years ago

@kennyshen Is this a bug?

http://freyalove.cofounders.sg/api/users/1/profile/

DatabaseError at /users/1/profile/
column users_profile.user_object_id does not exist
LINE 1: ..."."details_id", "users_profile"."permissions_id", "users_pro...
                                                             ^
Request Method: GET
Request URL:    http://api.freyalove.cofounders.sg/users/1/profile/
Django Version: 1.4
Exception Type: DatabaseError
Exception Value:    
column users_profile.user_object_id does not exist
LINE 1: ..."."details_id", "users_profile"."permissions_id", "users_pro...
                                                             ^
Exception Location: /home/ec2-user/_env/lib/python2.6/site-packages/django/db/backends/postgresql_psycopg2/base.py in execute, line 52
Python Executable:  /usr/bin/python
Python Version: 2.6.8
Python Path:    
['/home/ec2-user/freyalove',
 '/home/ec2-user/_env/lib/python2.6/site-packages/distribute-0.6.24-py2.6.egg',
 '/home/ec2-user/_env/lib/python2.6/site-packages/pip-1.1-py2.6.egg',
 '/usr/lib/python2.6/site-packages/virtualenv-1.7.1.2-py2.6.egg',
 '/usr/lib64/python26.zip',
 '/usr/lib64/python2.6',
 '/usr/lib64/python2.6/plat-linux2',
 '/usr/lib64/python2.6/lib-tk',
 '/usr/lib64/python2.6/lib-old',
 '/usr/lib64/python2.6/lib-dynload',
 '/usr/lib64/python2.6/site-packages',
 '/usr/lib64/python2.6/site-packages/gtk-2.0',
 '/usr/lib/python2.6/site-packages',
 '/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info',
 '/home/ec2-user/_env/lib/python2.6/site-packages',
 '/home/ec2-user/freyalove/freyalove',
 '/home/ec2-user/freyalove/freyalove/..']
Server time:    Wed, 22 Aug 2012 15:24:02 +0800
sebdeckers commented 12 years ago

FYI this also appears on requests to /profile #77

qoelet commented 12 years ago

should be resolved: was 2 things, 1) a nameclash error in the migration tables and 2) some typos i just fixed. if anymore errors post screenshot.

sebdeckers commented 12 years ago

Currently id needs to be a sequence of digits but FB users also have human-readable alternative like veronism or sebastiaan.deckers. Would those work if you just changed the router pattern or does the FB API only accept the numeric user ID?

sebdeckers commented 12 years ago

My mistake, it's not just looking for digits. Yet somehow this does not seem to work: http://freyalove.cofounders.sg/api/users/sebastiaan.deckers/profile/

Page not found (404)
Request Method: GET
Request URL:    http://api.freyalove.cofounders.sg/users/sebastiaan.deckers/profile/
Using the URLconf defined in freyalove.urls, Django tried these URL patterns, in this order:
^nimdatux/
^grappelli/
^profile/details/$
^profile/unregister/$
^profile/$
^users/facebookfriends/$
^users/search/(?P<query>[-\w+]+)/$
^users/friends/leaderboard/summary/$
^users/(?P<fb_username>[-\w]+)/profile/$
^users/(?P<fb_username>[-\w]+)/profile/summary/$
^users/(?P<fb_username>[-\w]+)/friends/$
^users/friends/(?P<fb_username>[-\w]+)/mutual/$
^activities/sexytimes/upcoming/$
^activities/winks/unreturned/$
^activities/$
^activities/sexytimes/create/$
^activities/sexytimes/(\d+)/rsvp/$
^activities/sexytimes/(\d+)/notes/add/$
^activities/winks/to/(\d+)/$
^conversations/$
^conversations/(?P<username_list>[-\w+]+)/delete/$
^conversations/(?P<username_list>[-\w+]+)/messages/$
^conversations/message/$
^stream/unread/$
^matchmaker/recommendations/$
^matchmaker/match/$
^matchmaker/(?P<userid_list>[-\w+]+)/questions/answered/$
^users/(?P<fb_username>[-\w]+)/questionnaire/categories/$
^users/(?P<fb_username>[-\w]+)/questionnaire/questions/random/(?P<status>[-\w]+)/$
^users/(?P<fb_username>[-\w]+)/questionnaire/(?P<category>[-\w]+)/(?P<status>[-\w]+)/$
^questionnaire/questions/add/$
^$
The current URL, users/sebastiaan.deckers/profile/, didn't match any of these.
qoelet commented 12 years ago

it currently accepts both now, the Facebook id or the readable username.

so say a user called Jennifer has username "jennfer" and id 2352522356 on Facebook,

/api/users/jennfer/profile/ or /api/users/2352522356/profile/ works

On Aug 22, 2012, at 4:25 PM, Sebastiaan Deckers wrote:

Currently id needs to be a sequence of digits but FB users also have human-readable alternative like veronism or sebastiaan.deckers. Would those work if you just changed the router pattern or does the FB API only accept the numeric user ID?

— Reply to this email directly or view it on GitHub.

Kenny Shen Web Developer @: kenny@northpole.sg M: +65 8627 7499 _ "The union of the mathematician with the poet, fervor with measure, passion with correctness, this surely is the ideal."

qoelet commented 12 years ago

my bad, your username has a '.' in it, the regex is not expecting that. will check what are the fb username conventions and update that later on On Aug 22, 2012, at 4:26 PM, Sebastiaan Deckers wrote:

My mistake, it's not just looking for digits. Yet somehow this does not seem to work: http://freyalove.cofounders.sg/api/users/sebastiaan.deckers/profile/

Page not found (404) Request Method: GET Request URL: http://api.freyalove.cofounders.sg/users/sebastiaan.deckers/profile/ Using the URLconf defined in freyalove.urls, Django tried these URL patterns, in this order: ^nimdatux/ ^grappelli/ ^profile/details/$ ^profile/unregister/$ ^profile/$ ^users/facebookfriends/$ ^users/search/(?P[-\w+]+)/$ ^users/friends/leaderboard/summary/$ ^users/(?P[-\w]+)/profile/$ ^users/(?P[-\w]+)/profile/summary/$ ^users/(?P[-\w]+)/friends/$ ^users/friends/(?P[-\w]+)/mutual/$ ^activities/sexytimes/upcoming/$ ^activities/winks/unreturned/$ ^activities/$ ^activities/sexytimes/create/$ ^activities/sexytimes/(\d+)/rsvp/$ ^activities/sexytimes/(\d+)/notes/add/$ ^activities/winks/to/(\d+)/$ ^conversations/$ ^conversations/(?P[-\w+]+)/delete/$ ^conversations/(?P[-\w+]+)/messages/$ ^conversations/message/$ ^stream/unread/$ ^matchmaker/recommendations/$ ^matchmaker/match/$ ^matchmaker/(?P[-\w+]+)/questions/answered/$ ^users/(?P[-\w]+)/questionnaire/categories/$ ^users/(?P[-\w]+)/questionnaire/questions/random/(?P[-\w]+)/$ ^users/(?P[-\w]+)/questionnaire/(?P[-\w]+)/(?P[-\w]+)/$ ^questionnaire/questions/add/$ ^$ The current URL, users/sebastiaan.deckers/profile/, didn't match any of these. — Reply to this email directly or view it on GitHub.

Kenny Shen Web Developer @: kenny@northpole.sg M: +65 8627 7499 _ "The union of the mathematician with the poet, fervor with measure, passion with correctness, this surely is the ideal."

sebdeckers commented 12 years ago

https://www.facebook.com/help/?faq=221211977906490#Will-username-URLs-be-available-in-multiple-languages

Usernames can only contain alphanumeric characters (A-Z, 0-9) or a period ("."). We're looking at how we may potentially support non-romanized characters in the future.

qoelet commented 12 years ago

Updating and deploying back to server now. On Aug 22, 2012, at 4:53 PM, Sebastiaan Deckers wrote:

https://www.facebook.com/help/?faq=221211977906490#Will-username-URLs-be-available-in-multiple-languages

Usernames can only contain alphanumeric characters (A-Z, 0-9) or a period ("."). We're looking at how we may potentially support non-romanized characters in the future.

— Reply to this email directly or view it on GitHub.

Kenny Shen Web Developer @: kenny@northpole.sg M: +65 8627 7499 _ "The union of the mathematician with the poet, fervor with measure, passion with correctness, this surely is the ideal."