> On Jan 6, 2:41 pm, "Mike Orr" <[email protected]> wrote:
>> On Tue, Jan 6, 2009 at 9:36 AM, Renato Coutinho
>>
>>
>>
>> <[email protected]> wrote:
>>
>> > On Tue, Jan 6, 2009 at 3:20 PM, mk <[email protected]> wrote:
>>
>> >> Hello,
>>
>> >> Suppose I don't want to ship source code (.py files) of finished Pylons
>> >> application and would like to use Pylons with .pycfiles only -- is it
>> >> possible to do that? If I remove .py file from e.g.controllersfolder
>> >> and leave only .pycfile, Pylons say 404.
>> > There was some discussion about it a while ago:
>>
>> >http://groups.google.com/group/pylons-discuss/browse_thread/thread/5a...
>>
>> > Cheers,
>> > Renato Coutinho
>>
>> Besides the philosophical and effectiveness arguments, another problem
>> is fragility.  .pycfiles can be read only by the same major Python
>> version, so if you ship 2.5 files they can't be used with 2.4 or 2.6.
>> This may not be a problem if you're shipping a Python interpreter in
>> the package, but it's one more customer support issue if you expect
>> the user to install it.

On Wed, Jun 24, 2009 at 1:21 PM, Frank<[email protected]> wrote:
> I understand all your arguments, but can someone explain why users
> have a 404 error when the controller is in bytecode only?
>
> Thanks
>

Since you're getting a 404 rather than ImportError, I suspect it's in
the controller scan Routes does.  For some reason I don't understand,
Routes searches your controller directory to gather a list of
controller modules, and refuses to match a route if the controller
doesn't exist.  The regex ends in '\.py$' (in
routes.util.controller_scan()), so that's why .pyc-only modules aren't
found.  I think Routes is trying to be too smart here, because it
could just return the controller name without checking, and let
PylonsApp issue a 404 if the controller doesn't exist.

You can pass a function that returns a list of valid controller names.
    map = routes.Mapper(controller_scan=my_func, ...)
I had to do this in one app that uses Py2exe.

The import itself is in PylonsApp.find_controller(), using __import__().

-- 
Mike Orr <[email protected]>

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

Reply via email to