https urls with pyramid

2011-03-16 Thread Eric Rasmussen
Hello,

I'm running an https only app and noticed that all the generated links are
http, resulting in 404 errors. I found that I was able to change the scheme
on the __init__ method of the handler, like this:

class MainHandler(object):
def __init__(self, request):
request.scheme = 'https'
self.request = request

It works (all the links generated with route_url() or url() now start with
https), but I feel like I'm missing a config setting or a better solution.
What is the recommended way to do this?

Thanks!
Eric

-- 
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: Akhet status (Pyramid newbies and Carlos d.l.G., read me)

2011-03-16 Thread Mike Orr
Tonight or tomorrow. I was hoping to get it done last night but the
docs need more organization.

Also, can you host the WebHelpers docs? It's going to need an update
too and it would make sense to put them all together.

On Wed, Mar 16, 2011 at 1:08 PM, Carlos de la Guardia
 wrote:
> Mike,
>
> do you have a planned date for the first release of Akhet? We have
> been working on the landing page for Pyramid docs and I think it would
> make a lot of sense to mention it there.
>
> Carlos de la Guardia
>
> On Mon, Mar 14, 2011 at 10:31 PM, Mike Orr  wrote:
>> I'm on IRC now for the next couple hours at least. I'll be on tomorrow
>> too but I'm on Pacific time so from Atlanta's perspective it'll be
>> from noon till late evening.
>>
>> On Mon, Mar 14, 2011 at 6:50 PM, Jonathan Vanasco  
>> wrote:
>>> when is a good time for us to connect on aim/irc/etc and plan some
>>> integration stuff out ?
>>
>>
>> --
>> Mike Orr 
>>
>> --
>> 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.
>>
>>
>
> --
> 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.
>
>



-- 
Mike Orr 

-- 
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: Pyramid routing questions

2011-03-16 Thread Michael Merickel
The pyramid form of url dispatch is very explicit - you make a specific
route and assign a view to handle that based on properties of the request.
In order to make the "magic" routing based on ``action``, the simple way is
to just use the pyramid_handlers package which provides a very similar
behavior to the original pylons controllers.

http://docs.pylonsproject.org/projects/pyramid_handlers/dev/

Michael


On Wed, Mar 16, 2011 at 5:03 AM, brutka  wrote:

> Hello!
> I am learning Pyramid after a few project on Pylons.
> Cannot get the Pyramid routing (I am not using traversing).
>
> Questions.
>
> 1. In Pylons it was usefull to set controller explicit, and have the
> action dynamic (as part of Url matching).
> Can I do somehting like that in Pyramid? Or I have to specify routes
> for ALL Views? (for all actions in Pylons terms)
>
> 2. I am using language code as part of URL.
> ex, /pagename - for default language
> /en/pagename - for english
> /fr/pagename - for french, etc...
>
> I order to use same routes for all languages I inherited from Mapper,
> overloaded match and routematch methods (I detect if language is
> present in URL, save it, then remove it from URL, and then run
> original match and routmatch code).
> How can I do something like that in Pyramid?
>
> --
> 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.
>
>

-- 
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.



about unit test on auth fail

2011-03-16 Thread Shen, Yu-Teh
Hello all.

After I read this
http://docs.pylonsproject.org/projects/pyramid/1.0/narr/testing.html#using-the-configurator-and-pyramid-testing-apis-in-unit-tests
.

I try to unit test my auth policy, and my unit test about auth is
still fail (Forbidden not raised).

But I can get forbidden view when user is not login on the browser.

Is anyone who can tell me what I miss?

Thanks a lot!

This is the ACL.
__acl__ = [(Allow, Everyone, 'view'), (Allow, Authenticated, 'auth')]

==

--
Traceback (most recent call last):
  File "/home/ytshen/proj/tests.py", line 104, in
test_upload_forbidden
self.assertRaises(Forbidden, upload, context, request)
AssertionError: Forbidden not raised


The following is my unit test code:
=

def test_upload_forbidden(self):
from pyramid.exceptions import Forbidden
from views import upload
from pyramid_beaker import set_cache_regions_from_settings

settings = set_cache_settings()
set_cache_regions_from_settings(settings)
self.config.testing_securitypolicy(permissive=False)
request = testing.DummyRequest()
context = testing.DummyResource()
self.assertRaises(Forbidden, upload, context, request)

This is view
=
@view_config(context=proj.models.Root', name='upload',
 renderer='proj:templates/upload.pt',
 permission='auth')
@cache_region('default_term')
def upload(context, request):
headerTPL = get_renderer('templates/header.pt').implementation()
footerTPL = get_renderer('templates/footer.pt').implementation()
session = request.session
logged_in = authenticated_userid(request)

return dict(
headerTPL = headerTPL,
footerTPL = footerTPL,
session = session,
logged_in = logged_in,
url = request.application_url + '/upload'
)

def forbidden_view(request):
headerTPL = get_renderer('templates/header.pt').implementation()
footerTPL = get_renderer('templates/footer.pt').implementation()
message = 'Please login for this function'
return dict(
headerTPL = headerTPL,
footerTPL = footerTPL,
message = message,
username = '',
url = request.application_url + '/signin'
)

-- 
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: Pyramid + OWL > SMW

2011-03-16 Thread Eric Ongerth
Interesting, the system seems to have lost my reply sent yesterday.
Did I 'reply to author' by mistake?

I wanted to signal great interest in this topic, and potentially some
willingness to participate and help out.  However, I am currently (and
probably for the next year, roughly) deeply engaged in a work project
where I'm developing a semantically related database on a smaller
scale that doesn't tackle the problem at the level of a full triple
store or OWL-type stuff.  Quite likely this will be the background
experience where I learn everything the hard way and directly see the
need for and usefulness of a broader semantic framework in ways that I
could not have seen by merely considering it intellectually.  In any
case, about a year from now perhaps I'll be able to chip in.

-- Eric


On Mar 13, 8:18 am, BrianTheLion  wrote:
> All,
>
> I am interested in building -- or at least having a discussion about
> building -- a Semantic Mediawiki (SMW) alternative. I've worked with
> SMW quite a bit and find its features lacking and its implementation
> largely impenetrable. The goal would be to build a wiki in Pyramid
> that could be used to author ontologies in OWL on top of supported
> triple stores. At present there are scarce few projects that fill this
> niche and I feel that the contribution would be timely.
>
> In getting started, I'm looking for a few things from the Pylons
> community:
> 1) Feedback - Is this a good idea?
> 2) Technical direction - In particular, the Python/OWL
> interoperability problem is not solved IMHO. If there are people on
> this list that are actively thinking about it, could you please make
> yourself known?
> 3) Contributors - Of course it would be great to have help writing the
> code, but interested parties need do little more than contribute ideas
> to be of value. I'll probably set up a project-specific mailing list
> if the concept has wings.
>
> Thanks for your consideration!
> ~br

-- 
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: Akhet status (Pyramid newbies and Carlos d.l.G., read me)

2011-03-16 Thread Carlos de la Guardia
Mike,

do you have a planned date for the first release of Akhet? We have
been working on the landing page for Pyramid docs and I think it would
make a lot of sense to mention it there.

Carlos de la Guardia

On Mon, Mar 14, 2011 at 10:31 PM, Mike Orr  wrote:
> I'm on IRC now for the next couple hours at least. I'll be on tomorrow
> too but I'm on Pacific time so from Atlanta's perspective it'll be
> from noon till late evening.
>
> On Mon, Mar 14, 2011 at 6:50 PM, Jonathan Vanasco  
> wrote:
>> when is a good time for us to connect on aim/irc/etc and plan some
>> integration stuff out ?
>
>
> --
> Mike Orr 
>
> --
> 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.
>
>

-- 
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.



Pyramid port...

2011-03-16 Thread Parnell Springmeyer
Over the last two weeks I've completed a Pyramid app that hosts a legacy
Pylons app using the NotFound method and have fully integrated the
login/session management to provide a seamless experience for the
users. A bit of a learning curve, but it is clear and elegant.

Traversal took quite a bit of experimentation and bugging the guys on
IRC but it is /amazing/ I really like traversal a lot - using resources
(you can use them for routes, too) allows me to divide the view logic up
into more manageable chunks (resource interfaces! less duplication!
zomg) which is really nice.

Working with Pyramid, it feels "lighter" but with the 1.0 release it
feels like a beautiful marriage between repoze.bfg and the Pylons
philosophies. I really want to congratulate everyone that participated
on the truly epic push of merging two projects!

The rebranding (website, docs, design, etc) is impressive, attractive,
and modern - it really speaks to the quality of the Pylons software
ecosystem.

The docs: there was a thread a little while ago about the docs being too
abstract in some areas (don't remember by who thought). To throw in my
two cents: for the first six days they were difficult to wrap my head
around (particularly traversal, if I remember that was the last poster's
point of contention too) but a lot of experimentation, IRC chats, and
/digging through the source code/ (and the source code of pyramid_sqla,
and some other people's projects) I grok'ed it all in a very gradual and
subtle manner.

Traversal is much more straight forward than it sounds in the abstract
and is conceptually very strong. As the project progresses, I would say
this: don't change the docs (they are perfect, IMHO) but having a
(cliche I know) concrete and basic "blog in 20 minutes" application up
for new comers to look at and learn from would be invaluable.

Not every new comer is going to dig through pyramid.traversal and the
Configurator to figure out how traversal and view location operates.

Not sure if this email sounds like pandering but I /really really/ like
the direction this project has gone. When I heard the news that the
merge was happening I thought to myself, "Well, this will either be
really awesome, or the beginning of the end." I'm so happy to say that
it is not only awesome but the evolution of it has been so clear and
deliberate that I'm really looking forward to the future with this
community!

-- 
Parnell "ixmatus" Springmeyer (http://ixmat.us)

-- 
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.



Pyramid routing questions

2011-03-16 Thread brutka
Hello!
I am learning Pyramid after a few project on Pylons.
Cannot get the Pyramid routing (I am not using traversing).

Questions.

1. In Pylons it was usefull to set controller explicit, and have the
action dynamic (as part of Url matching).
Can I do somehting like that in Pyramid? Or I have to specify routes
for ALL Views? (for all actions in Pylons terms)

2. I am using language code as part of URL.
ex, /pagename - for default language
/en/pagename - for english
/fr/pagename - for french, etc...

I order to use same routes for all languages I inherited from Mapper,
overloaded match and routematch methods (I detect if language is
present in URL, save it, then remove it from URL, and then run
original match and routmatch code).
How can I do something like that in Pyramid?

-- 
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: Pyramid + OWL > SMW

2011-03-16 Thread Parnell Springmeyer
Brian,

In a previous (Pylons) application I built an RDF based ACL system and
got started on an FOAF+SSL login setup. I know it's a bit left-field to
the discussion because you are talking about authoring ontologies but
that experience has led me to the conclusion that Python RDF and OWL
tools have been stagnating...

Redland bindings haven't been updated for python binaries beyond 2.3 (if
I remember, or it was 2.4) and native python RDF libraries have /some/
features but aren't feature complete and/or are buggy.

I think before a serious semantic web project can be undertaken, the
tools need to be caught up a bit. It's one of my goals to start on that
by patching up the redland bindings (why duplicate functionality?) and
fleshing out the feature set with a wrapper on-top. I really liked the
intentions of the RDFAlchemy project too.

Just some thoughts.

> All,
>
> I am interested in building -- or at least having a discussion about
> building -- a Semantic Mediawiki (SMW) alternative. I've worked with
> SMW quite a bit and find its features lacking and its implementation
> largely impenetrable. The goal would be to build a wiki in Pyramid
> that could be used to author ontologies in OWL on top of supported
> triple stores. At present there are scarce few projects that fill this
> niche and I feel that the contribution would be timely.
>
> In getting started, I'm looking for a few things from the Pylons
> community:
> 1) Feedback - Is this a good idea?
> 2) Technical direction - In particular, the Python/OWL
> interoperability problem is not solved IMHO. If there are people on
> this list that are actively thinking about it, could you please make
> yourself known?
> 3) Contributors - Of course it would be great to have help writing the
> code, but interested parties need do little more than contribute ideas
> to be of value. I'll probably set up a project-specific mailing list
> if the concept has wings.
>
> Thanks for your consideration!
> ~br

-- 
Parnell "ixmatus" Springmeyer (http://ixmat.us)

-- 
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.



Localizing pylons app - multiple translation domain merging

2011-03-16 Thread Cezary Statkiewicz
 Hello!

 I have a problem localizing pylons application that uses external
python modules, that, among other things, returns localized text to
app, which is displayed to user. Both uses gettext translation engine.
The problem is, that pylons app has separate translation settings than
the localized app, and each request can utilize different language for
translation. I'm wondering how to set up translation domains merging
(babel provides such functionality in a subclass of
gettext.GNUTranslations), so all the translated texts will be
available from pylons i18n infrastructure. I was thinking about
monkeypatching pylons.i18n.set_lang, but maybe there is a better,
prettier way you know?

 Best regards,

 Cezary Statkiewicz

-- 
Cezary Statkiewicz - ce...@thelirium.net
         jabber://ce...@jabber.org
             http://thelirium.net

-- 
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.