Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Zenobius Jiricek
committed
Dec 27, 2011
1 parent
dae41d9
commit 455e240
Showing
6 changed files
with
102 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
class DynamicChoice(object): | ||
""" | ||
Trivial example of creating a dynamic choice | ||
""" | ||
|
||
def __iter__(self, *args, **kwargs): | ||
for choice in self.generate(): | ||
if hasattr(choice,'__iter__'): | ||
yield (choice[0], choice[1]) | ||
else: | ||
yield choice, choice | ||
|
||
def __init__(self, *args, **kwargs): | ||
""" | ||
If you do it here it is only initialized once. Then just return generated. | ||
""" | ||
import random | ||
self.generated = [random.randint(1,100) for i in range(10)] | ||
|
||
def generate(self, *args, **kwargs): | ||
""" | ||
If you do it here it is initialized every time the iterator is used. | ||
""" | ||
import random | ||
return [random.randint(1,100) for i in range(10)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import os | ||
|
||
from setuptools import ( | ||
setup, | ||
find_packages, | ||
) | ||
|
||
def read(fname): | ||
return open(os.path.join(os.path.dirname(__file__), fname)).read() | ||
|
||
setup( | ||
name='djangocms-plugin-configurableproduct', | ||
version='0.0.1', | ||
classifiers = [ | ||
'Development Status :: 4 - Beta', | ||
'Framework :: Django', | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: BSD License', | ||
'Operating System :: OS Independent', | ||
'Programming Language :: Python', | ||
'Topic :: Internet :: WWW/HTTP', | ||
], | ||
packages=find_packages(), | ||
install_requires=[ | ||
'sorl-thumbnail', | ||
'django-shop', | ||
], | ||
author='Pavel Zhukov', | ||
author_email='airtonix@gmail.com', | ||
description='DjangoCMS plugin for Configurable product for django-shop', | ||
long_description = read('README.md'), | ||
license='BSD', | ||
keywords='djangocms, django-shop, product', | ||
url='git://github.com/airtonix/djangocms-plugin-configurableproduct.git', | ||
include_package_data=True, | ||
zip_safe = False, | ||
) |