Sprox and pyramid

64 views
Skip to first unread message

pihentagy

unread,
Feb 4, 2013, 5:24:31 AM2/4/13
to sprox
Hi all!

I am evaluating pyramid and tg2 for my next web-toy project to learn
something new. As I see on the sprox web page, it is written for tg2
users. However, as a request for a stackoverflow answer, mmerickel was
kind to provide me a basic sample app here: https://github.com/mmerickel/pyramid_sprox_demo

However, this sample still not covers some important aspects, which I
would like to hear from.
1. So, are there any pyramid users on this list?
2. If I ask newbie questions for pyramid usage, is it ok?
3. If both 1. and 2. are true, could I / someone update the docs for
pyramid usage for newbies?
4. See http://sprox.org/#current-release: it states current release is
0.7.1

thanks
Gergo

Alessandro Molina

unread,
Feb 4, 2013, 11:31:26 AM2/4/13
to sprox
Hi,
Sprox itself is not tightly coupled to TurboGears2, it's just used by the TurboGears Admin and tgext.crud to automatically generate administrative interfaces.

While I'm a pyramid user, I never used sprox on Pyramid, I tend to prefer Pyramid for web services while using TurboGears2 for more feature full apps. My experience with sprox internals suggests me that it should work without much issues with Pyramid, but that is not something supported by actual testing :D




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



pihentagy

unread,
Feb 4, 2013, 4:13:03 PM2/4/13
to sp...@googlegroups.com
In what aspect do you enjoy TG2 over Pyramid for using web sites for humans? Is there a chance, that I can find some thought about when to prefer one over the other? (yes, maybe someone will say, that it is comparing apples and oranges)

Moritz Schlarb

unread,
Feb 5, 2013, 7:40:00 AM2/5/13
to sp...@googlegroups.com, turbo...@groups.google.com
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

Regards,
Moritz

KONTRA, Gergely

unread,
Feb 5, 2013, 11:32:12 AM2/5/13
to sp...@googlegroups.com, turbo...@groups.google.com
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:
Message has been deleted

KONTRA, Gergely

unread,
Feb 5, 2013, 4:46:01 PM2/5/13
to sp...@googlegroups.com, turbo...@groups.google.com
On Tue, Feb 5, 2013 at 1:40 PM, Moritz Schlarb <ma...@moritz-schlarb.de> 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
Seems marginal to me. If you build up your own components once, you can copy it
 
- 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)
But that is sprox. And, as you said that, sprox is not tied to TG2.
Well, the admin is impressive (as much as in django), but some AddRecordForms and some forms for editing, and almost there... I am hunting information how can I customize the "default" admin. I began to feel, that the right thing would be to write it from scratch (using sprox)
 
- The object dispatch mechanism - if you like a declarative programming style
Also seems marginal to me, and you can have something like pyramid_handlers



Regards,
Moritz

Am Montag, 4. Februar 2013 22:13:03 UTC+1 schrieb pihentagy:
In what aspect do you enjoy TG2 over Pyramid for using web sites for humans? Is there a chance, that I can find some thought about when to prefer one over the other? (yes, maybe someone will say, that it is comparing apples and oranges)



+-[ Gergely Kontra <pihe...@gmail.com> ]------------------+
|                                                           |
| Mobile:(+36 20)356 9656                                   |
|                                                           |
+- "Olyan lángész vagyok, hogy poroltóval kellene járnom!" -+

Alessandro Molina

unread,
Feb 5, 2013, 5:08:48 PM2/5/13
to sprox, turbo...@groups.google.com
I answered the questions regarding usage of the EasyCrudRestController on the turbogears ML as they are probably better suited there.

Regarding the TG vs Pyramid discussion, both frameworks are constantly improving and covering the parts where they were less strong when born: Pyramid is getting more and more tools for rapid prototyping and TurboGears is getting faster, lighter and can now be used like micro-framework with no clutter around. 

As features can always be implemented with various efforts on both systems it's something quite personal, you should simply choose the framework that better suites they way you naturally tend to organize your code and work.

--

KONTRA, Gergely

unread,
Feb 5, 2013, 5:15:11 PM2/5/13
to sp...@googlegroups.com, turbo...@groups.google.com
On Tue, Feb 5, 2013 at 11:08 PM, Alessandro Molina <alessand...@gmail.com> wrote:
I answered the questions regarding usage of the EasyCrudRestController on the turbogears ML as they are probably better suited there.

I suspect there is a bit of problem with the TG ML. When I hit reply-all, my message returns with an error about turbo...@groups.google.com, however, turbo...@googlegroups.com works.


Thanks for answering.

Gergo

Reply all
Reply to author
Forward
0 new messages