On 2013-04-29 12:46, Andreas Jung wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
huh? Why should I have one route for two completely different
functionalities and make a decision on the view to call further down
the road?
Does not make sense....
In pyramid you configure one route and then make a difference based on
the predicates in the view_config whats used to render the route.
Thus you can define two or more different views i.e. based on
http-method. I used this for rest APIs already, so a get, put and delete
all are different views on the same route.
Otherwise you could skip the add_route at all and define it in the
view_config. Then it would not makes sense :/
hth Jens
Andreas
Joel Kaiser wrote:
Hi,
I don't know why you are using two different routes for the same
url. You can delete your 'journal_delete_entry_api' and use your
'journal_entry_api' in your delete view.
Joel
2013/4/29 Andreas Jung <[email protected] <mailto:[email protected]>>
Hi there,
running Pyramid 1.4.1 with the following two routes:
config.add_route( 'journal_entry_api',
'/api/user/{username}/journal/{entryid}', factory=UserFactory,
traverse='/{username}/dailyjournal/{entryid}')
config.add_route( 'journal_delete_entry_api',
'/api/user/{username}/journal/{entryid}', factory=UserFactory,
traverse='/{username}/dailyjournal/{entryid}')
The related views are defined as
@view_config(route_name='journal_entry_api', renderer="json",
request_method="GET", permission=VIEW_DAILY_JOURNAL) def
daily_journal_entry_api(self):.....
@view_config(route_name='journal_delete_entry_api',
permission=MANAGE_DAILY_JOURNAL, request_method='DELETE',
renderer='json') def api_delete_blog_entry(self):
Both views are called through the same URL - only the request method
GET vs. DELETE differs...in theory this is supposed to work. But in
real life a GET request to
http://localhost:8080/api/user/my-id/journal/i2uz3i13zi123z1i
leads to a 404 error.
Changing the path configuration of the first route from
'/api/user/{username}/journal/{entryid}'
to let's say
'/api/user/{username}/journal2/{entryid}'
fixes the problem....there must be some problem in the route
configuration resolver for routes having the same path specs... or am
I missing something?
Andreas
-- You received this message because you are subscribed to the
Google Groups "pylons-discuss" group. To unsubscribe from this group
and stop receiving emails from it, send an email to
[email protected]
<mailto:pylons-discuss%[email protected]>. To post to
this group, send email to [email protected]
<mailto:[email protected]>. Visit this group at
http://groups.google.com/group/pylons-discuss?hl=en. For more
options, visit https://groups.google.com/groups/opt_out.
-- You received this message because you are subscribed to the
Google Groups "pylons-discuss" 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/pylons-discuss?hl=en. For more
options, visit https://groups.google.com/groups/opt_out.
- --
ZOPYX Limited | Python | Zope | Plone | MongoDB
Hundskapfklinge 33 | Consulting & Development
D-72074 Tübingen | Electronic Publishing Solutions
www.zopyx.com | Scalable Web Solutions
- --------------------------------------------------
Produce & Publish - www.produce-and-publish.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQGUBAEBAgAGBQJRfk+XAAoJEADcfz7u4AZjITULviNCkc9W9W7SNKsUJhxukzc0
C4/XUY66joGqvBDiFajGoNTSjQmnLcTsze+L4Ce4PBypwd/peJIS+6pd6dXJxZzt
Yu1QaJ3cIqjU5742GkN0/+70M4WZOPjdQ/dqSBUTnx4jkpiT8RmQlYyjPfTQuM2J
umuT00XnPmzh+YlqdLTHVJetBhNJBFd45WwJx8SJBsk4cb2NtdZ0a4ERchxKNtbN
AKNSfhR1dqZ+gDtUIWgcWWt+IVToRB7qqaWDyVPEaDcsaZeenH3nz7Vanun2wE7b
qYR6LADA8DwSrwJzgGBOagSjznFZSxwFjndpuiN+CCVTB7jKswPTlSlMirU7n8Bw
oJBps4AJkXy1jsRUm+jUzpdoGu598kHLadvk2S26Rf//eOrQzEgaMMIEHr/dsbY2
NQXvf8HltBIfsYbgGVqfE+ai8MKmz61mbHyklkswf6GKmTWn/h8nZB5H3t0KZo36
lMetfznrky9noISVbugAe0bnGV7G3Iw=
=0oNo
-----END PGP SIGNATURE-----
--
Klein & Partner KG, member of BlueDynamics Alliance
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.