Opened 7 years ago

Last modified 4 years ago

#543 accepted enhancement

atom feed IDs: reevalaute taguri

Reported by: Elrond Owned by:
Priority: major Milestone:
Component: programming Keywords:
Cc: Parent Tickets:

Description

Our atom feeds use taguris (RFC 4151).

First thing to re-evaluate: Do we want to/have to use taguris in this place?
There might be good reasons to want this.

taguris have the form {ownerid_namespace}:{localpart}. This is so they are human generatable AND universal unique. the {ownerid_namespace} is formed of {DNSname_or_email},{date}. The date is the time when the domain/email was owned by the author. This is so that a domain can go to a new owner, which in turn has a new namespace.

For feeds owned by a user, we can use the registration date of the user. We currently use the *current* year. Which is plain wrong. Because the id should never change after first being shipped. So this should be fixed soon.

For site feeds we currently use 2011 as the date. We probably should switch this over to something like the "deploy date". The problem is how to find out about it. We could use the date of the oldest entry in the db, but that will change when the oldest image gets deleted by the owner. ("You may not delete the master goblin image.", hoho). No easy solution currently available.

Subtickets

Change History (6)

comment:1 Changed 7 years ago by Will Kahn-Greene

I vote:

  1. make the year a configuration option
  2. if the admin doesn't provide a year, then find the oldest item in the db and use the year from a datestamp of that (or some similar guess as to when the instance was first created)

comment:2 Changed 7 years ago by spaetz

I never understood why we are not simply using the feeds URL for the id tag as is done so often, so thanks for the link to RFC 4151 for the justification. I have to say that even after reading of the RFC I remain unconvinced of the advantage of RFC 4151. The main selling argument over an URL seems to be that you can change the id when the domain owner changes hand.

Well, the domain changing hand and the feed URL remaining at the exact same location as before is certainly more of a fringe case in my book than the added complexity thinking about years, uuids and whatnot. Even if it changes hands, we'd need to either manually fudge the tag years or include logic to always calculate the correct year based on deployment (and making sure this value does not change on reinstalls or version upgrades!)

I am +1 for KISS and simply using the feeds URL as id. It is globally unique and remains across version upgrades. The feed tag not changing when the domain owner changes, that should be the least of our worries for now.

comment:3 Changed 7 years ago by joar

Lazily attaching this information:

22:52:17 < joar> if we were to use a GUID, we'd have to store that with the collection
22:59:22 < Elrond> 22:55 <joar> http://www.ietf.org/rfc/rfc4287, section 4.2.6
22:59:46 < Elrond> Can you add that to the bug? That's the one telling us, that we need something uuid-like.
23:00:08 < Elrond> ... and taguris are better than storing yet another crappy DCE-UUID.

Also, diff for proposed solution:

  • mediagoblin/user_pages/views.py

    diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py
    index dea47fb..8602c58 100644
    a b def collection_atom_feed(request): 
    539539                'href': push_url})
    540540
    541541    feed = AtomFeed(
    542                "MediaGoblin: Feed for %s's collection %s" % (request.matchdict['user'], collection.title),
    543                feed_url=request.url,
    544                id='tag:{host},{year}:collection.user-{user}.title-{title}'.format(
    545                    host=request.host,
    546                    year=datetime.datetime.today().strftime('%Y'),
    547                    user=request.matchdict['user'],
    548                    title=collection.title),
    549                links=atomlinks)
     542                "MediaGoblin: Feed for %s's collection %s" %
     543                (request.matchdict['user'], collection.title),
     544                feed_url=request.url,
     545                id=u'tag:{user}@{host},{year}:collection.slug-{slug}'\
     546                    .format(
     547                    host=request.host,
     548                    year=collection.created.strftime('%Y'),
     549                    user=request.matchdict['user'],
     550                    slug=collection.slug),
     551                links=atomlinks)
    550552
    551553    for item in cursor:
    552554        entry = item.get_media_entry

-- https://gist.github.com/dfca244ce0d4b588453b

comment:4 Changed 6 years ago by Elrond

Owner: set to Elrond
Status: newin_progress

Okay. I'll revisit this fully the next week. I need to reread a bunch of things and understand them.

comment:5 Changed 5 years ago by Elrond

Owner: Elrond deleted
Status: in_progressaccepted

Okay, I have no idea, what's going on here, I am completely out of the loop. Someone else should revisit this.

comment:6 Changed 4 years ago by Loic Dachary

Type: defectenhancement
Note: See TracTickets for help on using tickets.