hivesolutions / appier

Joyful Python Web App development
http://appier.hive.pt
Apache License 2.0
126 stars 22 forks source link

Appier can't fill unpersisted models with relations #3

Closed tsilva closed 8 years ago

tsilva commented 8 years ago

Description

Calling new() on a model with relations causes an error like the following:

AttributeError

500 - 'module' object has no attribute 'Wishlist'
Traceback (most recent call last):
File "/repo.extra/appier/src/appier/base.py", line 803, in application_l
result = self.handle()
File "/repo.extra/appier/src/appier/base.py", line 931, in handle
else: result = self.route()
File "/repo.extra/appier/src/appier/base.py", line 1159, in route
else: return_v = method_i(*args, **kwargs)
File "/repo.extra/myswear/src/myswear/controllers/web/base.py", line 104, in do_signup
user = sadapters.models.User.new()
File "/repo.extra/appier/src/appier/model.py", line 354, in new
if fill: model = cls.fill(model)
File "/repo.extra/appier/src/appier/model.py", line 970, in fill
default = _type._default() if hasattr(_type, "_default") else default
File "/repo.extra/appier/src/appier/typesf.py", line 424, in _default
return cls(None)
File "/repo.extra/appier/src/appier/typesf.py", line 373, in __init__
self.__start__()
File "/repo.extra/appier/src/appier/typesf.py", line 417, in __start__
if is_reference: self._target = self.__class__._target()
File "/repo.extra/appier/src/appier/typesf.py", line 428, in _target
if is_reference: return getattr(common.base().APP.models_i, target)
AttributeError: 'module' object has no attribute 'Wishlist'
tsilva commented 8 years ago

This error can currently be reproed on the myswear project by filling up the signup form in /signup.

joamag commented 8 years ago

@tsilva I'll try to fix this by allowing the registration of non data-source related (detached) models, this may take a while to implement in the appier infra-structure

joamag commented 8 years ago

This is now considered fixed