Index: /quintagroup.skin.switcher/trunk/README.txt
===================================================================
--- /quintagroup.skin.switcher/trunk/README.txt	(revision 689)
+++ /quintagroup.skin.switcher/trunk/README.txt	(revision 689)
@@ -0,0 +1,19 @@
+Introduction
+============
+
+Overview
+--------
+A product for switching themes by domain.
+
+Installation
+------------
+Using portal_setup/quickinstaller - install product
+
+Than in portal_properties/skin_switcher properties sheet
+set following properties:
+  - domain prefix for skin switching in 'theme_switch_prefix' property.
+  - theme name for switching to if domain starts with specified prefix
+
+If in config module 'USE_FS_CONFIG' set to `True` - than installation
+not needed. This case usefull for zope instance with single plone
+instance.
Index: /quintagroup.skin.switcher/trunk/docs/HISTORY.txt
===================================================================
--- /quintagroup.skin.switcher/trunk/docs/HISTORY.txt	(revision 689)
+++ /quintagroup.skin.switcher/trunk/docs/HISTORY.txt	(revision 689)
@@ -0,0 +1,7 @@
+Changelog
+=========
+
+0.1 (xxxx-xx-xx)
+----------------
+
+* Initial release
Index: /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/PKG-INFO
===================================================================
--- /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/PKG-INFO	(revision 689)
+++ /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/PKG-INFO	(revision 689)
@@ -0,0 +1,25 @@
+Metadata-Version: 1.0
+Name: quintagroup.skin.switcher
+Version: 0.1dev
+Summary: Package for switching skin by domain prefix
+Home-page: quintagroup.com
+Author: Quintagroup
+Author-email: UNKNOWN
+License: GPL
+Description: Introduction
+        ============
+        
+        
+        
+        Changelog
+        =========
+        
+        0.1 (xxxx-xx-xx)
+        ----------------
+        
+        * Initial release
+        
+Keywords: Quintagroup skin switching
+Platform: UNKNOWN
+Classifier: Programming Language :: Python
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
Index: /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/SOURCES.txt
===================================================================
--- /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/SOURCES.txt	(revision 689)
+++ /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/SOURCES.txt	(revision 689)
@@ -0,0 +1,14 @@
+README.txt
+setup.cfg
+setup.py
+quintagroup/__init__.py
+quintagroup.skin.switcher.egg-info/PKG-INFO
+quintagroup.skin.switcher.egg-info/SOURCES.txt
+quintagroup.skin.switcher.egg-info/dependency_links.txt
+quintagroup.skin.switcher.egg-info/entry_points.txt
+quintagroup.skin.switcher.egg-info/namespace_packages.txt
+quintagroup.skin.switcher.egg-info/not-zip-safe
+quintagroup.skin.switcher.egg-info/requires.txt
+quintagroup.skin.switcher.egg-info/top_level.txt
+quintagroup/skin/__init__.py
+quintagroup/skin/switcher/__init__.py
Index: /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/dependency_links.txt
===================================================================
--- /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/dependency_links.txt	(revision 689)
+++ /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/dependency_links.txt	(revision 689)
@@ -0,0 +1,1 @@
+
Index: /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/entry_points.txt
===================================================================
--- /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/entry_points.txt	(revision 689)
+++ /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/entry_points.txt	(revision 689)
@@ -0,0 +1,3 @@
+
+      # -*- Entry points: -*-
+      
Index: /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/namespace_packages.txt
===================================================================
--- /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/namespace_packages.txt	(revision 689)
+++ /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/namespace_packages.txt	(revision 689)
@@ -0,0 +1,2 @@
+quintagroup
+quintagroup.skin
Index: /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/not-zip-safe
===================================================================
--- /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/not-zip-safe	(revision 689)
+++ /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/not-zip-safe	(revision 689)
@@ -0,0 +1,1 @@
+
Index: /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/paster_plugins.txt
===================================================================
--- /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/paster_plugins.txt	(revision 689)
+++ /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/paster_plugins.txt	(revision 689)
@@ -0,0 +1,1 @@
+PasteScript
Index: /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/requires.txt
===================================================================
--- /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/requires.txt	(revision 689)
+++ /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/requires.txt	(revision 689)
@@ -0,0 +1,1 @@
+setuptools
Index: /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/top_level.txt
===================================================================
--- /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/top_level.txt	(revision 689)
+++ /quintagroup.skin.switcher/trunk/quintagroup.skin.switcher.egg-info/top_level.txt	(revision 689)
@@ -0,0 +1,1 @@
+quintagroup
Index: /quintagroup.skin.switcher/trunk/quintagroup/__init__.py
===================================================================
--- /quintagroup.skin.switcher/trunk/quintagroup/__init__.py	(revision 689)
+++ /quintagroup.skin.switcher/trunk/quintagroup/__init__.py	(revision 689)
@@ -0,0 +1,6 @@
+# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
+try:
+    __import__('pkg_resources').declare_namespace(__name__)
+except ImportError:
+    from pkgutil import extend_path
+    __path__ = extend_path(__path__, __name__)
Index: /quintagroup.skin.switcher/trunk/quintagroup/skin/__init__.py
===================================================================
--- /quintagroup.skin.switcher/trunk/quintagroup/skin/__init__.py	(revision 689)
+++ /quintagroup.skin.switcher/trunk/quintagroup/skin/__init__.py	(revision 689)
@@ -0,0 +1,6 @@
+# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
+try:
+    __import__('pkg_resources').declare_namespace(__name__)
+except ImportError:
+    from pkgutil import extend_path
+    __path__ = extend_path(__path__, __name__)
Index: /quintagroup.skin.switcher/trunk/quintagroup/skin/switcher/Extensions/brt.py
===================================================================
--- /quintagroup.skin.switcher/trunk/quintagroup/skin/switcher/Extensions/brt.py	(revision 689)
+++ /quintagroup.skin.switcher/trunk/quintagroup/skin/switcher/Extensions/brt.py	(revision 689)
@@ -0,0 +1,24 @@
+from Products.CMFCore.utils import getToolByName
+from Products.Five.site.localsite import *
+
+def turnOnBRT(self):
+    portal = getToolByName(self, 'portal_url').getPortalObject()
+
+    obj = aq_base(portal)
+    hook = AccessRule(HOOK_NAME)
+    registerBeforeTraverse(obj, hook, HOOK_NAME, 1)
+
+    if not hasattr(obj, HOOK_NAME):
+        setattr(obj, HOOK_NAME, LocalSiteHook())
+
+    return "REGISTERED"     
+
+def turnOffBRT(self):
+    portal = getToolByName(self, 'portal_url').getPortalObject()
+
+    obj = aq_base(portal)
+    unregisterBeforeTraverse(obj, HOOK_NAME)
+    if hasattr(obj, HOOK_NAME):
+        delattr(obj, HOOK_NAME)
+
+    return "UNREGISTERED"     
Index: /quintagroup.skin.switcher/trunk/quintagroup/skin/switcher/config.py
===================================================================
--- /quintagroup.skin.switcher/trunk/quintagroup/skin/switcher/config.py	(revision 689)
+++ /quintagroup.skin.switcher/trunk/quintagroup/skin/switcher/config.py	(revision 689)
@@ -0,0 +1,3 @@
+USE_FS_CONFIG = False
+SKIN_SWITCH_PREFIX = 'm.'
+SWITCH_THEME = ''
Index: /quintagroup.skin.switcher/trunk/quintagroup/skin/switcher/configure.zcml
===================================================================
--- /quintagroup.skin.switcher/trunk/quintagroup/skin/switcher/configure.zcml	(revision 689)
+++ /quintagroup.skin.switcher/trunk/quintagroup/skin/switcher/configure.zcml	(revision 689)
@@ -0,0 +1,21 @@
+<configure
+  xmlns="http://namespaces.zope.org/zope"
+  xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
+  xmlns:five="http://namespaces.zope.org/five">
+
+  <genericsetup:registerProfile
+    name="default"
+    title="quintagroup skin switcher"
+    directory="profiles/default"
+    description='Extension profile for the quintagroup.skin.switcher'
+    provides="Products.GenericSetup.interfaces.EXTENSION"
+    />
+
+
+  <subscriber
+    for="Products.CMFPlone.interfaces.siteroot.IPloneSiteRoot
+    zope.app.publication.interfaces.IBeforeTraverseEvent"
+    handler=".skinswitcher.setSkin"
+    />
+
+</configure>
Index: /quintagroup.skin.switcher/trunk/quintagroup/skin/switcher/profiles/default/metadata.xml
===================================================================
--- /quintagroup.skin.switcher/trunk/quintagroup/skin/switcher/profiles/default/metadata.xml	(revision 689)
+++ /quintagroup.skin.switcher/trunk/quintagroup/skin/switcher/profiles/default/metadata.xml	(revision 689)
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<metadata>
+  <version>0.1</version>
+</metadata>
Index: /quintagroup.skin.switcher/trunk/quintagroup/skin/switcher/profiles/default/propertiestool.xml
===================================================================
--- /quintagroup.skin.switcher/trunk/quintagroup/skin/switcher/profiles/default/propertiestool.xml	(revision 689)
+++ /quintagroup.skin.switcher/trunk/quintagroup/skin/switcher/profiles/default/propertiestool.xml	(revision 689)
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<object name="portal_properties" meta_type="Plone Properties Tool">
+ <object name="skin_switcher" meta_type="Plone Property Sheet">
+   <property name="theme_switch_prefix">m.</property>
+   <property name="switch_theme"></property>
+ </object>
+</object>
Index: /quintagroup.skin.switcher/trunk/quintagroup/skin/switcher/skinswitcher.py
===================================================================
--- /quintagroup.skin.switcher/trunk/quintagroup/skin/switcher/skinswitcher.py	(revision 689)
+++ /quintagroup.skin.switcher/trunk/quintagroup/skin/switcher/skinswitcher.py	(revision 689)
@@ -0,0 +1,27 @@
+from urlparse import urlsplit
+
+from Products.CMFCore.utils import getToolsByName
+
+from config import *
+
+def setSkin(site, event):
+    ps = getToolsByName(site,'portal_skins')
+
+    if USE_FS_CONFIG:
+        pref = SKIN_SWITCH_PREFIX
+        switch_theme = SWITCH_THEME
+    else:
+        pp = getToolsByName(site,'portal_properties')
+        ss = getattr(pp,'skin_switcher',None)
+        if not ss:
+            return
+        pref = ss.getProperty('theme_switch_prefix', SKIN_SWITCH_PREFIX)
+        switch_theme = ss.getProperty('switch_theme', SWITCH_THEME)
+        
+    avail_skins = ps.getSkinSelections()
+    if not (pref and switch_theme and switch_theme in avail_skins):
+       return
+
+    scheme, netloc, path, query, fragm = urlsplit(event.request.URL)
+    if netloc.startswith(pref):
+        site.changeSkin(switch_theme)
Index: /quintagroup.skin.switcher/trunk/setup.cfg
===================================================================
--- /quintagroup.skin.switcher/trunk/setup.cfg	(revision 689)
+++ /quintagroup.skin.switcher/trunk/setup.cfg	(revision 689)
@@ -0,0 +1,3 @@
+[egg_info]
+tag_build = dev
+tag_svn_revision = true
Index: /quintagroup.skin.switcher/trunk/setup.py
===================================================================
--- /quintagroup.skin.switcher/trunk/setup.py	(revision 689)
+++ /quintagroup.skin.switcher/trunk/setup.py	(revision 689)
@@ -0,0 +1,32 @@
+from setuptools import setup, find_packages
+import os
+
+version = '0.1'
+
+setup(name='quintagroup.skin.switcher',
+      version=version,
+      description="Package for switching skin by domain prefix",
+      long_description=open("README.txt").read() + "\n" +
+                       open(os.path.join("docs", "HISTORY.txt")).read(),
+      # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers
+      classifiers=[
+        "Programming Language :: Python",
+        "Topic :: Software Development :: Libraries :: Python Modules",
+        ],
+      keywords='Quintagroup skin switching',
+      author='Quintagroup',
+      author_email='',
+      url='quintagroup.com',
+      license='GPL',
+      packages=find_packages(exclude=['ez_setup']),
+      namespace_packages=['quintagroup', 'quintagroup.skin'],
+      include_package_data=True,
+      zip_safe=False,
+      install_requires=[
+          'setuptools',
+          # -*- Extra requirements: -*-
+      ],
+      entry_points="""
+      # -*- Entry points: -*-
+      """,
+      )
