"""
$URL: svn+ssh://svn.mems-exchange.org/repos/trunk/dulcinea/lib/publish.py $
$Id: publish.py 28119 2006-03-31 21:57:52Z rmasse $
"""
from qp.pub.publish import DurusPublisher
from dulcinea.session import Session
from dulcinea.contact import Contact

from socket import getfqdn


class Publisher (DurusPublisher):

    def create_user(self):
        return Contact()

    def create_session(self):
        return Session()

    def get_users(self):
        return self.get_connection().get_root()['user_db'].users

    def format_login_agreement(self):
        return None

    def format_date_time(self, date):
        from dulcinea.ui.util import format_date_time
        return format_date_time(date)

    def format_date(self, date):
        from dulcinea.ui.util import format_date
        return format_date(date)

    def format_user(self, user, **kwargs):
        from dulcinea.ui.user.util import format_user
        return format_user(user, **kwargs)

    def format_user_profile(self, user):
        from dulcinea.ui.user.profile import dulcinea_user_profile
        return dulcinea_user_profile(user)

    def get_feedback_domain(self):
        return getfqdn()

    def get_feedback_addresses(self):
        return ['webmaster']

    def get_site_title(self):
        from dulcinea.common import get_site_name
        return (get_site_name() or "site").capitalize()


