Switch to unified view

a/Allura/allura/model/neighborhood.py b/Allura/allura/model/neighborhood.py
1
import logging
2
1
from ming import schema as S
3
from ming import schema as S
2
from ming.orm import MappedClass
4
from ming.orm import MappedClass
3
from ming.orm import FieldProperty, RelationProperty, ForeignIdProperty
5
from ming.orm import FieldProperty, RelationProperty, ForeignIdProperty
4
6
5
from pylons import request, c
7
from pylons import request, c
6
8
7
from allura.lib import plugin
9
from allura.lib import plugin
8
10
9
from .session import main_orm_session
11
from .session import main_orm_session
10
from .filesystem import File
12
from .filesystem import File
13
14
log = logging.getLogger(__name__)
11
15
12
class NeighborhoodFile(File):
16
class NeighborhoodFile(File):
13
    class __mongometa__:
17
    class __mongometa__:
14
        session = main_orm_session
18
        session = main_orm_session
15
    neighborhood_id=FieldProperty(S.ObjectId)
19
    neighborhood_id=FieldProperty(S.ObjectId)
...
...
63
    def register_project(self, shortname, user=None, user_project=False):
67
    def register_project(self, shortname, user=None, user_project=False):
64
        '''Register a new project in the neighborhood.  The given user will
68
        '''Register a new project in the neighborhood.  The given user will
65
        become the project's superuser.  If no user is specified, c.user is used.
69
        become the project's superuser.  If no user is specified, c.user is used.
66
        '''
70
        '''
67
        provider = plugin.ProjectRegistrationProvider.get()
71
        provider = plugin.ProjectRegistrationProvider.get()
68
        return provider.register_project(self, shortname, user or c.user, user_project)
72
        return provider.register_project(self, shortname, user or getattr(c,'user',None), user_project)
69
73
70
    def bind_controller(self, controller):
74
    def bind_controller(self, controller):
71
        from allura.controllers.project import NeighborhoodController
75
        from allura.controllers.project import NeighborhoodController
72
        controller_attr = self.url_prefix[1:-1]
76
        controller_attr = self.url_prefix[1:-1]
73
        setattr(controller, controller_attr, NeighborhoodController(
77
        setattr(controller, controller_attr, NeighborhoodController(