[Repoze-dev] flashing messages with bfg

2009-07-08 Thread Iain Duncan
Hey folks, wondering what the conventional way of flashing a message
after a model update when using HTTPFound for redirects. Is this
something that people roll-their-own for, or is there a standard to
follow? I'd like to make sure my crud app is as bfg'ish as possible so
it can be useful to others.

Thanks
Iain

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


Re: [Repoze-dev] flashing messages with bfg

2009-07-08 Thread Iain Duncan
On Wed, 2009-07-08 at 02:36 -0400, Chris McDonough wrote:
 We don't have a convention for flash.  I've been remiss in seeing how the 
 other frameworks implement this, but I *think* something like this would be 
 closest:
 
 return render_template_to_response('some/template.pt', message='Updated')
 
 And in the template:
 
 div class=someclass${message}/div

Thanks Chris. The convention in the other frameworks that I've used is
that the message is 'flashed' when handling the update from a post, and
displayed after the redirect, to avoid the problem when a user hits
resend after a post that should not occur twice. So usually the flash
helper is a simple utility to set, read, and wipe a session variable or
cookie. I guess bfg is not making any assumptions about session vars or
cookies though?

If you are thinking of adding such a thing to bfg, I'll hold off on my
own ( or use a really crappy one ). Can we set a simple cookie with
webob maybe as an ultralight version that doesn't depend on a particular
method of storing session vars?  

thanks
iain


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


Re: [Repoze-dev] flashing messages with bfg

2009-07-08 Thread Chris McDonough
On 7/8/09 2:54 AM, Iain Duncan wrote:
 On Wed, 2009-07-08 at 02:36 -0400, Chris McDonough wrote:
 We don't have a convention for flash.  I've been remiss in seeing how the
 other frameworks implement this, but I *think* something like this would be 
 closest:

 return render_template_to_response('some/template.pt', message='Updated')

 And in the template:

 div class=someclass${message}/div

 Thanks Chris. The convention in the other frameworks that I've used is
 that the message is 'flashed' when handling the update from a post, and
 displayed after the redirect, to avoid the problem when a user hits
 resend after a post that should not occur twice. So usually the flash
 helper is a simple utility to set, read, and wipe a session variable or
 cookie. I guess bfg is not making any assumptions about session vars or
 cookies though?

Since BFG depends on no particular persistence mechanism, BFG has no built-in 
session support, although I often use this pair of packages to get it:

http://pypi.python.org/pypi/repoze.browserid/0.1
http://pypi.python.org/pypi/repoze.session/0.2

Of course any sessioning system would work just as well (ala Beaker).

 If you are thinking of adding such a thing to bfg, I'll hold off on my
 own ( or use a really crappy one ).

No, I'm not.

 Can we set a simple cookie with
 webob maybe as an ultralight version that doesn't depend on a particular
 method of storing session vars?

Sure, although I'm not sure that requires any particular API support from BFG.

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


[Repoze-dev] Getting Started with repoze.bfg - installing repoze.shootout, lxml errors

2009-07-08 Thread david bain
I stuck at installing repoze.shootout.
using python2.4, virtualenv --no-site-packages, and ubuntu with
build-essentials.

I went through the repoze documentation and getting started was pretty
manageable.

then I tried to install a sample application. I checked out repoze.shootout
and discovered there were a few gaps regarding information on installing an
application. I took the following approach with repoze.shootout.

1. get dev packages for sqlite3 (sudo apt-get install libsqlite3-dev)
2.  use virtualenv --no-site-packages and python2.4
3.  use bin/python setup.py develop

Running bin/python setup.py develop with my virtualenv activated gave me
this traceback (looks like an lxml issue, but I'm not sure how best to fix
it):

 snip ...
erDictionaryContext’ has no member named ‘pushImpliedContextFromParser’
src/lxml/lxml.etree.c:143945: error: ‘struct
__pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext’ has no member named
‘pushImpliedContext’
src/lxml/lxml.etree.c:143946: error: ‘struct
__pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext’ has no member named
‘popImpliedContext’
src/lxml/lxml.etree.c:143960: error: ‘struct
__pyx_vtabstruct_4lxml_5etree__FileReaderContext’ has no member named
‘_createParserInputBuffer’
src/lxml/lxml.etree.c:143960: error:
‘__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInputBuffer’
undeclared (first use in this function)
src/lxml/lxml.etree.c:143961: error: ‘struct
__pyx_vtabstruct_4lxml_5etree__FileReaderContext’ has no member named
‘_createParserInput’
src/lxml/lxml.etree.c:143961: error:
‘__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInput’ undeclared
(first use in this function)
src/lxml/lxml.etree.c:143962: error: ‘struct
__pyx_vtabstruct_4lxml_5etree__FileReaderContext’ has no member named
‘_readDtd’
src/lxml/lxml.etree.c:143962: error:
‘__pyx_f_4lxml_5etree_18_FileReaderContext__readDtd’ undeclared (first use
in this function)
src/lxml/lxml.etree.c:143963: error: ‘struct
__pyx_vtabstruct_4lxml_5etree__FileReaderContext’ has no member named
‘_readDoc’
src/lxml/lxml.etree.c:143963: error:
‘__pyx_f_4lxml_5etree_18_FileReaderContext__readDoc’ undeclared (first use
in this function)
src/lxml/lxml.etree.c:143964: error: ‘struct
__pyx_vtabstruct_4lxml_5etree__FileReaderContext’ has no member named
‘copyToBuffer’
src/lxml/lxml.etree.c:144068: error: ‘struct
__pyx_vtabstruct_4lxml_5etree__FilelikeWriter’ has no member named
‘_createOutputBuffer’
src/lxml/lxml.etree.c:144068: error:
‘__pyx_f_4lxml_5etree_15_FilelikeWriter__createOutputBuffer’ undeclared
(first use in this function)
src/lxml/lxml.etree.c:144069: error: ‘struct
__pyx_vtabstruct_4lxml_5etree__FilelikeWriter’ has no member named ‘write’
src/lxml/lxml.etree.c:144070: error: ‘struct
__pyx_vtabstruct_4lxml_5etree__FilelikeWriter’ has no member named ‘close’
src/lxml/lxml.etree.c:144338: error: ‘struct
__pyx_vtabstruct_4lxml_5etree_XSLT’ has no member named ‘_run_transform’
src/lxml/lxml.etree.c:144338: error:
‘__pyx_f_4lxml_5etree_4XSLT__run_transform’ undeclared (first use in this
function)
src/lxml/lxml.etree.c:145283: error: ‘xmlParserVersion’ undeclared (first
use in this function)
src/lxml/lxml.etree.c:145472: error: ‘LIBXML_VERSION’ undeclared (first use
in this function)
src/lxml/lxml.etree.c:146381: error:
‘__pyx_v_4lxml_5etree___DEFAULT_ENTITY_LOADER’ undeclared (first use in this
function)
src/lxml/lxml.etree.c:146390: error: ‘__pyx_f_4lxml_5etree__local_resolver’
undeclared (first use in this function)
src/lxml/lxml.etree.c:146399: error: ‘XML_PARSE_NOENT’ undeclared (first use
in this function)
src/lxml/lxml.etree.c:146399: error: ‘XML_PARSE_NOCDATA’ undeclared (first
use in this function)
src/lxml/lxml.etree.c:146399: error: invalid operands to binary | (have
‘struct PyMemberDef *’ and ‘struct PyMemberDef *’)
src/lxml/lxml.etree.c:146399: error: ‘XML_PARSE_NONET’ undeclared (first use
in this function)
src/lxml/lxml.etree.c:146399: error: invalid operands to binary | (have
‘struct PyMemberDef *’ and ‘struct PyMemberDef *’)
src/lxml/lxml.etree.c:146399: error: invalid operands to binary | (have
‘struct PyMemberDef *’ and ‘int’)
src/lxml/lxml.etree.c:146699: error: ‘XML_PARSE_RECOVER’ undeclared (first
use in this function)
src/lxml/lxml.etree.c:146699: error: ‘HTML_PARSE_NONET’ undeclared (first
use in this function)
src/lxml/lxml.etree.c:146699: error: invalid operands to binary | (have
‘struct PyMemberDef *’ and ‘struct PyMemberDef *’)
src/lxml/lxml.etree.c:146699: error: invalid operands to binary | (have
‘struct PyMemberDef *’ and ‘int’)
src/lxml/lxml.etree.c:147253: error: ‘XML_XPATH_NUMBER_ERROR’ undeclared
(first use in this function)
src/lxml/lxml.etree.c:147264: error: ‘XML_XPATH_UNFINISHED_LITERAL_ERROR’
undeclared (first use in this function)
src/lxml/lxml.etree.c:147275: error: ‘XML_XPATH_VARIABLE_REF_ERROR’
undeclared (first use in this function)
src/lxml/lxml.etree.c:147286: error: ‘XML_XPATH_INVALID_PREDICATE_ERROR’
undeclared (first use in this function)

Re: [Repoze-dev] Getting Started with repoze.bfg - installing repoze.shootout, lxml errors

2009-07-08 Thread david bain
Okay, I needed libxslt-dev also.

sudo apt-get install libxslt-dev libxml2-dev

seems to have done it. This needs to be mentioned, preferably right next to
the instructions for getting repoze.shootout and the other sample
applications.

Is 'python setup.py develop' the correct approach?

On Wed, Jul 8, 2009 at 8:05 AM, Wichert Akkerman wich...@wiggy.net wrote:

 On 7/8/09 2:07 PM, david bain wrote:

 I stuck at installing repoze.shootout.
 using python2.4, virtualenv --no-site-packages, and ubuntu with
 build-essentials.


 Can you try installing libxml2-dev as well?

 Wichert.




-- 
SplashStart - Professional Websites. Starting Now.
http://www.splashstart.com
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] Problems with repoze.sphinx.autointerface

2009-07-08 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Thomas Lotze wrote:
 Alec Munro wrote:
 
 Seems this depends on docutils 0.5, as when used with docutils 0.4, it
 tries to import Directive from docutils.parsers.rst. Which isn't there.

 Upon updating docutils, it seems like it may not like sphinx 0.6.1. On
 line 112, it calls:

 app.add_directive('autointerface', AutoInterfaceDirective,
   0, (1, 0, 1) )

 Which results in sphinx complaining:

 when adding directive classes, no additional arguments may be given
 [...]
 
 What has become of this? The same issue is biting me as well...

I haven't had a chance to look at it, and likely won't have for a bit.
I would be glad to apply a patch and release a new version, if that
would help.

I do know that newer versions of Sphinx are supposed to provide some
additional support for plugins like autointerface:  the release notes
for 0.6[1] say:

 Autodoc now has a reusable Python API, which can be used to create
 custom types of objects to auto-document (e.g. Zope interfaces). See
 also Sphinx.add_autodocumenter().

but I haven't had a chance to figure that out yet, either.

]1] http://sphinx.pocoo.org/changes.html#release-0-6-mar-24-2009


Tres.
- --
===
Tres Seaver  +1 540-429-0999  tsea...@palladion.com
Palladion Software   Excellence by Designhttp://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFKVKtV+gerLs4ltQ4RAi08AKCa1NCpTQOxmj2087HHdhGdicTghACfSccd
G3gF3hn0eebYYREGyIzTqGY=
=H3/R
-END PGP SIGNATURE-
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] Problems with repoze.sphinx.autointerface

2009-07-08 Thread Thomas Lotze
Tres Seaver wrote:

 I haven't had a chance to look at it, and likely won't have for a bit. I
 would be glad to apply a patch and release a new version, if that would
 help.

OK, I'll try to come up with one.

-- 
Thomas



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


Re: [Repoze-dev] Getting Started with repoze.bfg - installing repoze.shootout, lxml errors

2009-07-08 Thread Chris McDonough
On 7/8/09 9:23 AM, david bain wrote:
 Okay, I needed libxslt-dev also.

 sudo apt-get install libxslt-dev libxml2-dev

 seems to have done it. This needs to be mentioned, preferably right next
 to the instructions for getting repoze.shootout and the other sample
 applications.

 Is 'python setup.py develop' the correct approach?

Yes, usually into a virtualenv.  I've added install instructions to the 
shootout 
README.txt: http://svn.repoze.org/repoze.shootout/trunk/README.txt

- C



 On Wed, Jul 8, 2009 at 8:05 AM, Wichert Akkerman wich...@wiggy.net
 mailto:wich...@wiggy.net wrote:

 On 7/8/09 2:07 PM, david bain wrote:

 I stuck at installing repoze.shootout.
 using python2.4, virtualenv --no-site-packages, and ubuntu with
 build-essentials.


 Can you try installing libxml2-dev as well?

 Wichert.




 --
 SplashStart - Professional Websites. Starting Now.
 http://www.splashstart.com


 

 ___
 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


Re: [Repoze-dev] Getting Started with repoze.bfg - installing repoze.shootout, lxml errors

2009-07-08 Thread david bain
Chris,
Thanks, this is really helpful, I'm sure it will lower the barrier for a few
newbies.

On Wed, Jul 8, 2009 at 11:02 AM, Chris McDonough chr...@plope.com wrote:

 On 7/8/09 9:23 AM, david bain wrote:

 Okay, I needed libxslt-dev also.

 sudo apt-get install libxslt-dev libxml2-dev

 seems to have done it. This needs to be mentioned, preferably right next
 to the instructions for getting repoze.shootout and the other sample
 applications.

 Is 'python setup.py develop' the correct approach?


 Yes, usually into a virtualenv.  I've added install instructions to the
 shootout README.txt:
 http://svn.repoze.org/repoze.shootout/trunk/README.txt

 - C



 On Wed, Jul 8, 2009 at 8:05 AM, Wichert Akkerman wich...@wiggy.net
 mailto:wich...@wiggy.net wrote:

On 7/8/09 2:07 PM, david bain wrote:

I stuck at installing repoze.shootout.
using python2.4, virtualenv --no-site-packages, and ubuntu with
build-essentials.


Can you try installing libxml2-dev as well?

Wichert.




 --
 SplashStart - Professional Websites. Starting Now.
 http://www.splashstart.com


 

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





-- 
SplashStart - Professional Websites. Starting Now.
http://www.splashstart.com
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] Problems with repoze.sphinx.autointerface

2009-07-08 Thread Thomas Lotze
Tres Seaver wrote:

 I haven't had a chance to look at it, and likely won't have for a bit. I
 would be glad to apply a patch and release a new version, if that would
 help.

Actually, the immediate reason for the registration of the directive to
break seems to have been fixed on the trunk back in May. Therefore, just
cutting a bug-fix release would be very helpful.

 I do know that newer versions of Sphinx are supposed to provide some
 additional support for plugins like autointerface:  the release notes for
 0.6[1] say:
 
  Autodoc now has a reusable Python API, which can be used to create custom
  types of objects to auto-document (e.g. Zope interfaces). See also
  Sphinx.add_autodocumenter().

OK, I've taken a glance at this, and it looks rather like a rewrite of the
whole thing. I think I'd like to have that, so I might find some time for
it at some point, but certainly not right away. Thank you for the pointer,
anyway.

-- 
Thomas



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