230 lines
7.7 KiB
Python
230 lines
7.7 KiB
Python
# -*- coding: iso-8859-15 -*-
|
|
|
|
|
|
# Glasnost
|
|
# By: Odile Bénassy <obenassy@entrouvert.com>
|
|
# Romain Chantereau <rchantereau@entrouvert.com>
|
|
# Nicolas Clapiès <nclapies@easter-eggs.org>
|
|
# Pierre-Antoine Dejace <padejace@entrouvert.be>
|
|
# Thierry Dulieu <tdulieu@easter-eggs.com>
|
|
# Florent Monnier <monnier@codelutin.com>
|
|
# Cédric Musso <cmusso@easter-eggs.org>
|
|
# Frédéric Péters <fpeters@entrouvert.be>
|
|
# Benjamin Poussin <poussin@codelutin.com>
|
|
# Emmanuel Raviart <eraviart@entrouvert.com>
|
|
# Sébastien Régnier <regnier@codelutin.com>
|
|
# Emmanuel Saracco <esaracco@easter-eggs.com>
|
|
#
|
|
# Copyright (C) 2000, 2001 Easter-eggs & Emmanuel Raviart
|
|
# Copyright (C) 2002 Odile Bénassy, Code Lutin, Thierry Dulieu, Easter-eggs,
|
|
# Entr'ouvert, Frédéric Péters, Benjamin Poussin, Emmanuel Raviart,
|
|
# Emmanuel Saracco & Théridion
|
|
# Copyright (C) 2003 Odile Bénassy, Romain Chantereau, Nicolas Clapiès,
|
|
# Code Lutin, Pierre-Antoine Dejace, Thierry Dulieu, Easter-eggs,
|
|
# Entr'ouvert, Florent Monnier, Cédric Musso, Ouvaton, Frédéric Péters,
|
|
# Benjamin Poussin, Rodolphe Quiédeville, Emmanuel Raviart, Sébastien
|
|
# Régnier, Emmanuel Saracco, Théridion & Vecam
|
|
#
|
|
# This program is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License
|
|
# as published by the Free Software Foundation; either version 2
|
|
# of the License, or (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
__doc__ = """Glasnost Virtual Hosts Common Models"""
|
|
|
|
__version__ = '$Revision$'[11:-2]
|
|
|
|
|
|
from ObjectsCommon import AdminCommon, ObjectCommon, ObjectsCommonMixin
|
|
import system
|
|
|
|
|
|
class AdminVirtualHostsCommon(AdminCommon):
|
|
defaultVirtualHostId = None
|
|
defaultVirtualHostId_kind_balloonHelp = N_(
|
|
'Select the default virtual host to use on this server')
|
|
defaultVirtualHostId_kind_label = N_('Default Virtual Host')
|
|
defaultVirtualHostId_kind_serverRoles = ['virtualhosts']
|
|
defaultVirtualHostId_kindName = 'Id'
|
|
|
|
serverRole = 'virtualhosts'
|
|
|
|
def getOrderedLayoutSlotNames(self, parentSlot = None):
|
|
slotNames = AdminCommon.getOrderedLayoutSlotNames(
|
|
self, parentSlot = parentSlot)
|
|
slotNames += ['defaultVirtualHostId']
|
|
return slotNames
|
|
|
|
|
|
|
|
class VirtualHostCommon(ObjectCommon):
|
|
"""Virtual host super class used to be inherited with a Mixin Class.
|
|
|
|
This is the definition of the attributes of a virtual host object.
|
|
This object is used by the VirtualHostProxy.
|
|
|
|
"""
|
|
|
|
creationTime = None
|
|
creationTime_kindName = 'CreationTime'
|
|
|
|
defaultDispatcherId = None
|
|
defaultDispatcherId_kind_balloonHelp = N_(
|
|
'Enter the Glasnost dispatcher id for this virtual host '\
|
|
'(you may have to consult your administrator).')
|
|
defaultDispatcherId_kind_defaultValue = 'glasnost://localhost'
|
|
defaultDispatcherId_kind_isModifiable = 0
|
|
defaultDispatcherId_kind_isRequired = 1
|
|
defaultDispatcherId_kind_label = N_('Glasnost Dispatcher ID')
|
|
defaultDispatcherId_kind_stateInCreateMode = 'read-write'
|
|
defaultDispatcherId_kind_stateInEditMode = 'read-only'
|
|
defaultDispatcherId_kind_widget_size = 40
|
|
defaultDispatcherId_kind_widgetName = 'InputText'
|
|
defaultDispatcherId_kindName = 'DispatcherId'
|
|
|
|
hostName = None
|
|
hostName_kind_balloonHelp = N_('Enter the host name.')
|
|
hostName_kind_isRequired = 1
|
|
hostName_kind_isTranslatable = 0
|
|
hostName_kind_label = N_('Web Host Name')
|
|
hostName_kind_widget_size = 40
|
|
hostName_kind_widgetName = 'Url'
|
|
hostName_kindName = 'String'
|
|
|
|
modificationTime = None
|
|
modificationTime_kindName = 'ModificationTime'
|
|
|
|
readersSet = None
|
|
readersSet_kind_itemKind_value_defaultValue = system.generalPublicId
|
|
readersSet_kindName = 'ReadersSet'
|
|
|
|
serverRole = 'virtualhosts'
|
|
|
|
# TODO: everything so that it is editable by user
|
|
showTooltips = 0 # FIXME: default should be true
|
|
|
|
templateDirectoryName = 'glasnost2'
|
|
templateDirectoryName_kind_balloonHelp = N_(
|
|
'Select the template (skin) to use for this host.')
|
|
templateDirectoryName_kind_isRequired = 1
|
|
templateDirectoryName_kind_defaultValue = 'glasnost2'
|
|
templateDirectoryName_kind_label = N_('Template')
|
|
templateDirectoryName_kindName = 'Choice'
|
|
|
|
title = None
|
|
title_kind_balloonHelp = N_('Enter the title of this virtual host.')
|
|
title_kind_isRequired = 1
|
|
title_kind_label = N_('Title')
|
|
title_kind_widget_size = 40
|
|
title_kindName = 'String'
|
|
|
|
writersSet = None
|
|
writersSet_kindName = 'WritersSet'
|
|
|
|
def getLabel(self):
|
|
"""Return the virtual host title name string.
|
|
|
|
Return the title strin attribute.
|
|
If the title string is None, an empty string is returned.
|
|
|
|
"""
|
|
|
|
label = self.getTitle()
|
|
if label is None:
|
|
return ''
|
|
return label
|
|
|
|
def getOrderedLayoutSlotNames(self, parentSlot = None):
|
|
"""Return the layout slots names sequences.
|
|
|
|
The layout slots names of the parent are taken, and to them, the
|
|
class slot names are added.
|
|
|
|
Keyword argument
|
|
================
|
|
|
|
*parentSlot*:
|
|
The slot where the object is instanciated.
|
|
|
|
Return the slot names sequence, minimum slot names are the current
|
|
object slots.
|
|
|
|
"""
|
|
|
|
slotNames = ObjectCommon.getOrderedLayoutSlotNames(
|
|
self, parentSlot = parentSlot)
|
|
slotNames += [
|
|
'title', 'defaultDispatcherId', 'hostName',
|
|
'templateDirectoryName', 'creationTime', 'modificationTime',
|
|
'writersSet', 'readersSet']
|
|
return slotNames
|
|
|
|
def getTitle(self):
|
|
"""Return the title attribute."""
|
|
|
|
return self.title
|
|
|
|
|
|
class VirtualHostsCommonMixin(ObjectsCommonMixin):
|
|
|
|
"""Abstract class designed to be inherited with another class.
|
|
|
|
The product of a multiple inheritance is a fonctionnal Virtual host
|
|
server/proxy.
|
|
All methods can be overriden or extended, in fact, this class define their
|
|
default behavior.
|
|
|
|
Attributes:
|
|
===========
|
|
|
|
*adminClassName*:
|
|
The class name string used for administrative purposes.
|
|
|
|
*newObjectNameCapitalized*:
|
|
The illustrating string explaining what do a new object creation.
|
|
The objects are the objects handled by the subclass (not the class
|
|
itself).
|
|
|
|
*objectClassName*:
|
|
The handled object class name string.
|
|
|
|
*objectName*:
|
|
The 'gettextized' handled object class name string.
|
|
|
|
*objectNameCapitalized*:
|
|
The capitalized 'gettextized' handled object class name string.
|
|
|
|
*objectsName*:
|
|
The 'gettextized' functionnal class name string (Usualy the class name
|
|
without the type (proxy or server, etc...)).
|
|
|
|
*objectsNameCapitalized*:
|
|
The capitalized 'gettextized' class name string (Usualy the class name
|
|
without the type (proxy or server, etc...)).
|
|
|
|
*serverRole*:
|
|
The class server role string.
|
|
|
|
"""
|
|
|
|
|
|
adminClassName = 'AdminVirtualHosts'
|
|
newObjectNameCapitalized = N_('New Virtual Host')
|
|
objectClassName = 'VirtualHost'
|
|
objectName = N_('virtual host')
|
|
objectNameCapitalized = N_('Virtual Host')
|
|
objectsName = N_('virtual hosts')
|
|
objectsNameCapitalized = N_('Virtual Hosts')
|
|
serverRole = 'virtualhosts'
|
|
|