Okay, started evaluating TG2 in the meantime :)

I am playing with EasyCrudRestController now (full project is here:
https://bitbucket.org/pihentagy/mindeningyen-tg2)

Some questions (I don't know if these type of questions should go to TG2 or
to the sprox list)
1.) I would like to add an extra computed field to the table view of the
items (items has many attempts), the number of attempts. As I see, it
should be possible:

class ItemController(EasyCrudRestController):
    model = Item
    __form_options__ = { # for Edit and Add forms
        '__hide_fields__': ['id'],
    }
    __table_options__ = { # see Sprox TableBase and Sprox TableFiller
        '__limit_fields__': ['title', 'desc'],
        #'__add_fields__': {'no_attempts': RecordFieldWidget },
    }

but when I uncomment the last line, I get trace1 below. Yes, I don't know
what should go instead of RecordFieldWidget.

2.) As moschlar pointed out, if I declare a _name property for a model, it
will be used in a one-to-many relation. (they kindly posted
https://gist.github.com/moschlar/4714146 for me) But could it be used in
the other direction? Eg. item has many attempts. Attempt has a _name
property. But on the page http://127.0.0.1:8080/items/1/edit Attempts are
just ids.

3.) I would like to filter the items: I would display by default only those
items, which don't have successful attempts. Is it possible with
EasyCrudRestController?

thanks in advance

Any hints about EasyCrudRestController is welcome, like this one:
http://blog.axant.it/archives/423

trace1:
URL: http://127.0.0.1:8080/items/
File
'D:\\prg\\tg2env\\lib\\site-packages\\weberror-0.10.3-py2.7.egg\\weberror\\evalexception.py',
line 431 in respond
  app_iter = self.application(environ, detect_start_response)
File
'D:\\prg\\tg2env\\lib\\site-packages\\turbogears2-2.2.2-py2.7.egg\\tg\\configuration\\app_config.py',
line 945 in remover
  return app(environ, start_response)
File
'D:\\prg\\tg2env\\lib\\site-packages\\repoze.tm2-1.0-py2.7.egg\\repoze\\tm\\__init__.py',
line 24 in __call__
  result = self.application(environ, save_status_and_headers)
File
'D:\\prg\\tg2env\\lib\\site-packages\\repoze.who-2.1b1-py2.7.egg\\repoze\\who\\middleware.py',
line 87 in __call__
  app_iter = app(environ, wrapper.wrap_start_response)
File
'D:\\prg\\tg2env\\lib\\site-packages\\tw2.core-2.1.3-py2.7.egg\\tw2\\core\\middleware.py',
line 195 in __call__
  resp = req.get_response(self.app, catch_exc_info=True)
File 'build\\bdist.win-amd64\\egg\\webob\\request.py', line 1082 in
get_response
File 'build\\bdist.win-amd64\\egg\\webob\\request.py', line 1055 in
call_application
File
'D:\\prg\\tg2env\\lib\\site-packages\\beaker-1.6.4-py2.7.egg\\beaker\\middleware.py',
line 73 in __call__
  return self.app(environ, start_response)
File
'D:\\prg\\tg2env\\lib\\site-packages\\beaker-1.6.4-py2.7.egg\\beaker\\middleware.py',
line 155 in __call__
  return self.wrap_app(environ, session_start_response)
File
'D:\\prg\\tg2env\\lib\\site-packages\\routes-1.13-py2.7.egg\\routes\\middleware.py',
line 131 in __call__
  response = self.app(environ, start_response)
File
'D:\\prg\\tg2env\\lib\\site-packages\\pylons-1.0.1-py2.7.egg\\pylons\\wsgiapp.py',
line 103 in __call__
  response = self.dispatch(controller, environ, start_response)
File
'D:\\prg\\tg2env\\lib\\site-packages\\pylons-1.0.1-py2.7.egg\\pylons\\wsgiapp.py',
line 313 in dispatch
  return controller(environ, start_response)
File 'D:\\prg\\pythonic\\mindeningyen-tg2\\mindeningyen\\lib\\base.py',
line 31 in __call__
  return TGController.__call__(self, environ, start_response)
File
'D:\\prg\\tg2env\\lib\\site-packages\\pylons-1.0.1-py2.7.egg\\pylons\\controllers\\core.py',
line 214 in __call__
  response = self._dispatch_call()
File
'D:\\prg\\tg2env\\lib\\site-packages\\pylons-1.0.1-py2.7.egg\\pylons\\controllers\\core.py',
line 164 in _dispatch_call
  response = self._inspect_call(func)
File
'D:\\prg\\tg2env\\lib\\site-packages\\pylons-1.0.1-py2.7.egg\\pylons\\controllers\\core.py',
line 107 in _inspect_call
  result = self._perform_call(func, args)
File
'D:\\prg\\tg2env\\lib\\site-packages\\turbogears2-2.2.2-py2.7.egg\\tg\\controllers\\dispatcher.py',
line 124 in _perform_call
  r = self._call(func, params, remainder=remainder)
File
'D:\\prg\\tg2env\\lib\\site-packages\\turbogears2-2.2.2-py2.7.egg\\tg\\controllers\\decoratedcontroller.py',
line 133 in _call
  output = controller_callable(*remainder, **dict(params))
File 'build\\bdist.win-amd64\\egg\\tgext\\crud\\controller.py', line 223 in
get_all
File
'D:\\prg\\tg2env\\lib\\site-packages\\sprox-0.8.2-py2.7.egg\\sprox\\fillerbase.py',
line 217 in get_value
  elif self.__provider__.is_binary(self.__entity__, field) and value is not
None:
File
'D:\\prg\\tg2env\\lib\\site-packages\\sprox-0.8.2-py2.7.egg\\sprox\\sa\\provider.py',
line 126 in is_binary
  field = self.get_field(entity, name)
File
'D:\\prg\\tg2env\\lib\\site-packages\\sprox-0.8.2-py2.7.egg\\sprox\\sa\\provider.py',
line 121 in get_field
  raise AttributeError
AttributeError:


On Tue, Feb 5, 2013 at 1:40 PM, Moritz Schlarb <[email protected]>wrote:

> Well, IMHO, the interesting features that TG2 offers (and Pyramid doesn't,
> at least AFAIK) are:
>
> - The awesome quickstart template - which makes TG2 a really *rapid* web
> development framework
> - tgext.crud and tgext.admin (together with sprox) can save you lots of
> tedious, manual work, too (Sprox explicitly states that it is about "making
> your code smarter, not smaller" - tgext.crud really can make it much
> smaller)
> - The object dispatch mechanism - if you like a declarative programming
> style
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to