Skip to content

Commit

Permalink
Merge 5233169 into c6624df
Browse files Browse the repository at this point in the history
  • Loading branch information
mfraezz committed May 15, 2017
2 parents c6624df + 5233169 commit 8cb0567
Show file tree
Hide file tree
Showing 249 changed files with 546 additions and 11,183 deletions.
2 changes: 1 addition & 1 deletion addons/base/generic_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from framework.exceptions import HTTPError, PermissionsError
from framework.auth.decorators import must_be_logged_in

from website.oauth.models import ExternalAccount
from osf.models import ExternalAccount

from website.util import permissions
from website.project.decorators import (
Expand Down
6 changes: 3 additions & 3 deletions addons/base/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
from website import settings
from addons.base import exceptions
from addons.base import signals as file_signals
from osf.models import FileNode, StoredFileNode, TrashedFileNode
from website.models import Node, NodeLog, User
from osf.models import (FileNode, StoredFileNode, TrashedFileNode,
OSFUser as User, AbstractNode as Node,
NodeLog, DraftRegistration, MetaSchema)
from website.profile.utils import get_gravatar
from website.project import decorators
from website.project.decorators import must_be_contributor_or_public, must_be_valid_project
from website.project.model import DraftRegistration, MetaSchema
from website.project.utils import serialize_node
from website.settings import MFR_SERVER_URL
from website.util import rubeus
Expand Down
2 changes: 1 addition & 1 deletion addons/dataverse/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from addons.dataverse.settings import DEFAULT_HOSTS
from addons.dataverse.serializer import DataverseSerializer
from dataverse.exceptions import VersionJsonNotFoundError, OperationFailedError
from website.oauth.models import ExternalAccount
from osf.models import ExternalAccount
from website.project.decorators import (
must_have_addon, must_be_addon_authorizer,
must_have_permission, must_not_be_registration,
Expand Down
2 changes: 1 addition & 1 deletion addons/github/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from addons.github.serializer import GitHubSerializer
from addons.github.utils import verify_hook_signature, MESSAGES

from website.models import NodeLog
from osf.models import NodeLog
from website.project.decorators import (
must_have_addon, must_be_addon_authorizer,
must_have_permission, must_not_be_registration,
Expand Down
8 changes: 4 additions & 4 deletions addons/osfstorage/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

from framework.exceptions import HTTPError

from addons.osfstorage.models import OsfStorageFileNode, OsfStorageFolder
from osf.models import OSFUser as User, AbstractNode as Node
from website.files import models
from website.files import exceptions
from website.project.decorators import (
must_not_be_registration, must_have_addon,
Expand Down Expand Up @@ -44,7 +44,7 @@ def wrapped(*args, **kwargs):
if 'fid' not in kwargs and default_root:
file_node = kwargs['node_addon'].get_root()
else:
file_node = models.OsfStorageFileNode.get(kwargs.get('fid'), node)
file_node = OsfStorageFileNode.get(kwargs.get('fid'), node)

if must_be and file_node.kind != must_be:
raise HTTPError(httplib.BAD_REQUEST, data={
Expand All @@ -71,8 +71,8 @@ def wrapped(payload, *args, **kwargs):
try:
user = User.load(payload['user'])
dest_node = Node.load(payload['destination']['node'])
source = models.OsfStorageFileNode.get(payload['source'], kwargs['node'])
dest_parent = models.OsfStorageFolder.get(payload['destination']['parent'], dest_node)
source = OsfStorageFileNode.get(payload['source'], kwargs['node'])
dest_parent = OsfStorageFolder.get(payload['destination']['parent'], dest_node)

kwargs.update({
'user': user,
Expand Down
2 changes: 1 addition & 1 deletion addons/osfstorage/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from framework import sessions
from framework.flask import request

from website.models import Session
from osf.models import Session
from addons.osfstorage.tests import factories
from addons.osfstorage import utils

Expand Down
6 changes: 3 additions & 3 deletions addons/osfstorage/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
from framework.auth import signing
from website.util import rubeus

from website.models import Tag
from website.files import models
from osf.models import Tag
from osf.models import files as models
from addons.osfstorage.apps import osf_storage_root
from addons.osfstorage import utils
from addons.base.views import make_auth
Expand Down Expand Up @@ -572,7 +572,7 @@ def test_delete(self):
fid = file._id
del file
# models.StoredFileNode._clear_object_cache()
assert_is(models.OsfStorageFileNode.load(fid), None)
assert_is(OsfStorageFileNode.load(fid), None)
assert_true(models.TrashedFileNode.load(fid))

def test_delete_deleted(self):
Expand Down
8 changes: 4 additions & 4 deletions addons/osfstorage/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
from framework.auth.decorators import must_be_signed

from osf.exceptions import InvalidTagError, TagNotFoundError
from osf.models import OSFUser
from osf.models import FileVersion, OSFUser
from website.project.decorators import (
must_not_be_registration, must_have_addon, must_have_permission
)
from website.project.model import has_anonymous_link

from website.files import models
from website.files import exceptions
from addons.osfstorage import utils
from addons.osfstorage import decorators
from addons.osfstorage import settings as osf_storage_settings
from addons.osfstorage.models import OsfStorageFolder


logger = logging.getLogger(__name__)
Expand All @@ -51,7 +51,7 @@ def osfstorage_update_metadata(node_addon, payload, **kwargs):
except KeyError:
raise HTTPError(httplib.BAD_REQUEST)

version = models.FileVersion.load(version_id)
version = FileVersion.load(version_id)

if version is None:
raise HTTPError(httplib.NOT_FOUND)
Expand Down Expand Up @@ -108,7 +108,7 @@ def osfstorage_move_hook(source, destination, name=None, **kwargs):
@decorators.autoload_filenode(default_root=True)
def osfstorage_get_lineage(file_node, node_addon, **kwargs):
#TODO Profile
list(models.OsfStorageFolder.find(Q('node', 'eq', node_addon.owner)))
list(OsfStorageFolder.find(Q('node', 'eq', node_addon.owner)))

lineage = []

Expand Down
2 changes: 1 addition & 1 deletion addons/owncloud/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from addons.owncloud import settings
from addons.owncloud.serializer import OwnCloudSerializer
from addons.owncloud.settings import DEFAULT_HOSTS, USE_SSL
from website.oauth.models import BasicAuthProviderMixin
from osf.models.external import BasicAuthProviderMixin
from website.util import api_v2_url
logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion addons/owncloud/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from framework.auth.decorators import must_be_logged_in

from addons.base import generic_views
from website.oauth.models import ExternalAccount
from osf.models import ExternalAccount
from website.project.decorators import (
must_have_addon)

Expand Down
2 changes: 1 addition & 1 deletion addons/s3/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from addons.base import generic_views
from addons.s3 import utils
from addons.s3.serializer import S3Serializer
from website.oauth.models import ExternalAccount
from osf.models import ExternalAccount
from website.project.decorators import (
must_have_addon, must_have_permission,
must_be_addon_authorizer,
Expand Down
2 changes: 1 addition & 1 deletion addons/zotero/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

class TestAuthViews(ZoteroTestCase, views.OAuthAddonAuthViewsTestCaseMixin, OsfTestCase):

@mock.patch('website.oauth.models.OAuth1Session.fetch_request_token')
@mock.patch('osf.models.external.OAuth1Session.fetch_request_token')
def test_oauth_start(self, mock_token):
mock_token.return_value = {
'oauth_token': 'token',
Expand Down
2 changes: 1 addition & 1 deletion admin/meetings/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from django.core.validators import validate_email

from framework.auth.core import get_user
from website.models import Conference
from osf.models import Conference
from website.conferences.exceptions import ConferenceError


Expand Down
2 changes: 1 addition & 1 deletion admin/meetings/serializers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from website.conferences.model import DEFAULT_FIELD_NAMES
from osf.models.conference import DEFAULT_FIELD_NAMES

def serialize_meeting(meeting):
is_meeting = True
Expand Down
4 changes: 2 additions & 2 deletions admin/nodes/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
from django.contrib.auth.mixins import PermissionRequiredMixin
from modularodm import Q

from website.models import NodeLog
from osf.models import NodeLog
from osf.models.user import OSFUser
from osf.models.node import Node
from osf.models.registrations import Registration
from osf.models import SpamStatus
from admin.base.views import GuidFormView, GuidView
from osf.models.admin_log_entry import (
update_admin_log,
Expand All @@ -21,7 +22,6 @@
CONFIRM_SPAM, CONFIRM_HAM)
from admin.nodes.templatetags.node_extras import reverse_node
from admin.nodes.serializers import serialize_node, serialize_simple_user_and_node_permissions
from website.project.spam.model import SpamStatus
from website.project.views.register import osf_admin_change_status_identifier


Expand Down
2 changes: 1 addition & 1 deletion admin/spam/forms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django import forms

from website.project.spam.model import SpamStatus
from osf.models import SpamStatus


class ConfirmForm(forms.Form):
Expand Down
6 changes: 3 additions & 3 deletions admin/spam/serializers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from website.settings import DOMAIN as OSF_DOMAIN
from website.project.model import User
from osf.models import OSFUser
from furl import furl


Expand All @@ -13,7 +13,7 @@ def serialize_comment(comment):

return {
'id': comment._id,
'author': User.load(comment.user._id),
'author': OSFUser.load(comment.user._id),
'author_id': comment.user._id,
'author_path': author_abs_url.url,
'date_created': comment.date_created,
Expand All @@ -31,7 +31,7 @@ def serialize_comment(comment):

def serialize_report(user, report):
return {
'reporter': User.load(user),
'reporter': OSFUser.load(user),
'category': report.get('category', None),
'reason': report.get('text', None),
}
2 changes: 1 addition & 1 deletion admin/spam/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from osf.models.comment import Comment
from osf.models.user import OSFUser
from website.project.spam.model import SpamStatus
from osf.models import SpamStatus

from osf.models.admin_log_entry import (
update_admin_log,
Expand Down
3 changes: 2 additions & 1 deletion admin_tests/pre_reg/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from modularodm import Q

from website.project.model import DraftRegistration, ensure_schemas, MetaSchema
from osf.models import DraftRegistration, MetaSchema
from website.project.model import ensure_schemas


def draft_reg_util():
Expand Down
3 changes: 1 addition & 2 deletions admin_tests/spam/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from nose import tools as nt
from datetime import timedelta

from website.project.model import Comment
from osf.models import Comment, SpamStatus

from osf.models.admin_log_entry import AdminLogEntry
from admin.spam.forms import ConfirmForm
Expand All @@ -20,7 +20,6 @@
SpamDetail,
EmailView,
)
from website.project.spam.model import SpamStatus


class TestSpamListView(AdminTestCase):
Expand Down
2 changes: 1 addition & 1 deletion api/applications/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from modularodm import Q

from website.models import ApiOAuth2Application
from osf.models import ApiOAuth2Application

from api.base.serializers import JSONAPISerializer, LinksField, IDField, TypeField, DateByVersion
from api.base.utils import absolute_reverse
Expand Down
2 changes: 1 addition & 1 deletion api/applications/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from framework.auth import cas
from framework.auth.oauth_scopes import CoreScopes

from website.models import ApiOAuth2Application
from osf.models import ApiOAuth2Application

from api.base.filters import ODMFilterMixin
from api.base.utils import get_object_or_error
Expand Down
4 changes: 2 additions & 2 deletions api/base/authentication/backends.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from osf.models.user import OSFUser
from framework.auth.core import get_user, User
from framework.auth.core import get_user
from django.contrib.auth.backends import ModelBackend

# https://docs.djangoproject.com/en/1.8/topics/auth/customizing/
Expand All @@ -12,5 +12,5 @@ def get_user(self, user_id):
try:
user = OSFUser.objects.get(id=user_id)
except OSFUser.DoesNotExist:
user = User.load(user_id)
user = OSFUser.load(user_id)
return user
3 changes: 1 addition & 2 deletions api/base/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
from api.base.settings import MAX_PAGE_SIZE
from api.base.utils import absolute_reverse

from framework.guid.model import Guid
from website.project.model import Node, Comment
from osf.models import AbstractNode as Node, Comment, Guid
from website.search.elastic_search import DOC_TYPE_TO_MODEL


Expand Down
2 changes: 1 addition & 1 deletion api/base/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from framework.auth import oauth_scopes
from framework.auth.cas import CasResponse

from website.models import ApiOAuth2Application, ApiOAuth2PersonalToken
from osf.models import ApiOAuth2Application, ApiOAuth2PersonalToken
from website.util.sanitize import is_iterable_but_not_string


Expand Down
2 changes: 1 addition & 1 deletion api/base/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
from api.base.settings import BULK_SETTINGS
from api.base.utils import absolute_reverse, extend_querystring_params, get_user_auth, extend_querystring_if_key_exists
from framework.auth import core as auth_core
from osf.models import AbstractNode as Node
from website import settings
from website import util as website_utils
from website.models import Node
from website.util.sanitize import strip_html
from website.project.model import has_anonymous_link

Expand Down
3 changes: 2 additions & 1 deletion api/base/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@

from api.base.authentication.drf import get_session_from_cookie
from api.base.exceptions import Gone
from framework.auth import Auth, User
from framework.auth import Auth
from framework.auth.cas import CasResponse
from framework.auth.oauth_scopes import ComposedScopes, normalize_scopes
from osf.models import OSFUser as User
from osf.models.base import GuidMixin
from osf.modm_compat import to_django_query
from website import settings as website_settings
Expand Down
4 changes: 2 additions & 2 deletions api/base/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from api.users.serializers import UserSerializer
from framework.auth.oauth_scopes import CoreScopes
from osf.models.contributor import Contributor
from website.models import Pointer
from website import maintenance


Expand Down Expand Up @@ -849,7 +848,8 @@ class BaseLinkedList(JSONAPIBaseView, generics.ListAPIView):
view_category = None
view_name = None

model_class = Pointer
# TODO: This class no longer exists
# model_class = Pointer

def get_queryset(self):
auth = get_user_auth(self.request)
Expand Down
2 changes: 1 addition & 1 deletion api/caching/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import requests
import logging
from website.project.model import Comment

from website import settings

Expand All @@ -15,6 +14,7 @@ def get_varnish_servers():


def get_bannable_urls(instance):
from osf.models import Comment
bannable_urls = []
parsed_absolute_url = {}

Expand Down
2 changes: 1 addition & 1 deletion api/caching/tests/test_caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from django.conf import settings as django_settings
from requests.auth import HTTPBasicAuth

from framework.auth import User
from osf.models import OSFUser as User
from tests.factories import create_fake_project
from tests.base import DbTestCase

Expand Down
Loading

0 comments on commit 8cb0567

Please sign in to comment.