text:
import os
import re
import StringIO
import time

from conary.lib import util

import restbase
from restlib import client as restClient
from testutils import mock

from  mint.rest.api import models

ResponseError = restClient.ResponseError

class ProductVersionTest(restbase.BaseRestTest):
    buildDefs = [
        ('Citrix XenServer 32-bit', 'xen', 'x86', 'xenOvaImage'),
        ('Citrix XenServer 64-bit', 'xen', 'x86_64', 'xenOvaImage'),
        ('VMware ESX 32-bit', 'vmware', 'x86', 'vmwareEsxImage'),
        ('VMware ESX 64-bit', 'vmware', 'x86_64', 'vmwareEsxImage'),
    ]

    def setUp(self):
        restbase.BaseRestTest.setUp(self)
        self.setupProduct()

    def testGetProductVersion(self):
        uriTemplate = 'products/%s/versions/%s/'
        uri = uriTemplate % (self.productShortName, self.productVersion)
        client = self.getRestClient()
        req, response = client.call('GET', uri)
        resp = client.convert('xml', req, response)
        exp = """\
<?xml version='1.0' encoding='UTF-8'?>
<productVersion id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0">
  <versionId>1</versionId>
  <hostname>testproject</hostname>
  <name>1.0</name>
  <productUrl href="http://%(server)s:%(port)s/api/products/testproject"/>
  <nameSpace>yournamespace</nameSpace>
  <description>Version description</description>
  <timeCreated></timeCreated>
  <label>testproject.rpath.local2@yournamespace:testproject-1.0</label>
  <platform href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/platform"/>
  <platformVersion href="http://localhost:8000/api/products/testproject/versions/1.0/platformVersion"/>
  <stages href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/"/>
  <definition href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/definition"/>
  <imageTypeDefinitions href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions"/>
  <imageDefinitions href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageDefinitions"/>
  <images href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/images"/>
  <sourceGroup>group-testproject-appliance</sourceGroup>
</productVersion>
"""
        for pat in [ "timeCreated", "timeModified" ]:
            resp = re.sub("<%s>.*</%s>" % (pat, pat),
             "<%s></%s>" % (pat, pat),
            resp)
        exp = exp % dict(port = client.port, server = client.server)
        self.assertXMLEquals(resp, exp)

    def testGetProductDefinition(self):
        uriTemplate = 'products/%s/versions/%s/definition'
        uri = uriTemplate % (self.productShortName, self.productVersion)
        client = self.getRestClient(username='foouser')
        req, response = client.call('GET', uri)
        sio = StringIO.StringIO()
        self.productDefinition.serialize(sio)
        self.failUnlessEqual(response.get(), sio.getvalue())

    def testGetStageImageDefinitions(self):
        uriTemplate = 'products/%s/versions/%s/stages/%s/imageDefinitions'
        uri = uriTemplate % (self.productShortName, self.productVersion,
        'Development')
        self.createUser('foouser')
        client = self.getRestClient(username='foouser')
        req, response = client.call('GET', uri, convert = True)

        exp = """\
<?xml version='1.0' encoding='UTF-8'?>
<imageDefinitions>
  <imageDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageDefinitions/bf19565548bcf6c28712a60cb02a808d">
    <name>Citrix XenServer 32-bit</name>
    <displayName>Citrix XenServer 32-bit</displayName>
    <imageGroup>group-testproject-appliance</imageGroup>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Development"/>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/QA"/>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Release"/>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/xenOvaImage">
      <name>xenOvaImage</name>
      <displayName>Citrix(R) XenServer(TM) Appliance</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86">
      <name>x86</name>
      <displayName>x86 (32-bit)</displayName>
    </architecture>
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/xen">
      <name>xen</name>
      <displayName>Xen</displayName>
    </flavorSet>
    <options autoResolve="false" baseFileName="" freespace="1024" installLabelPath="" swapSize="512" vmMemory="256"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/xenOvaImage"/>
  </imageDefinition>
  <imageDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageDefinitions/6471e079080cb3d767e81c4ef112c1da">
    <name>Citrix XenServer 64-bit</name>
    <displayName>Citrix XenServer 64-bit</displayName>
    <imageGroup>group-testproject-appliance</imageGroup>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Development"/>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/QA"/>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Release"/>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/xenOvaImage">
      <name>xenOvaImage</name>
      <displayName>Citrix(R) XenServer(TM) Appliance</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86_64">
      <name>x86_64</name>
      <displayName>x86 (64-bit)</displayName>
    </architecture>
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/xen">
      <name>xen</name>
      <displayName>Xen</displayName>
    </flavorSet>
    <options autoResolve="false" baseFileName="" freespace="1024" installLabelPath="" swapSize="512" vmMemory="256"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/xenOvaImage"/>
  </imageDefinition>
  <imageDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageDefinitions/e9ab1e72b797d11ce4f6b98e92aeee2f">
    <name>VMware ESX 32-bit</name>
    <displayName>VMware ESX 32-bit</displayName>
    <imageGroup>group-testproject-appliance</imageGroup>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Development"/>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/QA"/>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Release"/>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/vmwareEsxImage">
      <name>vmwareEsxImage</name>
      <displayName>VMware(R) ESX/VCD / Oracle(R) VirtualBox Virtual Appliance</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86">
      <name>x86</name>
      <displayName>x86 (32-bit)</displayName>
    </architecture>
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/vmware">
      <name>vmware</name>
      <displayName>VMware</displayName>
    </flavorSet>
    <options autoResolve="false" baseFileName="" freespace="1024" installLabelPath="" natNetworking="true" swapSize="512" vmMemory="256"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/vmwareEsxImage"/>
  </imageDefinition>
  <imageDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageDefinitions/100f456aff2280f146c8bfbdb5be8fdf">
    <name>VMware ESX 64-bit</name>
    <displayName>VMware ESX 64-bit</displayName>
    <imageGroup>group-testproject-appliance</imageGroup>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Development"/>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/QA"/>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Release"/>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/vmwareEsxImage">
      <name>vmwareEsxImage</name>
      <displayName>VMware(R) ESX/VCD / Oracle(R) VirtualBox Virtual Appliance</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86_64">
      <name>x86_64</name>
      <displayName>x86 (64-bit)</displayName>
    </architecture>
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/vmware">
      <name>vmware</name>
      <displayName>VMware</displayName>
    </flavorSet>
    <options autoResolve="false" baseFileName="" freespace="1024" installLabelPath="" natNetworking="true" swapSize="512" vmMemory="256"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/vmwareEsxImage"/>
  </imageDefinition>
</imageDefinitions>
"""
        self.assertXMLEquals(response,
            exp % dict(server = client.server, port = client.port))

    def testGetImageDefinitions(self):
        uriTemplate = 'products/%s/versions/%s/imageDefinitions'
        uri = uriTemplate % (self.productShortName, self.productVersion)

        self.createUser('foouser')
        client = self.getRestClient(username='foouser')
        req, response = client.call('GET', uri, convert=True)

        exp = """\
<?xml version='1.0' encoding='UTF-8'?>
<imageDefinitions>
  <imageDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageDefinitions/bf19565548bcf6c28712a60cb02a808d">
    <name>Citrix XenServer 32-bit</name>
    <displayName>Citrix XenServer 32-bit</displayName>
    <imageGroup>group-testproject-appliance</imageGroup>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Development"/>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/QA"/>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Release"/>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/xenOvaImage">
      <name>xenOvaImage</name>
      <displayName>Citrix(R) XenServer(TM) Appliance</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86">
      <name>x86</name>
      <displayName>x86 (32-bit)</displayName>
    </architecture>
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/xen">
      <name>xen</name>
      <displayName>Xen</displayName>
    </flavorSet>
    <options autoResolve="false" baseFileName="" freespace="1024" installLabelPath="" swapSize="512" vmMemory="256"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/xenOvaImage"/>
  </imageDefinition>
  <imageDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageDefinitions/6471e079080cb3d767e81c4ef112c1da">
    <name>Citrix XenServer 64-bit</name>
    <displayName>Citrix XenServer 64-bit</displayName>
    <imageGroup>group-testproject-appliance</imageGroup>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Development"/>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/QA"/>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Release"/>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/xenOvaImage">
      <name>xenOvaImage</name>
      <displayName>Citrix(R) XenServer(TM) Appliance</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86_64">
      <name>x86_64</name>
      <displayName>x86 (64-bit)</displayName>
    </architecture>
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/xen">
      <name>xen</name>
      <displayName>Xen</displayName>
    </flavorSet>
    <options autoResolve="false" baseFileName="" freespace="1024" installLabelPath="" swapSize="512" vmMemory="256"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/xenOvaImage"/>
  </imageDefinition>
  <imageDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageDefinitions/e9ab1e72b797d11ce4f6b98e92aeee2f">
    <name>VMware ESX 32-bit</name>
    <displayName>VMware ESX 32-bit</displayName>
    <imageGroup>group-testproject-appliance</imageGroup>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Development"/>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/QA"/>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Release"/>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/vmwareEsxImage">
      <name>vmwareEsxImage</name>
      <displayName>VMware(R) ESX/VCD / Oracle(R) VirtualBox Virtual Appliance</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86">
      <name>x86</name>
      <displayName>x86 (32-bit)</displayName>
    </architecture>
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/vmware">
      <name>vmware</name>
      <displayName>VMware</displayName>
    </flavorSet>
    <options autoResolve="false" baseFileName="" freespace="1024" installLabelPath="" natNetworking="true" swapSize="512" vmMemory="256"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/vmwareEsxImage"/>
  </imageDefinition>
  <imageDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageDefinitions/100f456aff2280f146c8bfbdb5be8fdf">
    <name>VMware ESX 64-bit</name>
    <displayName>VMware ESX 64-bit</displayName>
    <imageGroup>group-testproject-appliance</imageGroup>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Development"/>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/QA"/>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Release"/>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/vmwareEsxImage">
      <name>vmwareEsxImage</name>
      <displayName>VMware(R) ESX/VCD / Oracle(R) VirtualBox Virtual Appliance</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86_64">
      <name>x86_64</name>
      <displayName>x86 (64-bit)</displayName>
    </architecture>
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/vmware">
      <name>vmware</name>
      <displayName>VMware</displayName>
    </flavorSet>
    <options autoResolve="false" baseFileName="" freespace="1024" installLabelPath="" natNetworking="true" swapSize="512" vmMemory="256"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/vmwareEsxImage"/>
  </imageDefinition>
</imageDefinitions>
"""
        self.assertXMLEquals(response,
            exp % dict(server = client.server, port = client.port))

    def testGetImageTypeDefinitions(self):
        uriTemplate = 'products/%s/versions/%s/imageTypeDefinitions'
        uri = uriTemplate % (self.productShortName, self.productVersion)

        self.createUser('foouser')
        client = self.getRestClient(username='foouser')
        req, response = client.call('GET', uri, convert = True)

        exp = """\
<?xml version='1.0' encoding='UTF-8'?>
<imageTypeDefinitions>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/ce165212d22ca8ed80b5acb4b0fa58de">
    <name>ami_large</name>
    <displayName>EC2 AMI Large/Huge</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/amiImage">
      <name>amiImage</name>
      <displayName>Amazon Machine Image (EC2)</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86_64">
      <name>x86_64</name>
      <displayName>x86 (64-bit)</displayName>
    </architecture>
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/ami">
      <name>ami</name>
      <displayName>AMI</displayName>
    </flavorSet>
    <options amiHugeDiskMountpoint="False" autoResolve="false" baseFileName="" freespace="1024" installLabelPath="" swapSize="1024"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/amiImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/b9ffaaafacae3b42f72864d113d7995c">
    <name>ec2_small</name>
    <displayName>EC2 AMI Small</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/amiImage">
      <name>amiImage</name>
      <displayName>Amazon Machine Image (EC2)</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86">
      <name>x86</name>
      <displayName>x86 (32-bit)</displayName>
    </architecture>
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/ami">
      <name>ami</name>
      <displayName>AMI</displayName>
    </flavorSet>
    <options amiHugeDiskMountpoint="False" autoResolve="false" baseFileName="" freespace="1024" installLabelPath="" swapSize="1024"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/amiImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/ac0063910f7134cc838281b7fb5d42c2">
    <name>iso</name>
    <displayName>ISO</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/applianceIsoImage">
      <name>applianceIsoImage</name>
      <displayName>Appliance Installable ISO</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86">
      <name>x86</name>
      <displayName>x86 (32-bit)</displayName>
    </architecture>
    <options anacondaCustomTrove="" anacondaTemplatesTrove="conary.rpath.com@rpl:2" autoResolve="false" baseFileName="" betaNag="false" bugsUrl="" installLabelPath="" mediaTemplateTrove="" showMediaCheck="false"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/applianceIsoImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/693912898a7deda5fba2e11da496e31c">
    <name>iso</name>
    <displayName>ISO</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/installableIsoImage">
      <name>installableIsoImage</name>
      <displayName>Legacy Installable CD/DVD</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86">
      <name>x86</name>
      <displayName>x86 (32-bit)</displayName>
    </architecture>
    <options anacondaCustomTrove="" anacondaTemplatesTrove="conary.rpath.com@rpl:2" autoResolve="false" baseFileName="" betaNag="false" bugsUrl="" installLabelPath="" mediaTemplateTrove="" showMediaCheck="false"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/installableIsoImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/00ce8ec04c049013d2d032a7d59b4353">
    <name>iso</name>
    <displayName>ISO</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/updateIsoImage">
      <name>updateIsoImage</name>
      <displayName>Update CD/DVD</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86">
      <name>x86</name>
      <displayName>x86 (32-bit)</displayName>
    </architecture>
    <options anacondaCustomTrove="" anacondaTemplatesTrove="conary.rpath.com@rpl:2" autoResolve="false" baseFileName="" betaNag="false" bugsUrl="" installLabelPath="" mediaTemplateTrove="" showMediaCheck="false"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/updateIsoImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/e9b231d3812e4ec7808c1b56d700f933">
    <name>iso</name>
    <displayName>ISO</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/applianceIsoImage">
      <name>applianceIsoImage</name>
      <displayName>Appliance Installable ISO</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86_64">
      <name>x86_64</name>
      <displayName>x86 (64-bit)</displayName>
    </architecture>
    <options anacondaCustomTrove="" anacondaTemplatesTrove="conary.rpath.com@rpl:2" autoResolve="false" baseFileName="" betaNag="false" bugsUrl="" installLabelPath="" mediaTemplateTrove="" showMediaCheck="false"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/applianceIsoImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/efab84338c2862b8d04fd3783a3394e9">
    <name>iso</name>
    <displayName>ISO</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/installableIsoImage">
      <name>installableIsoImage</name>
      <displayName>Legacy Installable CD/DVD</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86_64">
      <name>x86_64</name>
      <displayName>x86 (64-bit)</displayName>
    </architecture>
    <options anacondaCustomTrove="" anacondaTemplatesTrove="conary.rpath.com@rpl:2" autoResolve="false" baseFileName="" betaNag="false" bugsUrl="" installLabelPath="" mediaTemplateTrove="" showMediaCheck="false"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/installableIsoImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/270978cfe105c57aff7eb3569717da2b">
    <name>iso</name>
    <displayName>ISO</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/updateIsoImage">
      <name>updateIsoImage</name>
      <displayName>Update CD/DVD</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86_64">
      <name>x86_64</name>
      <displayName>x86 (64-bit)</displayName>
    </architecture>
    <options anacondaCustomTrove="" anacondaTemplatesTrove="conary.rpath.com@rpl:2" autoResolve="false" baseFileName="" betaNag="false" bugsUrl="" installLabelPath="" mediaTemplateTrove="" showMediaCheck="false"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/updateIsoImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/4375b6b1a1607aa176d2adf29acdf83a">
    <name>hyper_v</name>
    <displayName>MS Hyper-V</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/vhdImage">
      <name>vhdImage</name>
      <displayName>VHD for Microsoft(R) Hyper-V(R)</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86">
      <name>x86</name>
      <displayName>x86 (32-bit)</displayName>
    </architecture>
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/generic">
      <name>generic</name>
      <displayName>Generic</displayName>
    </flavorSet>
    <options autoResolve="false" baseFileName="" freespace="1024" installLabelPath="" swapSize="512" vhdDiskType="dynamic"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/vhdImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/a23df9b49d9fa36664c2d4009a457e23">
    <name>hyper_v</name>
    <displayName>MS Hyper-V</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/vhdImage">
      <name>vhdImage</name>
      <displayName>VHD for Microsoft(R) Hyper-V(R)</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86_64">
      <name>x86_64</name>
      <displayName>x86 (64-bit)</displayName>
    </architecture>
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/generic">
      <name>generic</name>
      <displayName>Generic</displayName>
    </flavorSet>
    <options autoResolve="false" baseFileName="" freespace="1024" installLabelPath="" swapSize="512" vhdDiskType="dynamic"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/vhdImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/cf16e2998c6b727dd96b4fd923a2c5e1">
    <name>raw_fs</name>
    <displayName>Raw Filesystem</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/rawFsImage">
      <name>rawFsImage</name>
      <displayName>Eucalyptus/Mountable Filesystem</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86">
      <name>x86</name>
      <displayName>x86 (32-bit)</displayName>
    </architecture>
    <options autoResolve="false" baseFileName="" freespace="1024" installLabelPath="" swapSize="512"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/rawFsImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/dece8286c53268d424f719606a9182ec">
    <name>raw_fs</name>
    <displayName>Raw Filesystem</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/rawFsImage">
      <name>rawFsImage</name>
      <displayName>Eucalyptus/Mountable Filesystem</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86_64">
      <name>x86_64</name>
      <displayName>x86 (64-bit)</displayName>
    </architecture>
    <options autoResolve="false" baseFileName="" freespace="1024" installLabelPath="" swapSize="512"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/rawFsImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/6b9ec3e88b39e5f7db1e81ed5f5d1ef0">
    <name>raw_hd</name>
    <displayName>Raw Hard Disk</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/rawHdImage">
      <name>rawHdImage</name>
      <displayName>OpenStack/KVM/QEMU/Raw Hard Disk</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86">
      <name>x86</name>
      <displayName>x86 (32-bit)</displayName>
    </architecture>
    <options autoResolve="false" baseFileName="" freespace="1024" installLabelPath="" swapSize="512"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/rawHdImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/287c7becce8de890d5b1626dd429eb47">
    <name>raw_hd</name>
    <displayName>Raw Hard Disk</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/rawHdImage">
      <name>rawHdImage</name>
      <displayName>OpenStack/KVM/QEMU/Raw Hard Disk</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86_64">
      <name>x86_64</name>
      <displayName>x86 (64-bit)</displayName>
    </architecture>
    <options autoResolve="false" baseFileName="" freespace="1024" installLabelPath="" swapSize="512"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/rawHdImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/48bb9ca059314422f9cc0f09afb65976">
    <name>tar</name>
    <displayName>Tar Image</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/tarballImage">
      <name>tarballImage</name>
      <displayName>TAR File</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86">
      <name>x86</name>
      <displayName>x86 (32-bit)</displayName>
    </architecture>
    <options autoResolve="false" baseFileName="" installLabelPath="" swapSize="0"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/tarballImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/1e297fa23928806462908182ada781a0">
    <name>tar</name>
    <displayName>Tar Image</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/tarballImage">
      <name>tarballImage</name>
      <displayName>TAR File</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86_64">
      <name>x86_64</name>
      <displayName>x86 (64-bit)</displayName>
    </architecture>
    <options autoResolve="false" baseFileName="" installLabelPath="" swapSize="0"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/tarballImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/0f1ead937e2152c31c2cdaa4f350a25f">
    <name>vmware</name>
    <displayName>VMware</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/vmwareImage">
      <name>vmwareImage</name>
      <displayName>VMware(R) Workstation/Fusion / Parallels(R) Virtual Appliance</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86">
      <name>x86</name>
      <displayName>x86 (32-bit)</displayName>
    </architecture>
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/vmware">
      <name>vmware</name>
      <displayName>VMware</displayName>
    </flavorSet>
    <options autoResolve="false" baseFileName="" diskAdapter="lsilogic" freespace="1024" installLabelPath="" natNetworking="true" swapSize="512" vmMemory="256" vmSnapshots="false"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/vmwareImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/4599da97777a0ef9208c831872f65e1a">
    <name>vmware</name>
    <displayName>VMware</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/vmwareEsxImage">
      <name>vmwareEsxImage</name>
      <displayName>VMware(R) ESX/VCD / Oracle(R) VirtualBox Virtual Appliance</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86">
      <name>x86</name>
      <displayName>x86 (32-bit)</displayName>
    </architecture>
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/vmware">
      <name>vmware</name>
      <displayName>VMware</displayName>
    </flavorSet>
    <options autoResolve="false" baseFileName="" freespace="1024" installLabelPath="" natNetworking="true" swapSize="512" vmMemory="256"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/vmwareEsxImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/5fbfbac74be1703761d5f4d843aca4d1">
    <name>vmware</name>
    <displayName>VMware</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/vmwareImage">
      <name>vmwareImage</name>
      <displayName>VMware(R) Workstation/Fusion / Parallels(R) Virtual Appliance</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86_64">
      <name>x86_64</name>
      <displayName>x86 (64-bit)</displayName>
    </architecture>
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/vmware">
      <name>vmware</name>
      <displayName>VMware</displayName>
    </flavorSet>
    <options autoResolve="false" baseFileName="" diskAdapter="lsilogic" freespace="1024" installLabelPath="" natNetworking="true" swapSize="512" vmMemory="256" vmSnapshots="false"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/vmwareImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/14e2f46bc7d83b95300b17dded8d1c4c">
    <name>vmware</name>
    <displayName>VMware</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/vmwareEsxImage">
      <name>vmwareEsxImage</name>
      <displayName>VMware(R) ESX/VCD / Oracle(R) VirtualBox Virtual Appliance</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86_64">
      <name>x86_64</name>
      <displayName>x86 (64-bit)</displayName>
    </architecture>
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/vmware">
      <name>vmware</name>
      <displayName>VMware</displayName>
    </flavorSet>
    <options autoResolve="false" baseFileName="" freespace="1024" installLabelPath="" natNetworking="true" swapSize="512" vmMemory="256"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/vmwareEsxImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/d0bf5e94df8c729839c2b3a50d8e5b34">
    <name>virtual_iron</name>
    <displayName>Virtual Iron</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/virtualIronImage">
      <name>virtualIronImage</name>
      <displayName>Virtual Iron Virtual Appliance</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86">
      <name>x86</name>
      <displayName>x86 (32-bit)</displayName>
    </architecture>
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/virtual_iron">
      <name>virtual_iron</name>
      <displayName>Virtual Iron</displayName>
    </flavorSet>
    <options autoResolve="false" baseFileName="" freespace="1024" installLabelPath="" swapSize="512" vhdDiskType="dynamic"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/virtualIronImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/124a6b3c25ee6f1d07530cb751ac15bb">
    <name>virtual_iron</name>
    <displayName>Virtual Iron</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/virtualIronImage">
      <name>virtualIronImage</name>
      <displayName>Virtual Iron Virtual Appliance</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86_64">
      <name>x86_64</name>
      <displayName>x86 (64-bit)</displayName>
    </architecture>
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/virtual_iron">
      <name>virtual_iron</name>
      <displayName>Virtual Iron</displayName>
    </flavorSet>
    <options autoResolve="false" baseFileName="" freespace="1024" installLabelPath="" swapSize="512" vhdDiskType="dynamic"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/virtualIronImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/2560dae479b4fe726ac0429de3a72c5c">
    <name>xen_ova</name>
    <displayName>Xen OVA</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/xenOvaImage">
      <name>xenOvaImage</name>
      <displayName>Citrix(R) XenServer(TM) Appliance</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86">
      <name>x86</name>
      <displayName>x86 (32-bit)</displayName>
    </architecture>
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/xen">
      <name>xen</name>
      <displayName>Xen</displayName>
    </flavorSet>
    <options autoResolve="false" baseFileName="" freespace="1024" installLabelPath="" swapSize="512" vmMemory="256"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/xenOvaImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions/acd0dc888ab70e27d38447365fcb9f56">
    <name>xen_ova</name>
    <displayName>Xen OVA</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/xenOvaImage">
      <name>xenOvaImage</name>
      <displayName>Citrix(R) XenServer(TM) Appliance</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86_64">
      <name>x86_64</name>
      <displayName>x86 (64-bit)</displayName>
    </architecture>
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/xen">
      <name>xen</name>
      <displayName>Xen</displayName>
    </flavorSet>
    <options autoResolve="false" baseFileName="" freespace="1024" installLabelPath="" swapSize="512" vmMemory="256"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/xenOvaImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://localhost:8000/api/products/testproject/versions/1.0/imageTypeDefinitions/fdd0b7a91e0f0e87d0b8602ba2ce766e">
    <name>docker</name>
    <displayName>Docker</displayName>
    <container id="http://localhost:8000/api/products/testproject/versions/1.0/containers/dockerImage">
      <name>dockerImage</name>
      <displayName>Docker Image</displayName>
    </container>
    <architecture id="http://localhost:8000/api/products/testproject/versions/1.0/architectures/x86">
      <name>x86</name>
      <displayName>x86 (32-bit)</displayName>
    </architecture>
    <options/>
    <descriptor id="http://localhost:8000/api/v1/platforms/image_type_definition_descriptors/dockerImage"/>
  </imageTypeDefinition>
  <imageTypeDefinition id="http://localhost:8000/api/products/testproject/versions/1.0/imageTypeDefinitions/f64035ed21d386a181731702bbce88f5">
    <name>docker</name>
    <displayName>Docker</displayName>
    <container id="http://localhost:8000/api/products/testproject/versions/1.0/containers/dockerImage">
      <name>dockerImage</name>
      <displayName>Docker Image</displayName>
    </container>
    <architecture id="http://localhost:8000/api/products/testproject/versions/1.0/architectures/x86_64">
      <name>x86_64</name>
      <displayName>x86 (64-bit)</displayName>
    </architecture>
    <options/>
    <descriptor id="http://localhost:8000/api/v1/platforms/image_type_definition_descriptors/dockerImage"/>
  </imageTypeDefinition>
</imageTypeDefinitions>
"""
        self.assertXMLEquals(response,
            exp % dict(server = client.server, port = client.port))

    def testGetProductVersionStages(self):
        uriTemplate = 'products/%s/versions/%s/stages'
        uri = uriTemplate % (self.productShortName, self.productVersion)
        self.createUser('foouser')
        client = self.getRestClient(username='foouser')
        req, response = client.call('GET', uri, convert = True)
        exp = """\
<?xml version='1.0' encoding='UTF-8'?>
<stages>
  <stage id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Development">
    <hostname>testproject</hostname>
    <version>1.0</version>
    <name>Development</name>
    <label>testproject.rpath.local2@yournamespace:testproject-1.0-devel</label>
    <isPromotable>false</isPromotable>
    <groups href="http://%(server)s:%(port)s/api/products/testproject/repos/search?type=group&label=testproject.rpath.local2@yournamespace:testproject-1.0-devel"/>
    <images href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Development/images"/>
  </stage>
  <stage id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/QA">
    <hostname>testproject</hostname>
    <version>1.0</version>
    <name>QA</name>
    <label>testproject.rpath.local2@yournamespace:testproject-1.0-qa</label>
    <isPromotable>false</isPromotable>
    <groups href="http://%(server)s:%(port)s/api/products/testproject/repos/search?type=group&label=testproject.rpath.local2@yournamespace:testproject-1.0-qa"/>
    <images href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/QA/images"/>
  </stage>
  <stage id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Release">
    <hostname>testproject</hostname>
    <version>1.0</version>
    <name>Release</name>
    <label>testproject.rpath.local2@yournamespace:testproject-1.0</label>
    <isPromotable>false</isPromotable>
    <groups href="http://%(server)s:%(port)s/api/products/testproject/repos/search?type=group&label=testproject.rpath.local2@yournamespace:testproject-1.0"/>
    <images href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Release/images"/>
  </stage>
</stages>
"""
        self.failUnlessEqual(response,
            exp % dict(server = client.server, port = client.port))

    def testSetProductVersionPlatform(self):
        self.setupPlatforms()
        from mint.rest.db import platformmgr
        mock.mock(platformmgr.Platforms, '_checkMirrorPermissions',
                        True)
        self.mock(restbase.proddef.PlatformDefinition, 'snapshotVersions',
            lambda slf, conaryClient, platformVersion = None: None)
        platformVersion = models.PlatformVersion(
            name="foo", revision="foo", label="foo", version="foo",
            ordering="foo", _platformId="2")
        mock.mock(platformmgr.Platforms, 'getPlatformVersions',
            platformVersion)
        uriTemplate = 'products/%s/versions/%s/platformVersion'
        uri = uriTemplate % (self.productShortName, self.productVersion)
        client = self.getRestClient(username='foouser', admin=True)

        label = 'localhost@rpath:plat-2'
        data = """\
<platformVersion>
  <label>%s</label>
  <name>rebase-to-latest-on-versionless-platform</name>
</platformVersion>
""" % label
        req, response = client.call('PUT', uri, data, convert = True)
        expected = """\
<platformVersion id="http://localhost:8000/api/platforms/2/platformVersions/foo%3Dfoo">
  <name>foo</name>
  <version>foo</version>
  <revision>foo</revision>
  <label>foo</label>
  <ordering>foo</ordering>
</platformVersion>
"""
        self.assertXMLEquals(response, expected)

        # Make sure a GET fetches the same thing
        req, response = client.call('GET', uri, convert = True)
        self.assertXMLEquals(response, expected)

    def testGetProductVersionPlatform(self):
        uriTemplate = 'products/%s/versions/%s/platform'
        uri = uriTemplate % (self.productShortName, self.productVersion)
        self.createUser('foouser')
        client = self.getRestClient(username='foouser')
        req, response = client.call('GET', uri, convert = True)
        exp = """\
<?xml version='1.0' encoding='UTF-8'?>
<platform id="http://localhost:8000/api/products/testproject/versions/1.0/platform">
  <platformTroveName />
  <label/>
  <platformVersion></platformVersion>
  <productVersion>1.0</productVersion>
  <platformName>localhost@rpath:plat-1</platformName>
</platform>
"""
        self.assertXMLEquals(response, exp)

    def testSetImageDefinitions(self):
        uriTemplate = 'products/%s/versions/%s/imageDefinitions'
        uri = uriTemplate % (self.productShortName, self.productVersion)

        client = self.getRestClient(username='foouser', admin=True)
        req, response = client.call('PUT', uri, convert = True, body=imageSet1)

        exp = """\
<?xml version='1.0' encoding='UTF-8'?>
<imageDefinitions>
  <imageDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageDefinitions/dd09ba2ba7ad71c756bdf79dca0ec331">
    <name>Citrix XenServer 64-bit</name>
    <displayName>Citrix XenServer 64-bit</displayName>
    <imageGroup>group-testproject-appliance</imageGroup>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Development"/>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/QA"/>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Release"/>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/xenOvaImage">
      <name>xenOvaImage</name>
      <displayName>Citrix(R) XenServer(TM) Appliance</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86_64">
      <name>x86_64</name>
      <displayName>x86 (64-bit)</displayName>
    </architecture>
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/xen">
      <name>xen</name>
      <displayName>Xen</displayName>
    </flavorSet>
    <options autoResolve="false" baseFileName="" freespace="6789" installLabelPath="" natNetworking="false" swapSize="512" vmMemory="64"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/xenOvaImage"/>
  </imageDefinition>
  <imageDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageDefinitions/f529d60760c1d1b0250bbe5787a9f661">
    <name>virtual_irony 32-bit</name>
    <displayName>virtual_irony 32-bit</displayName>
    <imageGroup>group-testproject-appliance</imageGroup>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Development"/>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/QA"/>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Release"/>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/virtualIronImage">
      <name>virtualIronImage</name>
      <displayName>Virtual Iron Virtual Appliance</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86">
      <name>x86</name>
      <displayName>x86 (32-bit)</displayName>
    </architecture>
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/virtual_iron">
      <name>virtual_iron</name>
      <displayName>Virtual Iron</displayName>
    </flavorSet>
    <options autoResolve="false" baseFileName="" freespace="1024" installLabelPath="" swapSize="512" vhdDiskType="dynamic"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/virtualIronImage"/>
  </imageDefinition>
  <imageDefinition id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageDefinitions/23b4aba399fd29e9f28aac7a0c16d0ae">
    <name>update iso 64-bit</name>
    <displayName>update iso 64-bit</displayName>
    <imageGroup>group-testproject-appliance</imageGroup>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Development"/>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/QA"/>
    <stage href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/Release"/>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/updateIsoImage">
      <name>updateIsoImage</name>
      <displayName>Update CD/DVD</displayName>
    </container>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86_64">
      <name>x86_64</name>
      <displayName>x86 (64-bit)</displayName>
    </architecture>
    <options anacondaCustomTrove="" anacondaTemplatesTrove="conary.rpath.com@rpl:2" autoResolve="false" baseFileName="" betaNag="false" bugsUrl="" freespace="2048" installLabelPath="" mediaTemplateTrove="" showMediaCheck="false" swapSize="512"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/updateIsoImage"/>
  </imageDefinition>
  <imageDefinition id="http://localhost:8000/api/products/testproject/versions/1.0/imageDefinitions/007a4984a99129d86084918e09bfaf42">
    <name>Old UI image that has an extra generic flavor in it</name>
    <displayName>Old UI image that has an extra generic flavor in it</displayName>
    <imageGroup>group-testproject-appliance</imageGroup>
    <stage href="http://localhost:8000/api/products/testproject/versions/1.0/stages/Development"/>
    <stage href="http://localhost:8000/api/products/testproject/versions/1.0/stages/QA"/>
    <stage href="http://localhost:8000/api/products/testproject/versions/1.0/stages/Release"/>
    <container id="http://localhost:8000/api/products/testproject/versions/1.0/containers/applianceIsoImage">
      <name>applianceIsoImage</name>
      <displayName>Appliance Installable ISO</displayName>
    </container>
    <architecture id="http://localhost:8000/api/products/testproject/versions/1.0/architectures/x86">
      <name>x86</name>
      <displayName>x86 (32-bit)</displayName>
    </architecture>
    <options anacondaCustomTrove="" anacondaTemplatesTrove="conary.rpath.com@rpl:2" autoResolve="false" baseFileName="" betaNag="false" bugsUrl="" freespace="2048" installLabelPath="" mediaTemplateTrove="" showMediaCheck="false" swapSize="512"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/applianceIsoImage"/>
  </imageDefinition>
</imageDefinitions>
"""
        self.assertXMLEquals(response,
            exp % dict(server = client.server, port = client.port))

        # Make sure we're fetching the same thing
        req, response = client.call('GET', uri, convert=True)
        self.failUnlessEqual(response,
            exp % dict(server = client.server, port = client.port))

    def testCreateProductVersion(self):
        productName = "blahblah"
        productDescription = productName * 2

        uriTemplate = 'products'
        uri = uriTemplate
        client = self.getRestClient(admin = True, username='foouser')

        req, response = client.call('POST', uri, body=newProduct1 % dict(
                name = productName,
                description = productDescription),
                convert=True)
        newUri = 'http://localhost:8000/api/products/%s' % productName
        self.failUnless(('id="%s"' % newUri) in response)

        productVersion = '3.0'

        uriTemplate = 'products/%s/versions'
        uri = uriTemplate % (productName, )

        req, response = client.call('POST', uri, body=newProductVersion1
                % dict(version = productVersion),
                convert=True)
        newUri = ("http://localhost:8000/api/products/%s/versions/%s"
                  % (productName, productVersion))
        self.failUnless(('id="%s"' % newUri) in response)

    def testGetProducts(self):
        return self._testGetProducts()

    def testGetProductsNotLoggedIn(self):
        return self._testGetProducts(notLoggedIn = True)

    def _testGetProducts(self, notLoggedIn = False):

        uriTemplate = 'products'
        uri = uriTemplate
        kw = {}
        if notLoggedIn:
            kw['username'] = None
        else:
            self.createUser('foouser2')
            kw['username'] = 'foouser2'
        client = self.getRestClient(**kw)
        if notLoggedIn:
            client.restDb.auth.userId = None
        req, response = client.call('GET', uri, convert=True)
        exp = """\
<?xml version='1.0' encoding='UTF-8'?>
<products>
  <product id="http://%(server)s:%(port)s/api/products/testproject">
    <productId>1</productId>
    <hostname>testproject</hostname>
    <name>Project 1</name>
    <nameSpace>yournamespace</nameSpace>
    <domainname>rpath.local2</domainname>
    <shortname>testproject</shortname>
    <projecturl></projecturl>
    <repositoryHostname>testproject.rpath.local2</repositoryHostname>
    <repositoryUrl href="http://%(server)s:%(port)s/repos/testproject/api"/>
    <description></description>
    <prodtype>Appliance</prodtype>
    <commitEmail></commitEmail>
    <backupExternal>false</backupExternal>
    <timeCreated></timeCreated>
    <timeModified></timeModified>
    <hidden>false</hidden>
    <role>User</role>
    <versions href="http://%(server)s:%(port)s/api/products/testproject/versions/"/>
    <members href="http://%(server)s:%(port)s/api/products/testproject/members/"/>
    <creator href="http://%(server)s:%(port)s/api/users/adminuser">adminuser</creator>
    <images href="http://%(server)s:%(port)s/api/products/testproject/images/"/>
  </product>
</products>
"""
        resp = response
        for pat in [ "timeCreated", "timeModified" ]:
            resp = re.sub("<%s>.*</%s>" % (pat, pat),
             "<%s></%s>" % (pat, pat),
            resp)
        self.assertBlobEquals(resp,
                exp % dict(port = client.port, server = client.server))

    def testGetOneProduct(self):
        return self._testGetProducts()

    def testGetOneProductNotLoggedIn(self):
        return self._testGetOneProduct(notLoggedIn = True)

    def _testGetOneProduct(self, notLoggedIn = False):

        uriTemplate = 'products/testproject'
        uri = uriTemplate
        kw = {}
        if notLoggedIn:
            kw['username'] = None
        else:
            self.createUser('foouser')
            kw['username'] = 'foouser'
        client = self.getRestClient(**kw)
        if notLoggedIn:
            client.restDb.auth.userId = None
        req, response = client.call('GET', uri, convert=True)
        exp = """\
<?xml version='1.0' encoding='UTF-8'?>
<product id="http://%(server)s:%(port)s/api/products/testproject">
  <productId>1</productId>
  <hostname>testproject</hostname>
  <name>Project 1</name>
  <nameSpace>yournamespace</nameSpace>
  <domainname>rpath.local2</domainname>
  <shortname>testproject</shortname>
  <projecturl></projecturl>
  <repositoryHostname>testproject.rpath.local2</repositoryHostname>
  <repositoryUrl href="http://%(server)s:%(port)s/repos/testproject/api"/>
  <description></description>
  <prodtype>Appliance</prodtype>
  <commitEmail></commitEmail>
  <backupExternal>false</backupExternal>
  <timeCreated></timeCreated>
  <timeModified></timeModified>
  <hidden>false</hidden>
  <role>User</role>
  <versions href="http://%(server)s:%(port)s/api/products/testproject/versions/"/>
  <members href="http://%(server)s:%(port)s/api/products/testproject/members/"/>
  <creator href="http://%(server)s:%(port)s/api/users/adminuser">adminuser</creator>
  <images href="http://%(server)s:%(port)s/api/products/testproject/images/"/>
</product>
"""
        resp = response
        for pat in [ "timeCreated", "timeModified" ]:
            resp = re.sub("<%s>.*</%s>" % (pat, pat),
             "<%s></%s>" % (pat, pat),
            resp)
        self.assertXMLEquals(resp,
             exp % dict(port = client.port, server = client.server))

    def testGetProductVersions(self):
        return self._testGetProductVersions()

    def testGetProductVersionsNotLoggedIn(self):
        return self._testGetProductVersions(notLoggedIn = True)

    def _testGetProductVersions(self, notLoggedIn = False):

        uriTemplate = 'products/testproject/versions'
        uri = uriTemplate
        kw = {}
        if notLoggedIn:
            kw['username'] = None
        else:
            self.createUser('foouser')
            kw['username'] = 'foouser'
        client = self.getRestClient(**kw)
        if notLoggedIn:
            client.restDb.auth.userId = None
        req, response = client.call('GET', uri, convert=True)
        exp = """\
<?xml version='1.0' encoding='UTF-8'?>
<productVersions>
  <productVersion id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0">
    <versionId>1</versionId>
    <hostname>testproject</hostname>
    <name>1.0</name>
    <productUrl href="http://%(server)s:%(port)s/api/products/testproject"/>
    <nameSpace>yournamespace</nameSpace>
    <description>Version description</description>
    <timeCreated></timeCreated>
    <platform href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/platform"/>
    <platformVersion href="http://localhost:8000/api/products/testproject/versions/1.0/platformVersion"/>
    <stages href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/stages/"/>
    <definition href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/definition"/>
    <imageTypeDefinitions href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageTypeDefinitions"/>
    <imageDefinitions href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/imageDefinitions"/>
    <images href="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/images"/>
    <sourceGroup>group-testproject-appliance</sourceGroup>
  </productVersion>
</productVersions>
"""
        resp = response
        for pat in [ "timeCreated", "timeModified" ]:
            resp = re.sub("<%s>.*</%s>" % (pat, pat),
             "<%s></%s>" % (pat, pat),
            resp)
        self.failUnlessEqual(resp,
             exp % dict(port = client.port, server = client.server))

imageSet1 = """
<imageDefinitions>
  <imageDefinition>
    <name>Citrix XenServer 64-bit</name>
    <displayName>Citrix XenServer 64-bit Edited for Completeness</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/xenOvaImage"/>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86_64"/>
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/xen">
    </flavorSet>
    <options autoResolve="false" freespace="6789" natNetworking="false" vmMemory="64" swapSize="512" installLabelPath="" baseFileName=""/>
  </imageDefinition>
  <imageDefinition>
    <name>virtual_irony 32-bit</name>
    <displayName>Virtual Irony 32-bit</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/virtualIronImage"/>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86" />
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/virtual_iron">
    </flavorSet>
    <options autoResolve="false" installLabelPath="" baseFileName="" swapSize="512" freespace="1024"/>
  </imageDefinition>
  <imageDefinition>
    <name>update iso 64-bit</name>
    <displayName>update iso 64-bit</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/updateIsoImage"/>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86_64" />
    <options autoResolve="false" installLabelPath="" baseFileName="" swapSize="512" freespace="2048"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/updateIsoImage"/>
  </imageDefinition>
  <imageDefinition>
    <name>Old UI image that has an extra generic flavor in it</name>
    <displayName>Old UI image that has an extra generic flavor in it</displayName>
    <container id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/containers/applianceIsoImage"/>
    <architecture id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/architectures/x86" />
    <flavorSet id="http://%(server)s:%(port)s/api/products/testproject/versions/1.0/flavorSets/generic">
    </flavorSet>
    <options autoResolve="false" installLabelPath="" baseFileName="" swapSize="512" freespace="2048"/>
    <descriptor id="http://%(server)s:%(port)s/api/v1/platforms/image_type_definition_descriptors/xenOvaImage"/>
  </imageDefinition>
</imageDefinitions>
"""

newProduct1 = """
<product>
  <hostname>%(name)s</hostname>
  <name>%(name)s</name>
  <shortname>%(name)s</shortname>
  <description>%(description)s</description>
</product>
"""

newProductVersion1 = """
<productVersion>
  <description />
  <hostname />
  <id />
  <name>%(version)s</name>
  <nameSpace />
</productVersion>
"""

promoteGroup = """
<trove>
  <hostname />
  <name>group-%(name)s-appliance</name>
  <version>/testproject.rpath.local2@yournamespace:testproject-1.0-devel/1-2-1</version>
  <label>testproject.rpath.local2@yournamespace:testproject-1.0-devel</label>
  <trailingVersion />
  <flavor>~!dom0,~!domU,vmware,~!xen is: x86(i486,i586,i686,sse,sse2)</flavor>
  <timestamp />
  <images />
</trove>
"""


Industry shares were mixed this week. Signet Jewelers (-11%) trailed retail stocks, after announcing disappointing results, store closures, and layoffs. In India, PC Jeweller (+52%) soared in the wake of private-equity fund Creador reportedly upping its stake in the company. Miners had a shaky performance, with Stornoway Diamond (-24%) seeing the steepest decline after terminating its open-pit operations.
April 18, 2019 (10:44 GMT) April 11, 2019 (13:04 GMT) Chng.


First Hit: It was thoughtful, funny and makes a good point – pay attention to each moment because that is where life exists.
The men in Tim's (Domhnall Gleeson) family have the ability to go back in time and redo/retry events. They, like Tim, get told by their fathers when they are 21 years old. Tim's dad (Bill Nighy) tells him that the best way he can use this power is for something he loved.
Tim wants to be loved and to love. He meets Mary (Rachel McAdams) in a dark dinner house (this is actually both funny and interesting) and gets her phone number. Because he re-winds the night to help is uncle with his opening night play, he doesn't get to keep the phone number and although he has the experience of meeting she doesn't.
The whole film is about the choices he makes, some for himself and some for others and the resulting consequences. In the end he realizes it is about paying attention to each and every little thing. The actors, especially Nighy, are lively, interesting and funny.
Gleeson is very good as the thoughtful young man who wants to and finds love. McAdams is funny and delightful as Mary. Nighy is so wonderful to watch and steals every scene he's in. Lynda Wilson (playing Kit Kat), Lindsay Duncan (playing Mum) and Richard Cordery (playing Uncle D) were all very good. Richard Curtis wrote a fun crisp script and directed this cast in the same way.
Overall: This is a very fun film and worth the price of admission.


text:
Spun Records é uma gravadora de música trance. fundada em 1999 pelo grupo holandês Growling Mad Scientists. Foi a primeira gravadora de psy-trance nos Estados Unidos.

Em 2002, o GMS abriu uma franquia em Ibiza, Espanha.

Em 2004, foi criado o selo "Nice Dreams Music", que produzia um mix de música ambiente, chill, electro, club e house.

A gravadora fechou em 2007.

Gravadoras dos Estados Unidos
Gravadoras de música eletrônica

redpajama_set_name: RedPajamaWikipedia


text:
Custom art is the latest amenity for New York City's luxury buildings
Neha Banka Kanoria
Art is in the eye of the beholder, but in New York City it's increasingly becoming in the eye of the real estate seeker.
Although displayed art work has always been a part of high-end residential buildings, the trend has accelerated in the past five years. Along with amenities like indoor pools, gyms and roof decks, art work is becoming a coveted feature among residents as real estate developers are now turning to big-name artists to incorporate their work into properties.
This contemporary art can provide a modern contrast to an older building and its architecture, or contribute to a new building's design concept. New real estate developments mainly feature artwork as a way to fill wall space in lobbies, lounges and common areas.
"Savvy developers are always looking for ways to make their new building stand out among the competition and to get an artist who is well-known to contribute a piece to a building adds to the overall allure.While fine art is appreciated by many homeseekers, at the end of the day, clients rent or purchase property because the design of the living space suits their specific needs and the home is within their budget," said Jodi Stasse, senior managing director of new developments at Citi Habitats. "The fact the property features a noteworthy piece of art and the publicity that it attracts, may put a particular building on a homeseeker's radar screen."
Kenton Place
Kenton Place, a prewar high-rise on 63rd Street and Second Avenue in Manhattan, features an art installation by modernist metal sculpturist Albert Paley in the building's lobby. Paley's work is on display at the Metropolitan Museum of Art along with others museums in the country.
Ice Cream Factory Lofts
The Ice Cream Factory Loftsat 347 Berry St. in Williamsburg, Brooklyn, is a new 23-unit rental building that uses part of a 1919 ice cream factory as its facade. The developer hired Brooklyn-based artist Katie Merz to paint thousands of glyphs in white on the black facade of the building, her signature work.
"Our conceptinterprets the life of graffiti, buildings and New York City as layers. Brooklyn is changing and we wanted to build upon, not erase, so we added a new layer both physically, conceptually and artistically," said Chris Horrigan, of Horrigan Development, the building's developer.
Last summer at Manhattan Park, an apartment complex on Roosevelt Island, installation artist Eric Rieger who goes by the name of HOT TEA, painted the pool deck of the complex in candy colors, using about 120 gallons of paint for his entire artwork. For the past two years, local street artists have been commissioned to create an immersive mural around the pool because it becomes a popular hangout during the summer.
"HOT TEA creates bright, rainbowlike installations that just make you feel good. We wanted to bring that colorful vibe to Manhattan Park," said Stasse whose Citi Habitats is doing the marketing and leasing for Manhattan Park.
Sky, a luxury apartment building on 42nd Street and 11th Avenue in Manhattan built in 2015, features a number of artworks by prominent artists, but none possibly as iconic as Yayoi Kusama. The Japanese artist, at 87, holds the record for being paid the highest price for a work as a living, female artist. Along with works by German visual artist Gerhard Richter and American pop artist Tom Wesselmann, three of Kusama's works are displayed in the building.
In the outdoor court, Kusama's sculpture in bronze, "Large Pumpkin," weighing 2,668 pounds and measuring approximately 8 feet on all sides, is on display, while two paintings from her "White Infinity Net" series are in the lobby. The Moinian family, the developers of the apartment building, have been patrons of the arts, said Natasha Vardi, senior vice president of residential properties at The Moinian Group, explaining the reason why so much artwork has been installed in the building.
80 DKLB
80 DKLB, a 36-story residential building built in 2010 in Fort Greene, Brooklyn, features the work of Christina Watka, a Manhattan-based porcelain artist. The installation piece titled "Murmuration XV: Mammoth" is a cluster of small hand-sculpted porcelain.
"This specific installationmimics the patterns of people walking through the city streets. The installationtravels along a 17-foot wall like a constellation or a herd of animals. The tiny porcelain shapes reflect the activity on the street — people coming home from work or families congregating on the edge of a street waiting for the light to turn," Watka explained.
Forest City Ratner Cos., the developers of the building, wanted to pay "homage" to the contributions of the artists who shape the borough and decided to incorporate art into the building.
"Creating a site-specific installation on the street level of a high-rise building in Downtown Brooklyn was a new kind of project for me. Much of the work I make belongs to private collections, so there are far fewer eyes that get to enjoy it.This project, on the other hand, has a much larger reach," Watka said.
Brazil's Pele returns to hospital for tumor treatment checkup
Take a peek inside the most expensive homes in New York City
Inside Look: 6 indoor pools made for resort-style living
Should you consider getting a roommate to save money on rent?
12 websites and resources for no-fee apartments

redpajama_set_name: RedPajamaCommonCrawl


text:
Q: Importing all the modules from a subdirectory I'm trying to import all of the modules from a subdirectory with the next code in __init__.py in my_modules_folder:
from os.path import dirname, basename, isfile
import glob

def __reply_to_text():
    path = glob.glob(dirname(__file__)+"/*.py")
    mod = [ basename(f)[:-3] for f in path if isfile(f) and not f.endswith('__init__.py')]
    return mod

REPLY_TO_TEXT = __reply_to_text()

__all__ = REPLY_TO_TEXT

But it doesn't work. I'm importing REPLY_TO_TEXT in __main__.py but it doesn't work

A: So:
The updated code is:
from os.path import dirname, basename, isfile
import glob
path = glob.glob(dirname(__file__) + "/*.py")
__all__ = [ basename(f)[:-3] for f in path if isfile(f) and f.endswith(".py") and not f.endswith('__init__.py')]

By default you can't import all the modules from a folder with from my_folder import * so the code above will make allow you to import all of the modules with *
So we have this dir:
> app_py
    >__main__.py
    > __init__.py
    >folder
        __init__.py
        example.py

Adding the above script in folder/init.py will allow you to import all the modules from that folder with from app_py.folder import * method that wasn't possible without the above script (You had to import each file every time)

redpajama_set_name: RedPajamaStackExchange


text:
Best Routes
Find a Bike Shop
New to Cycling
Not enough data yet, please check again later.
Worldly lessons from track championships
Karl Baumgart November 7, 2016
ArizonaCaliforniaNationalNewsStandard News0 Comments0 views
Athlete Octane's Karl Baumgart raced this year's Masters Track World Championships in Manchester, England in the Men's 40-44 age group.
Day 1: Individual TT – 750m – 4th Place, 51.141
The week started off with a very close call in an event I had little expectation to medal. I missed the podium by 26 thousandths of a second… or 2.6 hundredths. Put that in perspective, both third place and fourth ran the same time at 51.1 seconds.
While I earned a silver medal earlier in the year in the kilo (1000m) at elite nationals and also earned a Masters National championship in the same distance event; the 750 is more challenging for me. Over a shorter distance, I struggle against pure sprinters and their ability to start out of the gate, or pure torque to get the bike moving.
My physiology allows me to execute on a final lap holding speed longer than others; hence my placing higher in a 1K, versus 750 meters. So I already knew I was up against some giants in the event, and in fact a new world record time was set in our group by the defending champion as he went 47.9 seconds over 750m.
This was a personal record run for me and also the very first 750m I've ever raced… so obviously I was stoked with the result.
Day 2: Individual Pursuit – 3K – Bronze Medalist, 3:30.779; Qualifying Heat: 4th – 3:31.1
Once again, given the field that shows up at worlds, I had little sense that I could medal in this event. And watching the near new world record run by my friend and team pursuit teammate, Dean Phillips (he went 3:25.7); a bronze medal is a fabulous result.
Truly, I had to earn this one more than any of my other events. Being in a bronze medal heat, third and fourth place qualifiers end up fighting for a single medal (unlike the gold/silver heats which they're each guaranteed a spot on the podium).
Coming in as a very slight underdog, I knew I'd need the ride of my life to get on the third step. Interestingly, in my qualifying heat; I had to pass someone which I believe cost me a ride against Dean (World Champ) for the silver medal (2nd place qualifier was only 0:00.2 faster than me).
With that said, I didn't really feel like an underdog, but I knew I still needed to leave everything out there for a win of the race; my competitor had won a silver medal in this event the prior year in the younger age bracket (35-39), and has put up a time faster than I ever have.
Thankfully I ended up going faster in my final, so this ended in two consecutive personal best times for me in this event.
Day 3: Team Pursuit – 3K – Silver Medalist, 3:20.397; Qualifying Heat – 2nd 3:21.1
This was the event I thought we (all the team members) had the best opportunity for a gold medal. Given previous year's times, we felt we had the squad to deliver the goods here. The amazing thing is, we did set the second fastest qualifying time and earned a spot to ride for gold. How we did it was even more amazing – we basically fell apart in the first three to four laps and had to claw our way back into contention.
Riding just prior to us was a new World Record ride by the local Manchester squad, Secret Training. Seriously, they ran like clockwork and had the gold and silver medalists from the 35-39 age group on their team.
They ended up going 3:16 and 3:15.5 in the qualifier and the final respectively.
Seeing how strong they were, we needed to devise a plan to attempt to overcome them, and unfortunately in the final we shredded our squad into two parts over the first kilometer of the final.
The crazy part is we still had a time that would have won a gold medal in the previous two years of competition. It just speaks clearly that how you place in most races is a matter of who shows up, more than how you do. We threw down seriously respectable times, and hit the marks we thought we could. You can't plan on another squad showing up and dropping a world record on your head.
That's bike racing…
Day 4: Scratch Race – 10K, Silver Medal, Qualifying Heat – 1st
After crashing in the final 2.5K of this race last year (caused by a tired/unaware rider), and missing out on a championship and gold medal, I was looking forward to seeing if it was a fluke performance, or if I could be a regular force in a mass start race.
This is not the best type of thinking as a racer. It messes with your head.
There were more than 30 riders from all over the world riding at the top of their game and it would be arrogance to believe I deserved any certain result. Honestly, the worlds scratch race champ from two years prior, Jeromy Cottell, (also a team pursuit team mate of mine) was in the race and I knew he and a handful of other guys could easily win this one.
In fact, both he and I qualified first and second in our respective heats. But being another marked man, Jeromy had a hard time shaking the Argentinean contingent in both the heats and the final. On my end, no one even bothered to stop me in the heats from taking a lap.
It wasn't until after the final that I was told the winner rode my wheel for the entire race!
Apparently he put his race on my wheel, even to the point of staying with me after my attempt at an early break set me off the back to recover. He stayed on my wheel so closely; I didn't even know he was there.
During the race there were plenty of attacks by Jeromy and other riders, which I had to cover. All the while, the Swiss rider was glued to my wheel offering no help. What's more, it turned out that this race was over 31 mph and the fastest race of the entire week!
Some feedback from my team and coach led me to believe the race we held at a high rate intentionally so that neither myself, nor guys like Jeromy could attack and put a lap on the field. There were no laps on the field in this race, which made it an outright jailbreak at the end!
I had a microscopic opportunity, with seven laps to go, and attacked the field in the sprint lane, ending up on the gas for 2 straight laps in a two-man breakaway with the Swiss rider to the end. Some in-fighting transpired behind me allowed us to hold pace for the seven laps and finish clear of the fight for bronze in a field sprint.
But it was clear with three laps to go I was gassed compared to the Swiss rider. So much so that the announcer was already calling me the silver medalist given the amount of snap the Swiss rider had in his legs when he came through for his turn at pulling. I honestly had a hard time getting to his wheel to get a draft; which is insane.
Here's a lesson: save as much energy as possible during a race – if you've got a card to play in the end you'll appreciate it.
It was painful to watch (in real time) what I felt was my gold medal ride away from me in the final lap sprint. Smart racing on his part, and an honor someone would believe my wheel was the one that he had to be on – only coming out from behind it to work when it counted.
Day 5: Points Race – 20K – 6th Place, with 25 points; Qualifying Heat – 1st, with 18 points
With legs spent from four previous days of hard racing, I was feeling a little ragged coming into this day. It would end up being my last chance to win a gold medal, and seeing I took a lap on the field last year, solo, I had very high hopes on this race.
It was a serious concern that I would be riding with Jeromy Cottell again; he did win a masters nationals points race championship just six weeks earlier. Both Jeromy and I qualified first in our respective heats for this race, and we discussed a "team" effort to avoid being ganged up on by other countries.
Unfortunately for both Jeromy and I, we got the start time of the race wrong and ended up with me barely making it to the line for the final and Jeromy missing the final all together.
So with no warm up, no rider to work with me in the race and tired legs; I put down the best effort I could, racing as smartly as I could – but it wasn't meant to be. The Argentina squad was focused on me this go around, and it was an effort to respond to attacks in what was the fastest 80-lap points race I have ever been in…30 mph (the fastest points race of the week)!
I was able to score points in three of the eight sprints and also took a lap (with no help from Argentina who was trying to prevent it). With just two sprints to go; I was out of contention for a gold medal, and it would be a massive effort to earn another bronze medal.
With all their effort from their four rider squad, Argentina failed to close to deal and lock up a gold medal, and a local strong British rider ended up scoring lots of sprint wins in the break earning him a gold medal. Argentina did end up with silver and bronze, but I was glad to see the efforts to focus on me cost them the ultimate prize.
I would have had more respect if they had instead worked as a team to earn more and more points and set up sprints every 10 laps. But they thought isolating and covering everything I could do was a better strategy. They had the horsepower to control the race in a positive manner, versus colluding to prevent others from racing hard as well.
There were a lot of lessons learned by me yet again in this week of world championship racing.
I learned there are a lot of fast old guys out here racing still.
I learned not to be too predictable; your competition will know who you are and how you race and are prepared for it.
I learned (or rather was reminded) not to expect a result, or ranking; those are an outcome in part of who shows up to race that day. You can only focus on your efforts and yourself.
I learned that a World Championship jersey isn't something that's handed out to anyone; no matter how fast you are or how well you race. Too much can happen, and if it's meant to be, it will happen.
I learned I can still go faster, and have even more to learn to continue to excel at the sport.
Finally, I learned we are at a massive handicap in Arizona without a track to practice on. I could have benefited from regular track time to help me with the ebb and flow of mass start racing, as well as starts, pursuit lap pacing and general track awareness.
Our team's monthly trips to the Velo Sports Center in California certainly help, but there are so many elements that can't be explained, but have to be lived. That's why I'm excited to transform the 2016 Athlete Octane Track Racing team, into the Foundation for American Track Cycling's own team, Velo Track Club. We have a number of sponsors already on board with more to come, including but not limited to GQ-6, FFWD Wheels, and The Velo bicycle shop in downtown Phoenix.
All racers from Arizona are encouraged to contact myself or our other team board members Bob Francis or Wayne Lewis for more information.
Previous ArticleHappy Halloween: Did US cyclocross start with Miss Gulch?
Next ArticleMcNulty signs with Rally Cycling
Karl Baumgart
Specialized unveils self-riding bicycle
clippedin April 1, 2016
Team USA advances to BMX semifinals
clippedin August 18, 2016
Red Hook Crit London: fixed on nerves and adrenaline
clippedin July 14, 2015
Breakaway shakes up GC for women; men's overall holds
Sarah Muench March 2, 2019
USA's Bookwalter races to 16th in Olympic road race
clippedin August 6, 2016
VIDEO: Voight, Rodriguez preview Tour of California stages
Holly Resh May 15, 2016
Marcotte, Jackson win VOS road race, no major change for pro GC standings
Sarah Muench February 14, 2016
Riders prepare to battle each other, adverse weather at Whiskey
clippedin April 29, 2016
Post Group Ride
Add Coach
Add Bike Shop
Shipping Policy/FAQ
Return Policy/FAQ
© ClippedIn 2019
Clipped In is the biggest online resource for cycling events, races and news in the United States. We are putting all cycling events, group rides and other helpful resources like news and local training routes all in one place. Find your favorite cycling events and bike races on clippedin.bike so you can stay up to date with your cycling community, get better at what you love and enjoy the best sport in the world.
We provide a one-stop shop with cycling news, events, discounts, store, a comprehensive cycling event calendar, races, rides, bike shops, teams in road cycling, mountain biking, cross-country mountain biking, downhill mountain biking, cyclocross, track cycling, BMX and triathlon. You can create your own bike race calendar with our My List feature. You can also post bike races, cycling events, group rides, cycling team information, bike shop and coach bios.
Finally there's one place where you can find both sanctioned events and fun rides, gran fondos and gravel races, crits, road races, cross races, mountain bike races, fat bike races, donut rides and more. We live for cycling and so do you, so why not have a place for all of our favorite events to live?
Cycling event promoters, race directors and cycling sponsors are also welcome - we can't think of a better way to get the word out about your events and products to an audience who craves them.
Whether you are a competitive cyclist or you want to go out on a fun group cycling ride, you're in the right place.
Now get out there and turn the crank!
"A bicycle ride around the world begins with a single pedal stroke."
—Scott Stoll
We will keep you Clipped In by sending you relevant information about upcoming events and deals from our sponsors.
'); isvalidEmail=false; } if(isvalidName==true && isvalidEmail==true){ $n(".AjaxLoader").show(); $n('#mysuccess_msg').html(''); $n('#mysuccess_msg').hide(); $n('#myerror_msg').html(''); $n('#myerror_msg').hide(); var nonce ='5db46a8d96'; var url = 'https://staging.clippedin.bike/wp-content/plugins/email-subscribe/'; var email=$n("#youremail").val(); var name =$n("#yourname").val(); var str="action=store_email&email="+email+'&name='+name+'&sec_string='+nonce; $n.ajax({ type: "POST", url: 'https://staging.clippedin.bike/wp-admin/admin-ajax.php', data:str, async:true, success: function(msg){ if(msg!=''){ var result=msg.split("|"); if(result[0]=='success'){ $n(".AjaxLoader").hide(); $n('#mysuccess_msg').html(result[1]); $n('#mysuccess_msg').show(); setTimeout(function(){ $n.fancybox_ns.close(); },2000); } else{ $n(".AjaxLoader").hide(); $n('#myerror_msg').html(result[1]); $n('#myerror_msg').show(); } } } }); } }


A free service offered by appointment only with one of our highly trained Pharmacists. It is very important for medicines to work properly that they are taken at the correct dose and times. Whenever medicines change is a time when it can be confusing as to what you need to take and when. For instance, if you have recently come out of hospital, your medicines change or you are starting a new medicine including asthma medicines such as new puffers; we take the time to sit with you in our private counselling room and go through each and every medicine you are on, explain what it does and how it may interact. We even take a look at any over the counter medicines (like vitamins) you are taking to make sure you are getting the best health outcome.
In order to be eligible for this free to you, government funded, service you need to hold a current government issued concession card, live at home in the community, be experiencing difficulties in managing your medicines or be taking more than five (5) medicines per day, and not have had a medicines check/home medicines review in the last 12 months. Call us to book your appointment today!
Sun & Public Holidays CLOSED.


We are a family friendly setting and a registered charity. We are able to offer a full holiday childcare service, in addition to our nursery care, to local families and to families in our surrounding areas, with children aged 2 to 11 years old. We are open between the hours of 7.30-6.00, Monday to Friday, during school holidays.
Our staff are highly experienced and qualified. We offer flexible hours to fit around families requirements.
We provide age appropriate activities and listen and engage with the children in order to support their leisure time whilst at the holiday club and have space for up to 30 children per session.
If you would like to view our facilities first hand please contact us to arrange a mutually convenient appointment and we will be happy to show you around and discuss further.
The Saplings has an extensive public car parking availability.
The Saplings holiday scheme runs during all school holidays and has spaces for children aged 2-11 years.
Yes - Yes- we encourage all our children to learn about and show awareness of other cultures and languages. We incorporate a variety of multi cultural equipment into all aspects of our learning.
Yes - Yes - we meet all individual needs of the children in our care. Please discuss these with us prior to your child attending.
Yes - Yes - We accept all children no matter what their individual needs and adapt our facilities accordingly.
Staff member Amy Sparrow (SendCo) and Nicole Harris (Deputy SendCo) have undertaken Special Educational Needs modules to enable them to support staff in providing the best and appropriate care for all children attending the setting.
Staff members have a wealth of experience in dealing with a variety additional needs, working with parents and outside agencies to provide the most appropriate and beneficial care to the child.


As this type of marketing is new to many people, we've put together some Q&As for some of the more commonly asked questions. If of course your question isn't answered here, please don't hesitate to contact us! We'd love to hear from you.
Internet marketing has a lot of acronyms. What do they all mean?
Like any industry, Internet Marketing is littered with acronyms and buzzwords. We've put together a brief explanation of the more popular ones right here.
What are the business benefits of Internet Marketing?
As the Internet continues to surge in popularity, more and more people are using search services to look up information about a particular product, service or to gather information for making a purchase or other buying decision. Being the 'new Yellow Pages', no business can afford not to be easily found on the Internet.
By being easily found, a business can expect new interest and new leads which ultimately generate new sales opportunities.
How long will it take my company to be on the front page of Google?
Any SEO campaign takes time to have effect. This is largely due to how long it takes the search engines to crawl all the competing sites and evaluate them against each other. Typically a well constructed campaign will start to show significant momentum within 4-6 months. It can take more or less than this time depending on other factors, the primary issue being competition.
If a small software company writing addons for Windows 7 wants to rank highly for the search term "Windows 7″ it will unlikely ever beat Microsoft to the top spot. This is because Microsoft have a hugely relevant website which Google will recognize as an authority and therefore award preferential search positions to.
If on the other hand, a company wanted to rank highly for "gherkin and cream cocktail recepies", we'd be confidant of getting them ranked #1 within a week!
A professional company has the necessary knowledge to handle every aspect of search engine marketing. We will work on achieving your goals.
You or your staff may not have time to invest learning SEO. Your time is better spent focusing on other aspects of your business while you let experienced professionals handle your online strategy.
Overdoing one method or choosing the wrong search terms can have a devistating effect on your site's visibility, as far as even becoming deregistered by the search engines altogether. InterSites has the experience to customise the strategy for your individual site and apply it in the most effective way.
It takes a lot of time to learn how to perform SEO/SEM properly, to be able to predict changes in the search market and act accordingly, to develop and put into action new strategies.
Are you using 100% safe, approved methods?
Unlike many of our competitors, we wouldn't consider using anything else…or we wouldn't be in business for long.
All our work is hand done, no automated software is used.
Any links we build to your site are relevant and themed from static pages. No useless link farms or any of that rubbish.
We dont use any dodgy techniques such as page redirection ect…just plain old fashioned page optimisation and marketing.


text:
The 'forgotten' Piccadilly depot is set to be turned into 1,300 homes, a hotel and more than 807,000 sq ft of office space
Owners of the Mayfield depot say an official announcement is expected next week
Andrew Bardsley
Inside Mayfield Depot
A new park, 1,300 homes, a hotel and more than 807,000 sq ft of office space could be built as part of plans to develop the 'forgotten' Mayfield depot.
London based developers U+I are believed to have been confirmed as the firm behind the plan to transform the derelict station - opposite Piccadilly, with an official announcement expected later this week.
According to council documents, a 'major' new park along the River Medlock is also included in the plans, which could feature an 'urban tree nursery' as well as 'temporary soft landscaping' while the area is developed.
Shops and leisure opportunities are also planned, in order to attract people to live there.
The former railway station is run by the Mayfield Partnership, comprising of landowners London and Continental Railways (LCR) and Manchester council and Transport for Greater Manchester.
Plans state that the retention of the building is integral to the scheme, but this needs to be agreed with Network Rail as part of the site is identified to be part of the £1bn Northern Hub project to improve rail services.
Inside the Mayfield Depot as it is now
The Mayfield Depot was temporarily used as a music venue for the Manchester International Festival in 2013, featuring a collaboration between the filmmaker Adam Curtis and the band Massive Attack.
A year later The Warehouse Project announced a bid to move into the building, but the project collapsed after LCR backed out.
The abandoned plans to turn city's 'forgotten space' into arts venue
Council chiefs say the new plans will create jobs and make the area attractive for businesses.
A report to be discussed by the council's executive states: "The delivery of Mayfield will result in a major mixed use scheme on a currently derelict site.
The Adam Curtis and Massive Attack collaboration at the Mayfield Depot (Image: Twitter)
"As well as providing new high quality commercial accommodation, the new residential accommodation and the public amenities including public realm, retail and leisure opportunities will create a desirable location in which to live and work.
"A major new park for the city, available for all residents and visitors, is proposed as part of the SRF.
"Located immediately adjacent to Piccadilly Station, Mayfield is also highly connected to all forms of public transport, minimising the need for car journeys to and from the area, and pedestrian and cycle routes through the area will be prioritised."
Mayfield Depot
A spokesperson for the Mayfield Partnership said: "The procurement process to select a development partner for Manchester Mayfield is currently in a standstill period, in accordance with OJEU regulations.
"Once that period has come to an end, the Mayfield Partnership, comprising LCR, Manchester council and Transport for Greater Manchester, will announce the preferred bidder to lead the regeneration of this 24-acre, key gateway site in Manchester City Centre.
"We expect to be able to make this announcement on 16 September."
Queus for a Manchester International Festival event at Mayfield Depot
Star and Garter landlord Andy Martin, whose neighbouring Grade II listed pub is already under threat as part of plans to extend Piccadilly Station, says he does not know whether this proposed development would affect the pub.
He said: "It's still all up in the air. We get a lot of love from people coming in and being concerned asking if it is going to be knocked down.
"I just have to tell them: 'I don't know'."
The future of Manchester
Sites developers want to build on
Gary Neville's St Michael's plans
Mapped: 32 game-changing developments
What will skyscraper boom mean?
Helping city keep its swagger
Swish flats built with council loans
Mayfield Depot plane revealed
Work starts on Medieval Quarter
Manchester International Festival
Transport for Greater Manchester
Warehouse Project
Manchester Development
Manchester City EDS