[Repoze-dev] [issue149] Fix SAWarning messages when using repoze.who.plugins.sa plugins

2010-06-02 Thread Gustavo Narea

Gustavo Narea m...@gustavonarea.net added the comment:

The SQLAlchemy plugin is not tied to ASCII or Unicode, and you can use it 
without 
getting any warning as long as you pass the username/password properly encoded.

I cannot apply that patch because some people use ASCII, and also the right 
place to 
fix this is the repoze.who identifier plugin that you are using, which is not 
giving 
repoze.who the username/password properly.

Are you using a built-in repoze.who identifier plugin? Or is it maintained by a 
3rd party? 

If it's a homegrown identifier, you may want to have a look at the code for 
repoze.who-
friendlyform which gives repoze.who the credentials with the right charset:
http://svn.repoze.org/whoplugins/whofriendlyforms/trunk/repoze/who/plugins/friendlyfor
m.py

Please use the mailing list if you need help to fix the identifier:
http://lists.repoze.org/listinfo/repoze-dev

Cheers.

--
assignedto:  - Gustavo
nosy: +Gustavo
priority: bug - wish
status: unread - resolved
topic: +repoze.who

__
Repoze Bugs b...@bugs.repoze.org
http://bugs.repoze.org/issue149
__
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] [issue149] Fix SAWarning messages when using repoze.who.plugins.sa plugins

2010-06-02 Thread Nuno Teixeira
Olá Gustavo,

Thanks for your fast reply and your suggestions! ;)

That occurs when using repoze.who.plugins.cookie.InsecureCookiePlugin as 
an identifier.

As I can see cookies are stored as ASCII strings so 
cookie.value.decode('base64') (#1 @ line 25) returns an ASCII string 
which is passed to authenticator's authenticate module.

That's why SA is complaining about getting an ASCII string as username. 
Probably I'll override cookie identify method.

#1 - http://svn.repoze.org/repoze.who/trunk/repoze/who/plugins/cookie.py

Cheers,
Nuno

On 06/02/2010 02:56 PM, Gustavo Narea wrote:

 Gustavo Naream...@gustavonarea.net  added the comment:

 The SQLAlchemy plugin is not tied to ASCII or Unicode, and you can use it 
 without
 getting any warning as long as you pass the username/password properly 
 encoded.

 I cannot apply that patch because some people use ASCII, and also the right 
 place to
 fix this is the repoze.who identifier plugin that you are using, which is not 
 giving
 repoze.who the username/password properly.

 Are you using a built-in repoze.who identifier plugin? Or is it maintained by 
 a 3rd party?

 If it's a homegrown identifier, you may want to have a look at the code for 
 repoze.who-
 friendlyform which gives repoze.who the credentials with the right charset:
 http://svn.repoze.org/whoplugins/whofriendlyforms/trunk/repoze/who/plugins/friendlyfor
 m.py

 Please use the mailing list if you need help to fix the identifier:
 http://lists.repoze.org/listinfo/repoze-dev

 Cheers.

 --
 assignedto:  -  Gustavo
 nosy: +Gustavo
 priority: bug -  wish
 status: unread -  resolved
 topic: +repoze.who

 __
 Repoze Bugsb...@bugs.repoze.org
 http://bugs.repoze.org/issue149
 __
 ___
 Repoze-dev mailing list
 Repoze-dev@lists.repoze.org
 http://lists.repoze.org/listinfo/repoze-dev


___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] problem with repoze.bfg.chameleon_genshi

2010-06-02 Thread Chris Withers

Hi All,

I'm attempting to get the attached .genshi template working with 
repoze.bfg.chameleon_genshi.


The problem appears to be the ?python block at the top.

Yes, I know, that code should be in view methods, and that's what I'll 
do as a work around. However, should it work? Works with normal stock 
genshi...


I currently get:

ExpatError: Unable to parse document; no start-tag found.: line 1, column 1

cheers,

Chris

--
Simplistix - Content Management, Batch Processing  Python Consulting
   - http://www.simplistix.co.uk
Title: ${title}






field





numeric
value







___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] problem with repoze.bfg.chameleon_genshi

2010-06-02 Thread Chris McDonough
Told to ChrisW on IRC:

mcdonc ChrisW: i think you're going to need to drop down a level on
the r.b.chameleon_genshi and replicate the problem in terms of raw
chameleon

[11:50] mcdonc i don't know whether it should be possible to have
?python blocks in there or not

[11:50] mcdonc and r.bfg.chameleon_genshi is just a tiny little
wrapper around c.genshi

[11:51] mcdonc usually if you create a patch in terms of the existing
chameleon tests, malthe is happy to take a look at it and pass judgment


On Wed, 2010-06-02 at 16:43 +0100, Chris Withers wrote:
 Hi All,
 
 I'm attempting to get the attached .genshi template working with 
 repoze.bfg.chameleon_genshi.
 
 The problem appears to be the ?python block at the top.
 
 Yes, I know, that code should be in view methods, and that's what I'll 
 do as a work around. However, should it work? Works with normal stock 
 genshi...
 
 I currently get:
 
 ExpatError: Unable to parse document; no start-tag found.: line 1, column 1
 
 cheers,
 
 Chris
 
 HTML document attachment (excel_table.genshi)
field
 numeric
 value
 ___
 Repoze-dev mailing list
 Repoze-dev@lists.repoze.org
 http://lists.repoze.org/listinfo/repoze-dev


___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] does chameleon.genshi support ?python blocks?

2010-06-02 Thread Chris Withers
Chris McDonough wrote:
 mcdonc ChrisW: i think you're going to need to drop down a level on
 the r.b.chameleon_genshi and replicate the problem in terms of raw
 chameleon

I'm actually so far from being a Genshi expert its not funny ;-)

 [11:50] mcdonc i don't know whether it should be possible to have
 ?python blocks in there or not

Malthe, can you comment?

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing  Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] does chameleon.genshi support ?python blocks?

2010-06-02 Thread Chris McDonough
On Wed, 2010-06-02 at 17:02 +0100, Chris Withers wrote:
 Chris McDonough wrote:
  mcdonc ChrisW: i think you're going to need to drop down a level on
  the r.b.chameleon_genshi and replicate the problem in terms of raw
  chameleon
 
 I'm actually so far from being a Genshi expert its not funny ;-)

No need to be an expert.  Read this for tips on how to use the raw
Chameleon interface to render Genshi templates:

http://repoze.org/viewcvs/chameleon/trunk/src/chameleon/genshi/template.txt?rev=8563view=markup

 
  [11:50] mcdonc i don't know whether it should be possible to have
  ?python blocks in there or not
 
 Malthe, can you comment?
 
 cheers,
 
 Chris
 


___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] problems running chameleon tests

2010-06-02 Thread Chris Withers
So, in an effort to create some tests for the chameleon.genshi problems 
I'm having, I thought I'd run the current tests.

On MacOSX this appears to fail for trunk right now.

What am I doing wrong?

Chris

serato:chameleon chris$ svn info
Path: .
URL: http://svn.repoze.org/chameleon/trunk
Repository Root: http://svn.repoze.org
Repository UUID: 8f1d8bf8-68d2-4fbe-a113-2afb08c80ed9
Revision: 9494
Node Kind: directory
Schedule: normal
Last Changed Author: Wichert Akkerman wich...@wiggy.net
Last Changed Rev: 9493
Last Changed Date: 2010-06-02 13:13:34 +0100 (Wed, 02 Jun 2010)

serato:chameleon chris$ nose --version
-bash: nose: command not found
serato:chameleon chris$ ~/virtualenvs/repoze.bfg/bin/nosetests
.F...FFF.F.F..E
==
ERROR: Failure: ImportError (No module named lxml.builder)
--
Traceback (most recent call last):
   File 
/Users/chris/virtualenvs/repoze.bfg/lib/python2.6/site-packages/nose-0.11.3-py2.6.egg/nose/loader.py,
 
line 382, in loadTestsFromName
 addr.filename, addr.module)
   File 
/Users/chris/virtualenvs/repoze.bfg/lib/python2.6/site-packages/nose-0.11.3-py2.6.egg/nose/importer.py,
 
line 39, in importFromPath
 return self.importFromDir(dir_path, fqname)
   File 
/Users/chris/virtualenvs/repoze.bfg/lib/python2.6/site-packages/nose-0.11.3-py2.6.egg/nose/importer.py,
 
line 86, in importFromDir
 mod = load_module(part_fqname, fh, filename, desc)
   File 
/Users/chris/LocalSVN/chameleon/src/chameleon/tests/test_i18nize.py, 
line 3, in module
 from lxml.builder import ElementMaker
ImportError: No module named lxml.builder

==
FAIL: Doctest: template.txt
--
Traceback (most recent call last):
   File 
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/doctest.py, 
line 2152, in runTest
 raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for template.txt
   File 
/Users/chris/LocalSVN/chameleon/src/chameleon/core/template.txt, line 0

--
File /Users/chris/LocalSVN/chameleon/src/chameleon/core/template.txt, 
line 73, in template.txt
Failed example:
 print result
Expected:
 html xmlns=http://www.w3.org/1999/xhtml;
   div xmlns:test=http://test/ns;
 span test:attr=testHello, world!/span
   /div
 /html
Got:
 html xmlns=http://www.w3.org/1999/xhtml;
 BLANKLINE
   div xmlns:test=http://test/ns;
 span test:attr=testHello, world!/span
   /div
 None
 /html


==
FAIL: Doctest: i18n.txt
--
Traceback (most recent call last):
   File 
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/doctest.py, 
line 2152, in runTest
 raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for i18n.txt
   File /Users/chris/LocalSVN/chameleon/src/chameleon/genshi/i18n.txt, 
line 0

--
File /Users/chris/LocalSVN/chameleon/src/chameleon/genshi/i18n.txt, 
line 16, in i18n.txt
Failed example:
 from zope.i18n.simpletranslationdomain import SimpleTranslationDomain
Exception raised:
 Traceback (most recent call last):
   File 
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/doctest.py, 
line 1248, in __run
 compileflags, 1) in test.globs
   File doctest i18n.txt[1], line 1, in module
 from zope.i18n.simpletranslationdomain import 
SimpleTranslationDomain
 ImportError: No module named i18n.simpletranslationdomain
--
File /Users/chris/LocalSVN/chameleon/src/chameleon/genshi/i18n.txt, 
line 17, in i18n.txt
Failed example:
 td = SimpleTranslationDomain(test, {
 (de, test_msgid) : uMock translation of 'test_msgid'.,
 (de, msg_id)  : uMock translation of 'msg_id'.,
 (de, tid): uMock translation of 'tid'.,
 (de, aid): uMock translation of 'aid'.,
 (de, Default): uMock translation of 'Default'.,
 (de, bananas): uMock translation of ${count} bananas.,
 (de, two_bananas): uIch will ${bananas} Bananen und 
${apples} \xc4pfels.,
 (de, month_may)  : uMai,
 (de, reg; lt;) : uGerman reg; lt;,
 (de, The Dutch)  : uDie Hollander,
 (de, missing_id) : umissing_id,
 (nl, size_advise): u${retailer} adviseert u ${size}.,
 (nl, size_advise_suggestion): umaat ${size},
 })
Exception raised:
 Traceback (most recent 

[Repoze-dev] [chameleon bug] py:choose not working

2010-06-02 Thread Chris Withers

Hi All,

With the reference implementation of genshi you can do the following:
 from genshi.template import MarkupTemplate
 tmp = MarkupTemplate(\
... div xmlns=http://www.w3.org/1999/xhtml;
...  xmlns:py=http://genshi.edgewall.org/;
...   py:choose test=
... span py:when=0 == 10/span
... span py:when=1 == 11/span
...   /py:choose
... /div)
 stream = tmp.generate()
 print stream.render('xhtml')
div xmlns=http://www.w3.org/1999/xhtml;
span1/span
/div

The same doesn't work in chameleon.genshi.

The attached patch adds a failing test that demonstrates this.

What tracker should I put this in?

cheers,

Chris

--
Simplistix - Content Management, Batch Processing  Python Consulting
   - http://www.simplistix.co.uk
Index: src/chameleon/genshi/language.txt
===
--- src/chameleon/genshi/language.txt   (revision 9494)
+++ src/chameleon/genshi/language.txt   (working copy)
@@ -113,6 +113,19 @@
 /div
   /div
 
+   print render(\
+  ... div xmlns=http://www.w3.org/1999/xhtml;
+  ...  xmlns:py=http://genshi.edgewall.org/;
+  ...   py:choose test=
+  ... span py:when=0 == 10/span
+  ... span py:when=1 == 11/span
+  ...   /py:choose
+  ... /div)
+  div xmlns=http://www.w3.org/1999/xhtml;
+  span1/span
+  /div
+
+
 py:for
 
print render(\
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] url dispatch, args, matchdicts

2010-06-02 Thread Iain Duncan
Hi bfg folks, one feature I miss from pylons is having elements from the
route parsing be automatically passed to controller methods as named args. I
expect this got some thought and was decided against, I'm curious why? It
seems to me it would be nice if this route:

route
  path=/foo/bar/:baz
  name=foo
  view=.views.foo_view
  view_attr=bar
/

would automatically pass baz in, bypassing the need to look in
reques.matchdict if foo_view had a method like:

def bar(self, baz):

Thoughts?

thanks
iain
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] [chameleon bug] ?python not working

2010-06-02 Thread Chris Withers

Hi All,

With the reference implementation of genshi you can do the following:

 from genshi.template import MarkupTemplate
 tmp = MarkupTemplate(\
... ?python
...   title = A Genshi Template
... ?
... html xmlns:py=http://genshi.edgewall.org/;
...   head
... title py:content=titleThis is replaced./title
...   /head
... /html
... )
 stream = tmp.generate()
 print stream.render('xhtml')
html
  head
titleA Genshi Template/title
  /head
/html

The same doesn't work in chameleon.genshi.

The attached patch adds a failing test that demonstrates this.

What tracker should I put this in?

cheers,

Chris

--
Simplistix - Content Management, Batch Processing  Python Consulting
- http://www.simplistix.co.uk
Index: src/chameleon/genshi/language.txt
===
--- src/chameleon/genshi/language.txt   (revision 9494)
+++ src/chameleon/genshi/language.txt   (working copy)
@@ -13,6 +13,23 @@
   ... result = func(**kwargs)
   ... return mt.process(result)
 
+?python
+
+   print render(\
+  ... ?python
+  ...   title = A Genshi Template
+  ... ?
+  ... html xmlns:py=http://genshi.edgewall.org/;
+  ...   head
+  ... title py:content=titleThis is replaced./title
+  ...   /head
+  ... /html)
+  html
+head
+  titleA Genshi Template/title
+/head
+  /html
+
 py:if
 
print render(\
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] [chameleon bug] ?python not working

2010-06-02 Thread Wichert Akkerman
On 2010-6-2 20:38, Chris Withers wrote:
 What tracker should I put this in?

Please see http://chameleon.repoze.org/docs/latest/ which documents this.

Wichert.
-- 
Wichert Akkerman wich...@wiggy.net   It is simple to make things.
http://www.wiggy.net/  It is hard to make things simple.
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] url dispatch, args, matchdicts

2010-06-02 Thread Iain Duncan

 Iain Duncan wrote:
  Hi bfg folks, one feature I miss from pylons is having elements from the
  route parsing be automatically passed to controller methods as named
 args. I
  expect this got some thought and was decided against, I'm curious why? It
  seems to me it would be nice if this route:
 
  route
path=/foo/bar/:baz
name=foo
view=.views.foo_view
view_attr=bar
  /
 
  would automatically pass baz in, bypassing the need to look in
  reques.matchdict if foo_view had a method like:
 
  def bar(self, baz):
 
  Thoughts?

 I doubt we will add that as the default behavior -- we are hoping to
 keep the calling convention completely uniform by default.  However, it
 should be trivial to write a decorator which you can use to adapt the two.



Hmm, what about adding another optional param to route tags? something like
use_global_views, but as a flag for the passing  in named args
automatically? I would think a lot of people coming to bfg from other
frameworks and using it as a micro-framework would really like that. Or am I
the only one? ;-)

iain
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] url dispatch, args, matchdicts

2010-06-02 Thread Wichert Akkerman
On 2010-6-2 21:48, Iain Duncan wrote:
 Hmm, what about adding another optional param to route tags? something
 like use_global_views, but as a flag for the passing  in named args
 automatically? I would think a lot of people coming to bfg from other
 frameworks and using it as a micro-framework would really like that. Or
 am I the only one? ;-)

I suspect you are :). I came from Pylons and have not missed that 
feature in BFG.

Wichert.


-- 
Wichert Akkerman wich...@wiggy.net   It is simple to make things.
http://www.wiggy.net/  It is hard to make things simple.
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] [chameleon bug] ?python not working

2010-06-02 Thread Chris Withers
Wichert Akkerman wrote:
 On 2010-6-2 20:38, Chris Withers wrote:
 What tracker should I put this in?
 
 Please see http://chameleon.repoze.org/docs/latest/ which documents this.

Documents what? I see no reference to ?python or its lack.

On the off chance you meant a bug tracker, I'll post both of these bugs 
there.

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing  Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] [chameleon bug] bugtracker url wrong in docs.

2010-06-02 Thread Chris Withers
Chris Withers wrote:
 On the off chance you meant a bug tracker, I'll post both of these bugs 
 there.

And the docs for the bug tracker are wrong...

https://code.launchpad.net/chameleon is a ruby-based blogging project...

Chris

-- 
Simplistix - Content Management, Batch Processing  Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] url dispatch, args, matchdicts

2010-06-02 Thread Iain Duncan


  Hmm, what about adding another optional param to route tags? something
 like
  use_global_views, but as a flag for the passing  in named args
  automatically? I would think a lot of people coming to bfg from other
  frameworks and using it as a micro-framework would really like that. Or
 am I
  the only one? ;-)

 Pylons is actually supposed to be moving to the consensus
 (request-only) calling convention.


Ok, well I'm all for inter-framework interoperability and code sharing so
nix that then, request it is. =)

Thanks for pointing that out.
Iain
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] [chameleon bug] bugtracker url wrong in docs.

2010-06-02 Thread Wichert Akkerman
On 2010-6-2 23:02, Chris Withers wrote:
 Chris Withers wrote:
 On the off chance you meant a bug tracker, I'll post both of these
 bugs there.

 And the docs for the bug tracker are wrong...

 https://code.launchpad.net/chameleon is a ruby-based blogging project...

A 5 second search on launchpad would have pointed you to 
https://bugs.launchpad.net/chameleon-template-engine . I'll fix the link 
in svn.

Wichert.


-- 
Wichert Akkerman wich...@wiggy.net   It is simple to make things.
http://www.wiggy.net/  It is hard to make things simple.
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] [chameleon bug] bugtracker url wrong in docs.

2010-06-02 Thread Chris Withers
Wichert Akkerman wrote:
 On 2010-6-2 23:02, Chris Withers wrote:
 Chris Withers wrote:
 On the off chance you meant a bug tracker, I'll post both of these
 bugs there.

 And the docs for the bug tracker are wrong...

 https://code.launchpad.net/chameleon is a ruby-based blogging project...
 
 A 5 second search on launchpad would have pointed you to 
 https://bugs.launchpad.net/chameleon-template-engine . 

First hit for me was:

https://launchpad.net/chameleon.genshi

Is that related? A fork? Something else?

Chris

-- 
Simplistix - Content Management, Batch Processing  Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] routing exception when run as wsgi application

2010-06-02 Thread Yuan HOng
 You can use pdb with mod_wsgi. Read:

 http://code.google.com/p/modwsgi/wiki/DebuggingTechniques

 You also find in there how to use EvalException from Paste to do in
 browser debugging.

 Graham

Thanks Graham for the tip. Now I found out what's wrong.

When the application is run under Apache, the request header doesn't
contain the 'Content-Type' header while under Paste, it is filled with
an empty string when absent. So under Apache, the code snippet in
configuration.py:

 def header_predicate(context, request):
if header_val is None:
return header_name in request.headers
val = request.headers.get(header_name)
return header_val.match(val) is not None

will throw an except since val is None.

Changing the line to:

val = request.headers.get(header_name, '')

fixes the problem.

--
Hong Yuan

大管家网上建材超市
装修装潢建材一站式购物
http://www.homemaster.cn
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev