Switch to unified view

a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
...
...
121
            self.__class__.__name__,
121
            self.__class__.__name__,
122
            self._id)
122
            self._id)
123
        return id.replace('.', '/')
123
        return id.replace('.', '/')
124
124
125
    @classmethod
125
    @classmethod
126
    def upsert(cls, id):
126
    def upsert(cls, id, **kwargs):
127
        isnew = False
127
        isnew = False
128
        r = cls.query.get(_id=id)
128
        r = cls.query.get(_id=id)
129
        if r is not None: return r, isnew
129
        if r is not None: return r, isnew
130
        try:
130
        try:
131
            r = cls(_id=id)
131
            r = cls(_id=id, **kwargs)
132
            session(r).flush(r)
132
            session(r).flush(r)
133
            isnew = True
133
            isnew = True
134
        except pymongo.errors.DuplicateKeyError: # pragma no cover
134
        except pymongo.errors.DuplicateKeyError: # pragma no cover
135
            session(r).expunge(r)
135
            session(r).expunge(r)
136
            r = cls.query.get(_id=id)
136
            r = cls.query.get(_id=id)