コード例 #1
0
ファイル: test_vars.py プロジェクト: Rub3nC/buildout_tutorial
class test_DottedVar(unittest.TestCase):
    def setUp(self):
        self.dvar = DottedVar('name', 'description')
    
    def testValidation(self):
        """ all parts of a dotted name must be valid python identifiers
        """
        for val in ('this.package', '_foo_.bar', '__class__.__name__'):
            self.assertEquals(val, self.dvar.validate(val))
        
        for val in ('ham-and-eggs.yummy', 'spam.yucky!'):
            self.assertRaises(ValidationException, self.dvar.validate, val)
コード例 #2
0
ファイル: test_vars.py プロジェクト: kkdhanesh/NBADEMO
class test_DottedVar(unittest.TestCase):
    def setUp(self):
        self.dvar = DottedVar('name', 'description')

    def testValidation(self):
        """ all parts of a dotted name must be valid python identifiers
        """
        for val in ('this.package', '_foo_.bar', '__class__.__name__'):
            self.assertEquals(val, self.dvar.validate(val))

        for val in ('ham-and-eggs.yummy', 'spam.yucky!'):
            self.assertRaises(ValidationException, self.dvar.validate, val)
コード例 #3
0
class Plone3Portlet(PloneApp):
    _template_dir = 'templates/plone3_portlet'
    summary = "A Plone 3 portlet"
    help = """
This creates a Plone project for a portlet.
"""
    required_templates = ['nested_namespace']
    use_cheetah = True

    vars = copy.deepcopy(PloneApp.vars)
    get_var(vars, 'namespace_package').default = 'collective'
    get_var(vars, 'namespace_package2').default = 'portlet'
    vars.append(
        StringVar(
            'portlet_name',
            title='Portlet Name',
            description='Name of portlet (human readable)',
            modes=(EASY,EXPERT),
            default='Example Portlet',
            help="""
This becomes the human-readable title of the portlet.
It gets generated in the GenericSetup profile file for the portlet.
It appears in the Plone UI when managing portlets.
"""
        )
        )
    vars.append(
        DottedVar(
            'portlet_type_name',
            title='Portlet Type Name',
            description='Name of portlet type (actual name)',
            modes=(EASY, EXPERT),
            default='ExamplePortlet',
            help="""
This becomes the actual name of the portlet. It is not displayed
in the Plone UI, but is the name it is registered under, and is
used as the class name for the portlet, and is used in the
generated GenericSetup profile.
"""
        )
        )

    def pre(self, command, output_dir, vars):
        vars['zip_safe'] = False
        vars['portlet_filename'] = vars['portlet_type_name'].lower()
        vars['dotted_name'] = "%s.%s.%s" % (vars['namespace_package'],
                                            vars['namespace_package2'],
                                            vars['package'])

        super(Plone3Portlet, self).pre(command, output_dir, vars)
コード例 #4
0
ファイル: test_base.py プロジェクト: kkdhanesh/NBADEMO
 def setUp(self):
     """ set up some basics for the coming tests
     """
     self.vars = [
         var('basic_var', 'This is a basic variable',
             title="Basic Title", default="foo",
             modes=(EXPERT, EASY)),
         BooleanVar('bool_var', 'This is a boolean variable',
                    title="Boolean Title", default=False, page='Main',
                    modes=(EASY)),
         StringVar('str_var', 'This is a string variable',
                   title="String Title", default="string", page='Carl',
                   modes=(EXPERT)),
         TextVar('txt_var', 'This is a text variable', page='Martin',
                 title="Text Title", default="text",
                 modes=()),
         DottedVar('dot_var', 'This is a dotted variable',
                   title="Dotted Title", default="dotted.variable")
     ]
     self.template = BaseTemplate('my_name')
     create = get_commands()['create'].load()
     command = create('create')
     command.parse_args(['-t','archetype'])
     self.command = command
コード例 #5
0
ファイル: test_vars.py プロジェクト: Rub3nC/buildout_tutorial
 def setUp(self):
     self.dvar = DottedVar('name', 'description')
コード例 #6
0
ファイル: nested_namespace.py プロジェクト: kkdhanesh/NBADEMO
import copy

from zopeskel.base import get_var
from zopeskel.base import var, EXPERT, EASY
from zopeskel.basic_namespace import BasicNamespace
from zopeskel.vars import DottedVar

VAR_NS2 = DottedVar('namespace_package2',
                    title='Namespace 2 Package Name',
                    description='Name of inner namespace package',
                    default='plone',
                    modes=(EXPERT, ),
                    page='Namespaces',
                    help="""
This is the name of the inner namespace package (Python folder) for this
project. For example, in 'plone.app.example', this would be
'app' ('plone' will be the first namespace, and 'example' would be
the package name). 
""")


class NestedNamespace(BasicNamespace):
    _template_dir = 'templates/nested_namespace'
    summary = "A basic Python project with a nested namespace (2 dots in name)"
    ndots = 2
    help = """
This creates a Python project without any Zope or Plone features.
"""
    required_templates = []
    use_cheetah = True
コード例 #7
0
class BasicNamespace(BaseTemplate):
    _template_dir = 'templates/basic_namespace'
    summary = "A basic Python project with a namespace package"
    ndots = 1
    help = """
This creates a Python project without any Zope or Plone features.
"""
    category = "Core Python"

    required_templates = []
    use_cheetah = True
    vars = copy.deepcopy(BaseTemplate.vars)
    vars += [
        DottedVar(
            'namespace_package', 
            title='Namespace Package Name',
            description='Name of outer namespace package',
            default='plone', 
            modes=(EXPERT,), 
            page='Namespaces',
            help="""
This is the name of the outer package (Python folder) for this project.
For example, in 'Products.PloneFormGen', this would be 'Products'.
This will often be (for Plone products) 'Products'; it may also be
the name of your company/project, or a common-style name like
(for Plone products) 'collective'.

Note that, for some templates, there may be two namespaces, rather
than one (to create eggs with names like 'plone.app.blog')--in this
case, this would be 'plone', the first of the enclosing namespaces.
            """
            ), 

        DottedVar(
            'package', 
            title='Package Name',
            description='Name of the inner namespace package',
            default='example', 
            modes=(EXPERT,), 
            page='Namespaces',
            help="""
This is the name of the innermost package (Python folder) for this project.
For example, in 'Products.PloneFormGen', this would be 'PloneFormGen'.

Note that, for some templates, there may be only a package name without
a namespace package around it--in this case, this would be just the name
of the package.
"""
            ),

        StringVar(
            'version', 
            title='Version',
            description='Version number for project',
            default='1.0', 
            modes=(EASY, EXPERT), 
            page='Metadata',
            help="""
This becomes the version number of the created package. It will be set
in the egg's setup.py, and may be referred to in other places in the
generated project.    
"""
            ),

        StringVar(
            'description',
            title='Description',
            description='One-line description of the project', 
            default='',
            modes=(EASY, EXPERT), 
            page='Metadata',
            help="""
This should be a single-line description of your project. It will be
used in the egg's setup.py, and, for Zope/Plone projects, may be used
in the GenericSetup profile description.
"""
            ),

        TextVar(
            'long_description', 
            title='Long Description',
            description='Multi-line description (in ReST)', 
            default='',
            modes=(), 
            page='Metadata',
            help="""
This should be a full description for your project. It will be
used in the egg's setup.py.

It should be entered in 'restructured text' format; for information,
see http://docutils.sourceforge.net/rst.html).
"""
            ),

        StringVar(
            'author',
            title='Author',
            description='Name of author for project',
            modes=(), 
            page='Metadata',
            help="""
This should be the name of the author of this project. It will be used
in the egg's setup.py, and, for some templates, in the generated
documentation/README files.
"""
            ),

        StringVar(
            'author_email',
            title='Author Email', 
            description='Email of author for project',
            modes=(), 
            page='Metadata',
            help="""
This should be the name of the author of this project. It will be used
in the egg's setup.py, and, for some templates, in the generated
documentation/README files.
"""
            ),

        StringVar('keywords',
            title='Keywords',
            description='List of keywords, space-separated', 
            modes=(), 
            page='Metadata',
            help="""
This should be the list of keywords for this project. This will be
used in the egg's setup.py (and, if this egg is later published on
PyPI, will be used to categorize the project).
"""
            ),
            
        StringVar(
            'url', 
            title='Project URL',
            description='URL of the homepage for this project',
            modes=(), 
            page='Metadata',
            default='http://svn.plone.org/svn/collective/',
            help="""
This should be a URL for the homepage for this project (if applicable).
It will be used in the egg's setup.py.
"""
            ),

        StringVar(
            'license_name', 
            title='Project License',
            description='Name of license for the project',
            default='GPL', 
            modes=(), 
            page='Metadata',
            help="""
The license that this project is issued under. It will be used in the
egg's setup.py.

Common choices here are 'GPL' (for the GNU General Public License),
'ZPL' (for the Zope Public License', and 'BSD' (for the BSD license).
"""
            ),

        BooleanVar(
            'zip_safe',
            title='Zip-Safe?',
            description='Can this project be used as a zipped egg? (true/false)',
            default=False,
            modes=(), 
            page='Metadata',
            help="""
Some eggs can be used directly by Python in zipped format; others must
be unzipped so that their contents can be properly used. Zipped eggs
are smaller and may be easier to redistribute.

Most Zope/Plone projects cannot be used in zipped format; if unsure,
the safest answer is False.
            """
            ),
        ]

    def check_vars(self, vars, command):
        if not command.options.no_interactive and \
           not hasattr(command, '_deleted_once'):
            del vars['package']
            command._deleted_once = True
        return super(BasicNamespace, self).check_vars(vars, command)
コード例 #8
0
ファイル: test_vars.py プロジェクト: kkdhanesh/NBADEMO
 def setUp(self):
     self.dvar = DottedVar('name', 'description')