Re: drupal 'routing'

2009-08-17 Thread cropr

I am writing a small CMS in pylons.

Below you can find a snippet of my routing.py

map.connect('content', '/cmsprefix/{mode}/{lang}/*url_obj',
controller='rdc', action='execute', mode='view', lang='nl')
map.connect( '/cmsprefix/{mode}/{lang}/', controller='rdc',
mode='view', action='execute', lang='nl', url_obj='')
map.connect('/cmsprefix/', controller='rdc', mode='view',
lang='nl',
action='execute', url_obj='home')

cmsprefix identifies the cms part ofd the webapplication
rdc is the name of the controller that handles all content related
urls
mode defines wether the user is in view mode or in edit
lang defines the language, the site being multilingual
url_obj is mapped to the object in the content hierarchy and looks
like
/rootobject/child/child/.../child/objectAction?params

the rdc controller strats like this

class RdcController(BaseController):
def execute(self, url_obj, mode, lang):


in the rdc controller I am parsing url_obj to get the right
objectAction on the right
object in the content hierarchy

Hope this might give you an idea

Ruben

On Aug 17, 12:38 am, mickgardner mickgard...@gmail.com wrote:
 Thanks Ben, and Mike, for your replies.  I like the idea of using
 routes, mainly because its more familiar and middleware is a bit of a
 black box to me still.
 I think at this point i'll set up a test and see if i can get it
 working then come back here if I have any problems.  You've given me
 enough to go on, which is great.

 Thanks guys.

 Michael

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



'_fileobject' object has no attribute 'seek'

2009-08-17 Thread Jinal Jhaveri

Has anyone seen this error before?


Error - type 'exceptions.AttributeError': '_fileobject' object has
no attribute 'seek'
URL: http://xx.xxx.xxx.x/images/receive_upload
File '/usr/lib/python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/
exceptions/errormiddleware.py', line 137 in __call__
 app_iter = self.application(environ, start_response)
File '/usr/lib/python2.5/site-packages/Pylons-0.9.6.2-py2.5.egg/pylons/
wsgiapp.py', line 314 in __call__
 return self.app(environ, start_response)
File '/usr/lib/python2.5/site-packages/Routes-1.10.1-py2.5.egg/routes/
middleware.py', line 62 in __call__
 elif is_form_post(environ) and '_method' in req.POST:
File '/usr/lib/python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/
wsgiwrappers.py', line 213 in POST
 params = self._POST()
File '/usr/lib/python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/
wsgiwrappers.py', line 195 in _POST
 return parse_formvars(self.environ, include_get_vars=False)
File '/usr/lib/python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/
request.py', line 174 in parse_formvars
 keep_blank_values=1)
File '/usr/lib64/python2.5/cgi.py', line 534 in __init__
 self.read_multi(environ, keep_blank_values, strict_parsing)
File '/usr/lib64/python2.5/cgi.py', line 657 in read_multi
 headers = rfc822.Message(self.fp)
File '/usr/lib64/python2.5/rfc822.py', line 104 in __init__
 self.readheaders()
File '/usr/lib64/python2.5/rfc822.py', line 188 in readheaders
 self.fp.seek(startofline)
File '/usr/lib/python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/
httpserver.py', line 481 in seek
 self.file.seek(place)
AttributeError: '_fileobject' object has no attribute 'seek'

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: '_fileobject' object has no attribute 'seek'

2009-08-17 Thread Philip Jenvey


On Aug 17, 2009, at 10:40 AM, Jinal Jhaveri wrote:


 File '/usr/lib64/python2.5/rfc822.py', line 188 in readheaders
 self.fp.seek(startofline)
 File '/usr/lib/python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/
 httpserver.py', line 481 in seek
 self.file.seek(place)
 AttributeError: '_fileobject' object has no attribute 'seek'

The latest version of Paste has a fix relating to this httpserver seek  
method which might solve this.

--
Philip Jenvey


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: '_fileobject' object has no attribute 'seek'

2009-08-17 Thread Jinal Jhaveri

Thanks Philip,

I updated it to 1.7.2 and haven't seen the error yet, so hopefully
this is fixed.

On Aug 17, 11:26 am, Philip Jenvey pjen...@underboss.org wrote:
 On Aug 17, 2009, at 10:40 AM, Jinal Jhaveri wrote:



  File '/usr/lib64/python2.5/rfc822.py', line 188 in readheaders
  self.fp.seek(startofline)
  File '/usr/lib/python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/
  httpserver.py', line 481 in seek
  self.file.seek(place)
  AttributeError: '_fileobject' object has no attribute 'seek'

 The latest version of Paste has a fix relating to this httpserver seek  
 method which might solve this.

 --
 Philip Jenvey
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



IOError: Request body truncated

2009-08-17 Thread Jinal Jhaveri

Has anyone seen this? I did some search and seems like it is an opera
+wsgi issue. Has anyone tried fixing it for paste 1.7.2?



Traceback (most recent call last):
 File /usr/lib/python2.5/site-packages/Paste-1.7.2-py2.5.egg/paste/
httpserver.py, line 1062, in process_request_in_thread
   self.finish_request(request, client_address)
 File /usr/lib64/python2.5/SocketServer.py, line 254, in
finish_request
   self.RequestHandlerClass(request, client_address, self)
 File /usr/lib64/python2.5/SocketServer.py, line 522, in __init__
   self.handle()
 File /usr/lib/python2.5/site-packages/Paste-1.7.2-py2.5.egg/paste/
httpserver.py, line 436, in handle
   BaseHTTPRequestHandler.handle(self)
 File /usr/lib64/python2.5/BaseHTTPServer.py, line 316, in handle
   self.handle_one_request()
 File /usr/lib/python2.5/site-packages/Paste-1.7.2-py2.5.egg/paste/
httpserver.py, line 431, in handle_one_request
   self.wsgi_execute()
 File /usr/lib/python2.5/site-packages/Paste-1.7.2-py2.5.egg/paste/
httpserver.py, line 287, in wsgi_execute
   self.wsgi_start_response)
 File /usr/lib/python2.5/site-packages/Paste-1.7.2-py2.5.egg/paste/
urlmap.py, line 202, in __call__
   return app(environ, start_response)
 File /usr/lib/python2.5/site-packages/Paste-1.7.2-py2.5.egg/paste/
cascade.py, line 102, in __call__
   raise IOError(Request body truncated)
IOError: Request body truncated
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Adding Pylons 0.9.7 breaks 0.9.6 projects

2009-08-17 Thread kochhar

Jorge Vargas wrote:
 On Fri, Aug 14, 2009 at 7:50 PM, kochharkochhar...@gmail.com wrote:
 I have a package repository which contains packages for pylons 0.9.6.1 After
 adding pylons 0.9.7 and it's dependent packages, my 0.9.6.1 projects stopped
 working.

 It seems bad practice for pylons to specify it's dependencies in the
 FooPackage=x.y.z format; it's too easy to break something. Is there a way
 around this so I don't need to create separate package repositories for 
 0.9.6.1
 and 0.9.7
 
 I don't see this as bad format as a newer version is (in general a
 better less buggy version) 

Except when the new versions are not backwards compatible and break existing 
applications. Most libraries don't preserve backwards compatability 
indefinitely. It's fine practice to follow the latest and greatest in 
development but release version specify explicit dependencies to be stable in 
the face of changes.

 that said they are two ways of fixing this.
 1- releasing 0.9.6.2 with a setup.py that excludes the new incompatible 
 versions
 
 Of course #1 is best so I suggest you confirm which versions are
 broken and propose a patch.

Yes, I'm working on a patch. Binary searching through package dependency 
versions isn't much fun.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Adding Pylons 0.9.7 breaks 0.9.6 projects

2009-08-17 Thread Mike Orr

On Mon, Aug 17, 2009 at 4:56 PM, kochharkochhar...@gmail.com wrote:

 Jorge Vargas wrote:
 On Fri, Aug 14, 2009 at 7:50 PM, kochharkochhar...@gmail.com wrote:
 I have a package repository which contains packages for pylons 0.9.6.1 After
 adding pylons 0.9.7 and it's dependent packages, my 0.9.6.1 projects stopped
 working.

 It seems bad practice for pylons to specify it's dependencies in the
 FooPackage=x.y.z format; it's too easy to break something. Is there a way
 around this so I don't need to create separate package repositories for 
 0.9.6.1
 and 0.9.7

 I don't see this as bad format as a newer version is (in general a
 better less buggy version)

 Except when the new versions are not backwards compatible and break existing
 applications. Most libraries don't preserve backwards compatability
 indefinitely. It's fine practice to follow the latest and greatest in
 development but release version specify explicit dependencies to be stable in
 the face of changes.

Then you end up with the opposite problem: people can't install a
newer version of a library that may have bugfixes or new features they
want or need.

It's reasonable to restrict an old version of something (Pylon 0.9.6)
when an incompatibility is known.  But setting closed requirements for
everything just makes it harder to use a later version if it is
compatible.  And compatibility may be different in different cases.
Something may be compatible for new applications but not for existing
applications.  In that case it's not right to prevent everybody from
using it just because it's incompatible for some people.  People can
adjust their application's setup.py if they want to stick to a
particular version or avoid a known-bad series.  It's easy to make
your setup.py more restrictive than Pylons'.  It's impossible to make
yours less restrictive without modifying Pylons' setup.py, which means
it can't be easy_installed without manual intervention.

-- 
Mike Orr sluggos...@gmail.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---