Skip to content

Commit

Permalink
use relative imports
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitc committed Feb 18, 2011
1 parent b73d20b commit f7ca0d5
Show file tree
Hide file tree
Showing 27 changed files with 116 additions and 61 deletions.
18 changes: 9 additions & 9 deletions couchdbkit/__init__.py
Expand Up @@ -3,24 +3,24 @@
# This file is part of couchdbkit released under the MIT license.
# See the NOTICE for more information.

version_info = (0, 5, 3)
version_info = (0, 5, 4)
__version__ = ".".join(map(str, version_info))

try:
from couchdbkit.resource import RequestFailed,CouchdbResource
from .resource import RequestFailed,CouchdbResource

from couchdbkit.exceptions import InvalidAttachment, DuplicatePropertyError,\
from .exceptions import InvalidAttachment, DuplicatePropertyError,\
BadValueError, MultipleResultsFound, NoResultFound, ReservedWordError,\
DocsPathNotFound, BulkSaveError, ResourceNotFound, ResourceConflict, \
PreconditionFailed

from couchdbkit.client import Server, Database, ViewResults, View, TempView
from couchdbkit.consumer import Consumer
from couchdbkit.designer import document, push, pushdocs, pushapps, clone
from couchdbkit.external import External
from couchdbkit.loaders import BaseDocsLoader, FileSystemDocsLoader
from .client import Server, Database, ViewResults, View, TempView
from .consumer import Consumer
from .designer import document, push, pushdocs, pushapps, clone
from .external import External
from .loaders import BaseDocsLoader, FileSystemDocsLoader

from couchdbkit.schema import Property, Property, IntegerProperty,\
from .schema import Property, Property, IntegerProperty,\
DecimalProperty, BooleanProperty, FloatProperty, DateTimeProperty,\
DateProperty, TimeProperty, dict_to_json, dict_to_json, dict_to_json,\
value_to_python, dict_to_python, DocumentSchema, DocumentBase, Document,\
Expand Down
6 changes: 3 additions & 3 deletions couchdbkit/client.py
Expand Up @@ -42,9 +42,9 @@

from restkit.util import url_quote

from couchdbkit.exceptions import *
import couchdbkit.resource as resource
from couchdbkit.utils import validate_dbname, json
from .exceptions import *
from . import resource
from .utils import validate_dbname, json


DEFAULT_UUID_BATCH_COUNT = 1000
Expand Down
2 changes: 1 addition & 1 deletion couchdbkit/consumer/__init__.py
Expand Up @@ -4,7 +4,7 @@
# See the NOTICE for more information.


from couchdbkit.consumer.base import ConsumerBase
from .base import ConsumerBase

import pkg_resources

Expand Down
6 changes: 3 additions & 3 deletions couchdbkit/consumer/ceventlet.py
Expand Up @@ -9,9 +9,9 @@
from eventlet.greenthread import GreenThread
from eventlet import event

from couchdbkit.consumer.base import check_callable
from couchdbkit.consumer.sync import SyncConsumer
from couchdbkit.utils import json
from .base import check_callable
from .sync import SyncConsumer
from ..utils import json


class ChangeConsumer(object):
Expand Down
6 changes: 3 additions & 3 deletions couchdbkit/consumer/cgevent.py
Expand Up @@ -8,9 +8,9 @@
import gevent
from gevent import monkey

from couchdbkit.consumer.base import check_callable
from couchdbkit.consumer.sync import SyncConsumer
from couchdbkit.utils import json
from .base import check_callable
from .sync import SyncConsumer
from ..utils import json

class ChangeConsumer(gevent.Greenlet):
def __init__(self, db, callback=None, **params):
Expand Down
4 changes: 2 additions & 2 deletions couchdbkit/consumer/sync.py
Expand Up @@ -10,8 +10,8 @@
import socket
import sys

from couchdbkit.consumer.base import ConsumerBase, check_callable
from couchdbkit.utils import json
from .base import ConsumerBase, check_callable
from ..utils import json

__all__ = ['SyncConsumer']

Expand Down
2 changes: 1 addition & 1 deletion couchdbkit/designer/__init__.py
Expand Up @@ -3,4 +3,4 @@
# This file is part of couchdbkit released under the MIT license.
# See the NOTICE for more information.

from couchdbkit.designer.fs import FSDoc, document, push, pushdocs, pushapps, clone
from .fs import FSDoc, document, push, pushdocs, pushapps, clone
8 changes: 4 additions & 4 deletions couchdbkit/designer/fs.py
Expand Up @@ -13,11 +13,11 @@
import os.path
import re

from couchdbkit import client
from couchdbkit.exceptions import ResourceNotFound, DesignerError, \
from .. import client
from ..exceptions import ResourceNotFound, DesignerError, \
BulkSaveError
from couchdbkit.designer.macros import package_shows, package_views
from couchdbkit import utils
from .macros import package_shows, package_views
from .. import utils

if os.name == 'nt':
def _replace_backslash(name):
Expand Down
4 changes: 2 additions & 2 deletions couchdbkit/designer/macros.py
Expand Up @@ -37,8 +37,8 @@
import os
import re

from couchdbkit.exceptions import MacroError
from couchdbkit.utils import read_file, read_json, to_bytestring, json
from ..exceptions import MacroError
from ..utils import read_file, read_json, to_bytestring, json

logger = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions couchdbkit/ext/django/forms.py
Expand Up @@ -85,8 +85,8 @@
from django.forms import fields as f
from django.forms.widgets import media_property

from couchdbkit.ext.django import schema
from couchdbkit.schema import value_to_python
from . import schema
from ...schema import value_to_python

FIELDS_PROPERTES_MAPPING = {
"StringProperty": f.CharField,
Expand Down
5 changes: 3 additions & 2 deletions couchdbkit/ext/django/testrunner.py
Expand Up @@ -5,8 +5,9 @@

from django.test.simple import DjangoTestSuiteRunner
from django.conf import settings
from couchdbkit.ext.django import loading as loading
from couchdbkit.resource import ResourceNotFound

from . import loading
from ...exceptions import ResourceNotFound

class CouchDbKitTestSuiteRunner(DjangoTestSuiteRunner):
"""
Expand Down
7 changes: 6 additions & 1 deletion couchdbkit/ext/pylons/__init__.py
@@ -1,3 +1,8 @@
# -*- coding: utf-8 -
#
# This file is part of couchdbkit released under the MIT license.
# See the NOTICE for more information.

"""Pylons extension to simplify using couchdbkit with pylons. This features the
following:
* Simple configuration
Expand Down Expand Up @@ -82,4 +87,4 @@ class User(UserBase):
"""

from couchdbkit.ext.pylons.db import init_from_config
from .db import init_from_config
5 changes: 5 additions & 0 deletions couchdbkit/ext/pylons/auth/__init__.py
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -
#
# This file is part of couchdbkit released under the MIT license.
# See the NOTICE for more information.

5 changes: 5 additions & 0 deletions couchdbkit/ext/pylons/auth/adapters.py
@@ -1,3 +1,8 @@
# -*- coding: utf-8 -
#
# This file is part of couchdbkit released under the MIT license.
# See the NOTICE for more information.

from repoze.what.adapters import BaseSourceAdapter
from repoze.who.interfaces import IAuthenticator
from repoze.who.interfaces import IMetadataProvider
Expand Down
11 changes: 9 additions & 2 deletions couchdbkit/ext/pylons/auth/basic.py
@@ -1,5 +1,8 @@
from couchdbkit.ext.pylons.auth.adapters import GroupAdapter, PermissionAdapter, \
Authenticator, MDPlugin
# -*- coding: utf-8 -
#
# This file is part of couchdbkit released under the MIT license.
# See the NOTICE for more information.

import logging
from paste.request import parse_dict_querystring, parse_formvars
from paste.httpexceptions import HTTPUnauthorized
Expand All @@ -11,6 +14,10 @@
import sys
from zope.interface import implements

from .adapters import GroupAdapter, PermissionAdapter, \
Authenticator, MDPlugin


class BasicAuth(object):
"""A basic challenger and identifier"""
implements(IChallenger, IIdentifier)
Expand Down
10 changes: 9 additions & 1 deletion couchdbkit/ext/pylons/auth/model.py
@@ -1,7 +1,15 @@
from couchdbkit import Document, SchemaListProperty, StringProperty, StringListProperty
# -*- coding: utf-8 -
#
# This file is part of couchdbkit released under the MIT license.
# See the NOTICE for more information.

from hashlib import sha256
import os


from ...schema import Document, SchemaListProperty, StringProperty, \
StringListProperty

class Permission(Document):
name = StringProperty(required=True)

Expand Down
8 changes: 7 additions & 1 deletion couchdbkit/ext/pylons/commands.py
@@ -1,7 +1,13 @@
# -*- coding: utf-8 -
#
# This file is part of couchdbkit released under the MIT license.
# See the NOTICE for more information.

import os
from paste.deploy import loadapp
from paste.script.command import Command
from couchdbkit.ext.pylons.db import sync_design, default_design_path

from .db import sync_design, default_design_path

class SyncDbCommand(Command):
"""Syncs the CouchDB views on disk with the database.
Expand Down
10 changes: 9 additions & 1 deletion couchdbkit/ext/pylons/db.py
@@ -1,6 +1,14 @@
from couchdbkit import Document, Server, pushapps
# -*- coding: utf-8 -
#
# This file is part of couchdbkit released under the MIT license.
# See the NOTICE for more information.

import os.path

from ...client import Server
from ...designer import pushapps
from ...schema import Document

def init_from_config(config):
"""Initialize the database given a pylons config. This assumes the
configuration format layed out on the wiki. This will only initialize the
Expand Down
11 changes: 8 additions & 3 deletions couchdbkit/ext/pylons/test.py
@@ -1,11 +1,16 @@
# -*- coding: utf-8 -
#
# This file is part of couchdbkit released under the MIT license.
# See the NOTICE for more information.

from __future__ import with_statement

import os
import unittest

from couchdbkit import BaseDocsLoader, ResourceNotFound
from couchdbkit.ext.pylons.db import init_db, sync_design, default_design_path
from couchdbkit.utils import json
from ... import BaseDocsLoader, ResourceNotFound
from .db import init_db, sync_design, default_design_path
from ...utils import json

class FixtureLoader(BaseDocsLoader):
def __init__(self, directory):
Expand Down
2 changes: 1 addition & 1 deletion couchdbkit/external.py
Expand Up @@ -5,7 +5,7 @@

import sys

from couchdbkit.utils import json
from .utils import json

class External(object):
""" simple class to handle an external
Expand Down
2 changes: 1 addition & 1 deletion couchdbkit/loaders.py
Expand Up @@ -28,7 +28,7 @@
import socket
import sys

from couchdbkit.designer import push, pushapps, pushdocs
from .designer import push, pushapps, pushdocs

class BaseDocsLoader(object):
"""Baseclass for all doc loaders. """
Expand Down
6 changes: 3 additions & 3 deletions couchdbkit/resource.py
Expand Up @@ -31,10 +31,10 @@
from restkit.errors import ResourceError, RequestFailed, RequestError
from restkit.util import url_quote

from couchdbkit import __version__
from couchdbkit.exceptions import ResourceNotFound, ResourceConflict, \
from . import __version__
from .exceptions import ResourceNotFound, ResourceConflict, \
PreconditionFailed
from couchdbkit.utils import json
from .utils import json

USER_AGENT = 'couchdbkit/%s' % __version__

Expand Down
6 changes: 3 additions & 3 deletions couchdbkit/schema/__init__.py
Expand Up @@ -156,9 +156,9 @@ class A(Dcoument):
"""

from couchdbkit.schema.properties import *
from couchdbkit.schema.base import *
from couchdbkit.schema.properties_proxy import *
from .properties import *
from .base import *
from .properties_proxy import *

def contain(db, *docs):
""" associate a db to multiple `Document` class"""
Expand Down
10 changes: 5 additions & 5 deletions couchdbkit/schema/base.py
Expand Up @@ -12,13 +12,13 @@
import re
import warnings

from couchdbkit.client import Database
from couchdbkit.schema import properties as p
from couchdbkit.schema.properties import value_to_python, \
from ..client import Database
from . import properties as p
from .properties import value_to_python, \
convert_property, MAP_TYPES_PROPERTIES, ALLOWED_PROPERTY_TYPES, \
LazyDict, LazyList, value_to_json
from couchdbkit.exceptions import *
from couchdbkit.resource import ResourceNotFound
from ..exceptions import *
from ..exceptions import ResourceNotFound


__all__ = ['ReservedWordError', 'ALLOWED_PROPERTY_TYPES', 'DocumentSchema',
Expand Down
7 changes: 3 additions & 4 deletions couchdbkit/schema/properties_proxy.py
Expand Up @@ -10,11 +10,10 @@
import decimal
import time

import couchdbkit
from couchdbkit.exceptions import *
from couchdbkit.schema.properties import Property
from ..exceptions import *
from .properties import Property

from couchdbkit.schema.base import DocumentSchema, ALLOWED_PROPERTY_TYPES
from .base import DocumentSchema, ALLOWED_PROPERTY_TYPES

__all__ = ['SchemaProperty', 'SchemaListProperty', 'SchemaDictProperty']

Expand Down
6 changes: 6 additions & 0 deletions couchdbkit/wsgi/__init__.py
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -
#
# This file is part of couchdbkit released under the MIT license.
# See the NOTICE for more information.


6 changes: 3 additions & 3 deletions couchdbkit/wsgi/handler.py
Expand Up @@ -11,8 +11,8 @@

from restkit.utils import url_encode

from couchdbkit import __version__
from couchdbkit.external import External
from .. import __version__
from ..external import External

def _normalize_name(name):
return "-".join([w.lower().capitalize() for w in name.split("-")])
Expand Down Expand Up @@ -130,4 +130,4 @@ def handle_line(self, line):
content = "".join(response).encode("utf-8")
self.send_response(req.response_status, content, req.response_headers)



0 comments on commit f7ca0d5

Please sign in to comment.