henri-hulski/cartridge_braintree

is this Package support Python3?

decemer opened this issue · 10 comments

i have do according readme.rst my,is this Package support Python3?

D:\Python34\lib\site-packages\mezzanine\utils\conf.py:47: UserWarning: You haven
't defined the ALLOWED_HOSTS settings, which Django requires. Will fall back to
the domains configured as sites.
  warn("You haven't defined the ALLOWED_HOSTS settings, which "
              .....
          _d^^^^^^^^^b_
       .d''           ``b.
     .p'                `q.
    .d'                   `b.
   .d'                     `b.   * Mezzanine 4.1.0
   ::                       ::   * Django 1.9.5
  ::    M E Z Z A N I N E    ::  * Python 3.4.3
   ::                       ::   * SQLite 3.8.3.1
   `p.                     .q'   * Windows 8
    `p.                   .q'
     `b.                 .d'
       `q..          ..p'
          ^q........p^
              ''''

Performing system checks...

Unhandled exception in thread started by <function check_errors.<locals>.wrapper
 at 0x0444E4F8>
Traceback (most recent call last):
  File "D:\Python34\lib\site-packages\django\utils\autoreload.py", line 226, in
wrapper
    fn(*args, **kwargs)
  File "D:\Python34\lib\site-packages\mezzanine\core\management\commands\runserv
er.py", line 154, in inner_run
    super(Command, self).inner_run(*args, **kwargs)
  File "D:\Python34\lib\site-packages\django\core\management\commands\runserver.
py", line 116, in inner_run
    self.check(display_num_errors=True)
  File "D:\Python34\lib\site-packages\django\core\management\base.py", line 426,
 in check
    include_deployment_checks=include_deployment_checks,
  File "D:\Python34\lib\site-packages\django\core\checks\registry.py", line 75,
in run_checks
    new_errors = check(app_configs=app_configs)
  File "D:\Python34\lib\site-packages\django\core\checks\urls.py", line 13, in c
heck_url_config
    return check_resolver(resolver)
  File "D:\Python34\lib\site-packages\django\core\checks\urls.py", line 23, in c
heck_resolver
    for pattern in resolver.url_patterns:
  File "D:\Python34\lib\site-packages\django\utils\functional.py", line 33, in _
_get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "D:\Python34\lib\site-packages\django\core\urlresolvers.py", line 417, in
 url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "D:\Python34\lib\site-packages\django\utils\functional.py", line 33, in _
_get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "D:\Python34\lib\site-packages\django\core\urlresolvers.py", line 410, in
 urlconf_module
    return import_module(self.urlconf_name)
  File "D:\Python34\lib\importlib\__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "D:\0MyCMS\cartridge\project\project\urls.py", line 36, in <module>
    url("^shop/checkout%s" % _slash, include("cartridge_braintree.urls")),
  File "D:\Python34\lib\site-packages\django\conf\urls\__init__.py", line 52, in
 include
    urlconf_module = import_module(urlconf_module)
  File "D:\Python34\lib\importlib\__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "D:\Python34\lib\site-packages\cartridge_braintree\urls.py", line 10, in
<module>
    extra_context = {"client_token": braintree_payment.client_token()}
  File "D:\Python34\lib\site-packages\cartridge_braintree\braintree_payment.py",
 line 50, in client_token
    return braintree.ClientToken.generate()
  File "D:\Python34\lib\site-packages\braintree\client_token.py", line 16, in ge
nerate
    return gateway.generate(params)
  File "D:\Python34\lib\site-packages\braintree\client_token_gateway.py", line 2
4, in generate
    response = self.config.http().post(self.config.base_merchant_path() + "/clie
nt_token", params)
  File "D:\Python34\lib\site-packages\braintree\configuration.py", line 96, in b
ase_merchant_path
    return "/merchants/" + self.merchant_id
TypeError: Can't convert 'NoneType' object to str implicitly

@decemer
Thanks for your report.
I just installed a Python 3 virtualenv for reproducing your error, but here is everything fine:

(venv_3)pacha@xibalba:~/web/hempis.local/private/hempis/hempis$ ./manage.py runserver
              .....
          _d^^^^^^^^^b_
       .d''           ``b.
     .p'                `q.
    .d'                   `b.
   .d'                     `b.   * Mezzanine 4.1.0
   ::                       ::   * Django 1.9.5
  ::    M E Z Z A N I N E    ::  * Python 3.4.2
   ::                       ::   * PostgreSQL 9.4.6
   `p.                     .q'   * Linux 4.4.0-0.bpo.1-amd64

    `p.                   .q'
     `b.                 .d'
       `q..          ..p'
          ^q........p^
              ''''

Performing system checks...

System check identified no issues (0 silenced).
April 11, 2016 - 17:01:42
Django version 1.9.5, using settings 'hempis.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

Try to set the the ALLOWED_HOSTS settings to something like
ALLOWED_HOSTS = ["127.0.0.1", "localhost"].

If not it's maybe a Windows problem.

yes,my platform is Window
i have done
"cartridge_braintree",and

BRAINTREE_MERCHANT = <your merchant ID>
BRAINTREE_PUBLIC_KEY = <your public key>
BRAINTREE_PRIVATE_KEY = <your private key>

in setting.py,and done url.py

_slash = "/" if settings.APPEND_SLASH else ""

urlpatterns += [

    # cartridge_braintree URLs.
    url("^shop/checkout%s" % _slash, include("cartridge_braintree.urls")),

    # Cartridge URLs.
    url("^shop/", include("cartridge.shop.urls")),
    url("^account/orders/$", order_history, name="shop_order_history"),

is that enough to run server correct?
i try ubuntu linux,its the same,maybe is my setting problem,what i need to do?

root@ubuntu:/home/chenjingli/Desktop/project# python3 manage.py runserver
/usr/local/lib/python3.4/dist-packages/mezzanine/utils/conf.py:47: UserWarning: You haven't defined the ALLOWED_HOSTS settings, which Django requires. Will fall back to the domains configured as sites.
  warn("You haven't defined the ALLOWED_HOSTS settings, which "
/usr/local/lib/python3.4/dist-packages/mezzanine/utils/conf.py:47: UserWarning: You haven't defined the ALLOWED_HOSTS settings, which Django requires. Will fall back to the domains configured as sites.
  warn("You haven't defined the ALLOWED_
```HOSTS settings, which "
              .....
          _d^^^^^^^^^b_
       .d''           ``b.
     .p'                `q.
    .d'                   `b.
   .d'                     `b.   * Mezzanine 4.1.0
   ::                       ::   * Django 1.9.5
  ::    M E Z Z A N I N E    ::  * Python 3.4.0
   ::                       ::   * SQLite 3.8.2
   `p.                     .q'   * Linux 3.13.0-32-generic
    `p.                   .q'
     `b.                 .d'
       `q..          ..p'
          ^q........p^
              ''''

Performing system checks...

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f40e6b6e7b8>
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/django/utils/autoreload.py", line 226, in wrapper
    fn(*args, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/mezzanine/core/management/commands/runserver.py", line 154, in inner_run
    super(Command, self).inner_run(*args, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/django/core/management/commands/runserver.py", line 116, in inner_run
    self.check(display_num_errors=True)
  File "/usr/local/lib/python3.4/dist-packages/django/core/management/base.py", line 426, in check
    include_deployment_checks=include_deployment_checks,
  File "/usr/local/lib/python3.4/dist-packages/django/core/checks/registry.py", line 75, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/usr/local/lib/python3.4/dist-packages/django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/usr/local/lib/python3.4/dist-packages/django/core/checks/urls.py", line 23, in check_resolver
    for pattern in resolver.url_patterns:
  File "/usr/local/lib/python3.4/dist-packages/django/utils/functional.py", line 33, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python3.4/dist-packages/django/core/urlresolvers.py", line 417, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/usr/local/lib/python3.4/dist-packages/django/utils/functional.py", line 33, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python3.4/dist-packages/django/core/urlresolvers.py", line 410, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2231, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2214, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2203, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1448, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/home/chenjingli/Desktop/project/project/urls.py", line 36, in <module>
    url("^shop/checkout%s" % _slash, include("cartridge_braintree.urls")),
  File "/usr/local/lib/python3.4/dist-packages/django/conf/urls/__init__.py", line 52, in include
    urlconf_module = import_module(urlconf_module)
  File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2231, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2214, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2203, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1448, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/usr/local/lib/python3.4/dist-packages/cartridge_braintree-1.0b14-py3.4.egg/cartridge_braintree/urls.py", line 10, in <module>
    extra_context = {"client_token": braintree_payment.client_token()}
  File "/usr/local/lib/python3.4/dist-packages/cartridge_braintree-1.0b14-py3.4.egg/cartridge_braintree/braintree_payment.py", line 50, in client_token
    return braintree.ClientToken.generate()
  File "/usr/local/lib/python3.4/dist-packages/braintree-3.25.0-py3.4.egg/braintree/client_token.py", line 16, in generate
    return gateway.generate(params)
  File "/usr/local/lib/python3.4/dist-packages/braintree-3.25.0-py3.4.egg/braintree/client_token_gateway.py", line 24, in generate
    response = self.config.http().post(self.config.base_merchant_path() + "/client_token", params)
  File "/usr/local/lib/python3.4/dist-packages/braintree-3.25.0-py3.4.egg/braintree/configuration.py", line 96, in base_merchant_path
    return "/merchants/" + self.merchant_id
TypeError: Can't convert 'NoneType' object to str implicitly

First set the the ALLOWED_HOSTS settings to something like
ALLOWED_HOSTS = ["127.0.0.1", "localhost"].

You have to replace , and with the values you get from Braintree after registration.
Without brackets.

still same in window,'NoneType' object,u see

(env) D:\0MyCMSWebsite\cartridge\cartridge\project>python manage.py runserver
              .....
          _d^^^^^^^^^b_
       .d''           ``b.
     .p'                `q.
    .d'                   `b.
   .d'                     `b.   * Mezzanine 4.1.0
   ::                       ::   * Django 1.9.5
  ::    M E Z Z A N I N E    ::  * Python 3.4.3
   ::                       ::   * SQLite 3.8.3.1
   `p.                     .q'   * Windows 7
    `p.                   .q'
     `b.                 .d'
       `q..          ..p'
          ^q........p^
              ''''

Performing system checks...

Unhandled exception in thread started by <function check_errors.<locals>.wrapper
 at 0x03BFA9C0>
Traceback (most recent call last):
  File "D:\0MyCMSWebsite\env\lib\site-packages\django\utils\autoreload.py", line
 226, in wrapper
    fn(*args, **kwargs)
  File "D:\0MyCMSWebsite\env\lib\site-packages\mezzanine\core\management\command
s\runserver.py", line 154, in inner_run
    super(Command, self).inner_run(*args, **kwargs)
  File "D:\0MyCMSWebsite\env\lib\site-packages\django\core\management\commands\r
unserver.py", line 116, in inner_run
    self.check(display_num_errors=True)
  File "D:\0MyCMSWebsite\env\lib\site-packages\django\core\management\base.py",
line 426, in check
    include_deployment_checks=include_deployment_checks,
  File "D:\0MyCMSWebsite\env\lib\site-packages\django\core\checks\registry.py",
line 75, in run_checks
    new_errors = check(app_configs=app_configs)
  File "D:\0MyCMSWebsite\env\lib\site-packages\django\core\checks\urls.py", line
 13, in check_url_config
    return check_resolver(resolver)
  File "D:\0MyCMSWebsite\env\lib\site-packages\django\core\checks\urls.py", line
 23, in check_resolver
    for pattern in resolver.url_patterns:
  File "D:\0MyCMSWebsite\env\lib\site-packages\django\utils\functional.py", line
 33, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "D:\0MyCMSWebsite\env\lib\site-packages\django\core\urlresolvers.py", lin
e 417, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "D:\0MyCMSWebsite\env\lib\site-packages\django\utils\functional.py", line
 33, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "D:\0MyCMSWebsite\env\lib\site-packages\django\core\urlresolvers.py", lin
e 410, in urlconf_module
    return import_module(self.urlconf_name)
  File "D:\0MyCMSWebsite\env\lib\importlib\__init__.py", line 109, in import_mod
ule
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "D:\0MyCMSWebsite\cartridge\cartridge\project\project\urls.py", line 36,
in <module>
    url("^shop/checkout%s" % _slash, include("cartridge_braintree.urls")),
  File "D:\0MyCMSWebsite\env\lib\site-packages\django\conf\urls\__init__.py", li
ne 52, in include
    urlconf_module = import_module(urlconf_module)
  File "D:\0MyCMSWebsite\env\lib\importlib\__init__.py", line 109, in import_mod
ule
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "D:\0MyCMSWebsite\env\lib\site-packages\cartridge_braintree\urls.py", lin
e 10, in <module>
    extra_context = {"client_token": braintree_payment.client_token()}
  File "D:\0MyCMSWebsite\env\lib\site-packages\cartridge_braintree\braintree_pay
ment.py", line 50, in client_token
    return braintree.ClientToken.generate()
  File "D:\0MyCMSWebsite\env\lib\site-packages\braintree\client_token.py", line
16, in generate
    return gateway.generate(params)
  File "D:\0MyCMSWebsite\env\lib\site-packages\braintree\client_token_gateway.py
", line 24, in generate
    response = self.config.http().post(self.config.base_merchant_path() + "/clie
nt_token", params)
  File "D:\0MyCMSWebsite\env\lib\site-packages\braintree\configuration.py", line
 96, in base_merchant_path
    return "/merchants/" + self.merchant_id
TypeError: Can't convert 'NoneType' object to str implicitly

It looks like your merchant ID is wrong.
Are you sure you use the one from Braintree?

You have to replace <your merchant ID>, <your public key> and <your private key> with the values you get from Braintree after registration.
Without brackets.

i have runsever when checkout Braintree API could not be created.
and my setting is right
BRAINTREE_MERCHANT = 'sj5pXXXXXXXX8td',
i copy cartridge_braintree-master templates and static,still no working,should i copy Modify templates and static file in it

No need to copy templates or static, if you have cartridge_braintree in your INSTALLED_APPS before cartridge.shop and you don't overwrite them.

Maybe just send your relevant settings (with changed Braintree data) so I can have a look.

i have send u my code to henri.hulski@gazeta.pl,plz check what wrong thanks u

I found the problem.
It's actually a bug in the documentation.
It should be BRAINTREE_MERCHANT_ID not BRAINTREE_MERCHANT.

Beside of this you should not use commas after the statements,
So it would be:
BRAINTREE_MERCHANT_ID = 'sj5pXXXXXXXX8td'
without the comma.

Thank you for your feedback, I fixed it in bcefe35. :-)

thanks