#!/usr/bin/env python
# -*- coding: utf-8 -*-
# <LICENSE=ISC>
#
from notmm.dbapi.orm import RelationProxy
from blogengine.config import db, PermissionError

class AuthorDoesNotExist(PermissionError):
    pass

class CategoryManager(object):
    """
    >>> categories = CategoryManager.objects.all()
    []
    >>> CategoryManager.objects.count()
    0
    """

    objects = RelationProxy(db.Category)

    def __repr__(self):
        return "<CategoryManager: %s>" % self.objects.name

class CategoryItemManager(object):
    objects = RelationProxy(db.CategoryItem)

class BlogEntryManager(object):
    objects = RelationProxy(db.BlogEntry)

EntryManager = BlogEntryManager

class CommentManager(object):
    objects = RelationProxy(db.Comment)
    
    #def__new__(cls, *args, **kwargs):
    #   cls.feedobj = cls.create_feed_obj(metaclass=RSSFeedGenerator)
    #
    #def create_feed_obj(self, metaclass):
    #   pass

class MessageManager(object):
    objects = RelationProxy(db.Message)

