Re: problem in pylons web application

2011-02-12 Thread James Gardner
Which version of FormBuild are you using and where did you see that
example please? In the latest version there is no helpers module. I'd
suggest either installing an older version or updating to version 3
and using the Form class.

pip install --upgrade FormBuild=3.0,=3.0.99

Docs for that version are at 
http://jimmyg.org/work/code/formbuild/3.0.1/manual.html

Incidentally there will be a new, rather different FormBuild in the
next few weeks with a stricter model for fields but you are better off
with the version mentioned above.

HTH,

James


On Feb 10, 10:35 am, varsh priti2011.email...@gmail.com wrote:
 i got error while  running my pylons application.it show error in
 lib/helpers.py  file .

 code of helper.py is as follow

 from formbuild.helpers import field
 from formbuild import start_with_layout as form_start, end_with_layout as
 form_end
 from webhelpers.html.tags import *
 from routes import url_for

 error is look like as follow:

 Traceback (most recent call last):
   File /home/varsha_mca3/virtualenv-1.5.1/env/bin/paster, line 8, in
 module
     load_entry_point('PasteScript==1.7.3', 'console_scripts', 'paster')()
   File
 /home/varsha_mca3/virtualenv-1.5.1/env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/command.py,
 line 84, in run
     invoke(command, command_name, options, args[1:])
   File
 /home/varsha_mca3/virtualenv-1.5.1/env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/command.py,
 line 123, in invoke
     exit_code = runner.run(args)
   File
 /home/varsha_mca3/virtualenv-1.5.1/env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/command.py,
 line 218, in run
     result = self.command()
   File
 /home/varsha_mca3/virtualenv-1.5.1/env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/serve.py,
 line 276, in command
     relative_to=base, global_conf=vars)
   File
 /home/varsha_mca3/virtualenv-1.5.1/env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/serve.py,
 line 313, in loadapp
     **kw)
   File
 /home/varsha_mca3/virtualenv-1.5.1/env/lib/python2.6/site-packages/PasteDeploy-1.3.4-py2.6.egg/paste/deploy/loadwsgi.py,
 line 203, in loadapp
     return loadobj(APP, uri, name=name, **kw)
   File
 /home/varsha_mca3/virtualenv-1.5.1/env/lib/python2.6/site-packages/PasteDeploy-1.3.4-py2.6.egg/paste/deploy/loadwsgi.py,
 line 223, in loadobj
     global_conf=global_conf)
   File
 /home/varsha_mca3/virtualenv-1.5.1/env/lib/python2.6/site-packages/PasteDeploy-1.3.4-py2.6.egg/paste/deploy/loadwsgi.py,
 line 247, in loadcontext
     global_conf=global_conf)
   File
 /home/varsha_mca3/virtualenv-1.5.1/env/lib/python2.6/site-packages/PasteDeploy-1.3.4-py2.6.egg/paste/deploy/loadwsgi.py,
 line 270, in _loadconfig
     return loader.get_context(object_type, name, global_conf)
   File
 /home/varsha_mca3/virtualenv-1.5.1/env/lib/python2.6/site-packages/PasteDeploy-1.3.4-py2.6.egg/paste/deploy/loadwsgi.py,
 line 401, in get_context
     section)
   File
 /home/varsha_mca3/virtualenv-1.5.1/env/lib/python2.6/site-packages/PasteDeploy-1.3.4-py2.6.egg/paste/deploy/loadwsgi.py,
 line 423, in _context_from_use
     object_type, name=use, global_conf=global_conf)
   File
 /home/varsha_mca3/virtualenv-1.5.1/env/lib/python2.6/site-packages/PasteDeploy-1.3.4-py2.6.egg/paste/deploy/loadwsgi.py,
 line 353, in get_context
     global_conf=global_conf)
   File
 /home/varsha_mca3/virtualenv-1.5.1/env/lib/python2.6/site-packages/PasteDeploy-1.3.4-py2.6.egg/paste/deploy/loadwsgi.py,
 line 247, in loadcontext
     global_conf=global_conf)
   File
 /home/varsha_mca3/virtualenv-1.5.1/env/lib/python2.6/site-packages/PasteDeploy-1.3.4-py2.6.egg/paste/deploy/loadwsgi.py,
 line 277, in _loadegg
     return loader.get_context(object_type, name, global_conf)
   File
 /home/varsha_mca3/virtualenv-1.5.1/env/lib/python2.6/site-packages/PasteDeploy-1.3.4-py2.6.egg/paste/deploy/loadwsgi.py,
 line 553, in get_context
     object_type, name=name)
   File
 /home/varsha_mca3/virtualenv-1.5.1/env/lib/python2.6/site-packages/PasteDeploy-1.3.4-py2.6.egg/paste/deploy/loadwsgi.py,
 line 579, in find_egg_entry_point
     possible.append((entry.load(), protocol, entry.name))
   File
 /home/varsha_mca3/virtualenv-1.5.1/env/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py,
 line 1954, in load
   File
 /home/varsha_mca3/virtualenv-1.5.1/env/pylonsforum/pylonsforum/config/middleware.py,
 line 12, in module
     from pylonsforum.config.environment import load_environment
   File
 /home/varsha_mca3/virtualenv-1.5.1/env/pylonsforum/pylonsforum/config/environment.py,
 line 10, in module
     import pylonsforum.lib.helpers
   File
 /home/varsha_mca3/virtualenv-1.5.1/env/pylonsforum/pylonsforum/lib/helpers.py,
 line 6, in module
     from formbuild.helpers import field
 ImportError: No module named helpers
 --
 View this message in 
 context:http://pylons-discuss.1595796.n2.nabble.com/problem-in-pylons-web-app...
 

Re: FormBuild3 question

2010-08-07 Thread James Gardner
Hi waugust,

Thanks. There are actually two problems here:

* A bug in form.end_with_layout()
* A bug where the example LiteralForm in the docs is out of date

I've made a new release 3.0.2 to fix them both. If you get the source
distribution and look at test/pylons_test.py you should see the
example working correctly.

Mike: Thanks for bringing this to my attention.

Cheers,

James



On Aug 6, 6:48 pm, waugust waugustyn...@gmail.com wrote:
 I'm using FormBuild 3 to build my forms.  I have my form in a forms
 module with a return function to a controller where I put it into a
 tmpl_context variable and pass it to my mako template.
 I copied James' function to make the return literal, though upon
 rendering, everything comes out fine except for
 form.end_with_layout() which gives lt;/tablegt;/form.

 James' class:

 from formbuild import Form
 from webhelpers.html import literal

 class LiteralForm(Form):
     def __getattribute__(self, name):
         if name in ['value', 'option', 'error', 'checked', 'flow']:
             return Form.__getattribute__(self, name)
         def make_literal(*k, **p):
             return literal(getattr(Form, name)(self, *k, **p))
         return make_literal

 I don't do anything odd on the form:

 from myproj.forms import LiteralForm
 from pylons import url

 form = LiteralForm(
                    value = {
                             'file':''
                             },
                    error= {
                            'file_upload':u'Please select a file for
 processing.'
                            }
                    )
 lines = [
          form.start_with_layout(
                 url(controller='template', action='process'),
 table_class='upload_form'
                 ),
         form.row('h2Upload file for processing/h2'),
         form.field(
                 label=File,
                 type='file',
                 name='file'
                 ),
         form.action_bar(
                 form.submit(name='action', value='Submit')
                 ),
         form.end_with_layout(),
          ]

 def returnform():
     return lines

 Anybody got an idea?

-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@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: How extensible is AuthKit?

2010-01-04 Thread James Gardner
Hi Jamie,

It sounds like you already have a farily sophisticated setup so I'd
recommend rolling your own but using the AuthKit code as an example
for anything you wish to build yourself.

One tip though, I now believe using exceptions to trigger the 401 and
403 responses and then intercepting them in WSGI middleware is not a
good design pattern. New code I'm working on generates a normal
response in the authorization decorators or whereever the check fails
instead of in the WSGI middleware. This avoids problems with other
middleware components intercepting exceptions when they aren't
supposed to and also avoids issues around the WSGI middleware trying
to generate a page using objects which are only available where the
exception was raised. It is just less tangled so I'd recommend you
avoid using exceptions in your own code too.

Cheers,

James

(AuthKit author)


On Jan 2, 2:36 am, Jamie jjbe...@gmail.com wrote:
 I'm working on porting an old PHP project of mine over to Pylons.  For
 authentication this project mainly uses a lot of Postgres stored
 procedures. As well as checking valid login attempts, the database
 generates and tracks authentication tokens that are stored client-side
 in cookies.  Each token is calculated by hashing the username, ip
 address, useragent, and some other stuff.  Current valid tokens are
 stored in a db table.  The cookie expiration (token timeout) is
 automatically updated each time the token is used, up to a maximum
 lifetime.  If I expect to port this app over successfully, this
 authentication system cannot be altered at this time.

 I know that I can use a customized authentication backend with
 Authkit, but I'm not sure that it's made to be tweaked this throughly
 (short of essentially forking it...meh).  But I do like middleware-ish
 features like the decorators and intercepting HTTP status codes.

 Should I roll-my-own solution now and maybe port it over to AuthKit
 down the road, or can I drop-in the functionality I need without
 murdering the existing code too much?

--

You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@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.




The Definitive Guide to Pylons (complimentary copies)

2008-12-20 Thread James Gardner

Hi everyone,

I'm pleased to announce that The Definitive Guide to Pylons is now
available in bookshops. If you order a copy from Amazon today you
might even get it in time for Christmas!

http://www.amazon.com/Definitive-Guide-Pylons-James-Gardner/dp/1590599349/

The book represents 18 months work and is the most complete and up-to-
date reference to Pylons available. As many of you will know this book
was written in collaboration with the Pylons community and the alpha
drafts of the chapters are still available online at http://pylonsbook.com.
I'd like, once again, to thank everyone who contributed for all their
efforts. I really appreciate them and I've acknowledged some of the
key contributers in the book itself. Over the next few weeks I'll
begin updating the Pylons Book website with the final version of the
text but at the moment the only way to get the complete version is to
either buy the hard copy or receive one of the ones I'm giving away.
Read on for details...

Apress often send complimentary copies of the book to important people
who are well connected at the corporate level (or in academia) and
since this represents a great opportunity to spread the word about
Pylons too I thought I'd ask everyone on the list for their thoughts
about who it would be most useful to send these books to. If you could
email me (off-list) with their names and contact details I'll take the
top 5 suggestions and make sure they each receive a book. I'll also
send a copy to the first person who suggests each person I eventually
decide to send the books to, so please get your thinking caps on!
(I've already thought of sending one to Guido so that doesn't count!)

Also if you'd be willing to write a review of the final release
version of the book please get in touch with me too and I'll see if I
can send you a complimentary copy for review as well. More generally
if you've bought a copy of the book and are finding it a positive
experience I'd really appreciate it if you'd consider sharing your
thoughts either on your blog or by posting a review on Amazon - you
can do so by clicking the Create your own review link in the
Customer Reviews section on the Amazon page above and signing in. In
the past the lack of documentation has been one of the major
criticisms of Pylons so if we can make a good job of advertising the
presence of the book (and the official documentation Ben has been
working on) I hope we can spread the word about Pylons more
effectively. I know some people have started talking about the book
already and it is great to see the positive comments appearing.

Thanks a lot and I hope you enjoy the book,

James


P.S. Since the the book has made it onto the shelves before Pylons
0.9.7 is officially released I've written a guide at http://tinyurl.com/69ffjv
which shows you how to use the Pylons release candidates for the time
being.

--~--~-~--~~~---~--~~
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: Problem with Authkit 0.4.2 and Pylons 0.9.7rc4 on Apache2 and mod_wsgi 2.3

2008-12-10 Thread James Gardner

Hi Tomasz,

 [Wed Dec 10 05:38:44 2008] [error] [client [...]] mod_wsgi (pid=8169):
 Exception occurred processing WSGI script
 '/home/.../public_html/pyupo/apache2/pyupo.wsgi'.
 [Wed Dec 10 05:38:44 2008] [error] [client 88.199.174.122] TypeError:
 sequence of string values expected, value of type literal found
 ...

mod_wsgi is much stricter about return types than the Paste HTTP
server used during development. Something somewhere is returning a
webhelpers.html.literal object when mod_wsgi is expecting an 8-bit
string, most likely it is the template you are using for the sign in.
Try changing the pyupo.lib.auth.render_signin function so that the
value it returns is encoded:

def render_signin(...):
 return template.encode('utf-8')

Then it will all work.

HTH,

James
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Problems with AuthKit (was: Django or Pylons - comparison details)

2008-12-10 Thread James Gardner

Hi Raoul,

 Sorry, I quoted someone else, and I didn't clarify to say that I don't
 agree with him 100%. Faux pas on my part there, I didn't intend to be
 insulting. What I tried to convey was that AuthKit doesn't fit *my*
 needs.

Sorry, I hadn't seen the earlier thread, my fault too.

 Not at all. If I wanted automagic GUIs, I'd have chosen Django, with
 all it's terrible ideas ;-). What I wanted was a auth+auth layer that
 worked with my table names, and worked *with* me. When I looked at
 AuthKit when I was starting my project about 6 months ago, it *felt*
 it it was working *against* me.

I hear that a lot and am quite keen to get to the bottom of the
problem.

 The problem I encountered with AuthKit when I looked at it, was that
 it seemed too manual. I didn't want manual, I wanted automagic. I
 didn't want to have to specify users or groups in my code, it needed
 to happen from information in the database. AuthKit has obviously
 progressed since then, and it looks like some of what I wanted has
 been developed, but when I looked at it, it didn't fullfil my needs.

That's interesting. What information exactly did you expect AuthKit to
be able to extract? At one level there is a Users API interface which
you can abstract for whatever back end you like but that clearly
wasn't what you wanted either. What sort of data did you want AuthKit
to be able to work on? I'm keen to take AuthKit where it needs to be
now I've mostly finished the book.

 One of my other problems was that the documentation was rather
 confusing. It didn't show me what I presumed 90% of developers would
 want, that being to be able to use data from a database to drive the
 permissions system. The documentation when I last looked at it was
 heavily in favour of the more manual way of doing things, with
 hard-coded users and and groups, and very little (in fact, I didn't
 see any) of the documentation discussed using SQLAlchemy models for
 users, groups (or roles) and permissions.

Yes the docs were pretty poor. The only option was to really look at
the examples. I've now written two complete chapters about using
AuthKit in Pylons and they target only the core use case. It is
probably too late for you now but the two chapters are here:

http://pylonsbook.com/alpha1/authentication_and_authorization
http://pylonsbook.com/alpha1/simplesite_part_3

There are updated versions on their way as soon as Apress send me the
final texts but the current versions represent the best guide to
AuthKit and Pylons.

 Perhaps one of the things you can look at some time is sprucing up the
 documentation to show how to use SQLAlchemy models to pull users,
 groups and permissions with AuthKit. I'm sure a lot of folks would
 appreciate it, and more folks would be encouraged to use AuthKit
 rather than write their own homegrown system.

That's precisely what the two chapters just mentioned do.

 I hope this clears things up. I was in no way wanting to put down your
 effort into AuthKit. As an open source developer myself, I know how
 often it can be a thankless task when your code is still in it's early
 phases and people are demanding something you can't deliver.

I appreciate that, thanks. In all honesty I know AuthKit has caused a
lot of people quite a lot of pain though and I'm keen to sort it out.
I'm most of the way through closing all the open tickets now and if I
can get some clear guidance about the sorts of problems people have
run into I'm keen to help.

Cheers,

James


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: AuthKit

2008-11-06 Thread James Gardner

Hi Eric,

It isn't that it hasn't received any attention, rather that I need to
be sure your patch won't break other functionality. I've released
AuthKit 0.4.1 which mirrors the current trunk and started working on
applying the patches but for the next week or two I'm going to be
completely busy with the final proof-reads of the Pylons Book so I'm
not going to be able to test your patch until then. If you know anyone
who would like to help me maintain AuthKit I'd be happy to hear from
them.

Cheers,

James


On Nov 3, 9:18 am, Eric Lemoine [EMAIL PROTECTED] wrote:
 On Fri, Oct 31, 2008 at 7:41 PM, Walter Cruz [EMAIL PROTECTED] wrote:
  A new version was released some weeks ago.. What's the issue of yor ticket?

 Thanks for your response. Here's the ticket: 
 http://authkit.org/trac/ticket/59

 --
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: AuthKit Newbie Woes

2008-10-14 Thread James Gardner

Hi Steven, Ben and Walter,

I updated the AuthKit chapters today:

http://pylonsbook.com/alpha1/authentication_and_authorization
http://pylonsbook.com/alpha1/simplesite_part_3

As it happens, although the SimpleSite Part 3 chapter isn't finished,
I believe all the AuthKit information is now accurate.

Version 0.4.1 is exactly the same as the current SVN trunk. There are
quite a few bugs outstanding against AuthKit so I thought I'd release
0.4.1 for all people currently using trunk and then start using 0.4.2
for the bug fixes but since I'm going on holiday in 4 hours I didn't
want to formally release it before I left. You should just use trunk
for the time being but if you really want to use 0.4.1 you can do this
(bear in mind it might need to be tweaked slightly before I make it
formally available):

svn co http://authkit.org/svn/AuthKit/tags/0.4.1 AuthKit
cd AuthKit
python setup.py install

I'll check it more carefully and release it once I'm back next week
and then begin the work of applying tickets and updating the
documentation.

Best wishes,

James




On Oct 14, 9:21 pm, ben adam [EMAIL PROTECTED] wrote:
 I was also getting the keyerror before but now I use the work around
 mentioned in the pylonsbook (check one of the Caution! boxes in Ch18,
 i.e. add authkit middleware at the end just before return statement).

 On Oct 14, 12:51 pm, Walter Cruz [EMAIL PROTECTED] wrote:

  Looks like a new version from authkit was released yesterday.. Maybe
  the docs need a update..

  On 10/14/08, Steven [EMAIL PROTECTED] wrote:

    I'm going through the tutorials athttp://pylonsbook.comandhave been
    trying to get through the AuthKit section for a while.

    I've tried both easy_install AuthKit==dev and easy_install
    AuthKit=0.4.1,=0.4.9, Pylons 0.9.7, SQLAlchemy 0.5.

    In both cases it doesn't seem to work.. it looks like the pylonsbook
    and authkit are a work in progress ( they both look like they've been
    updated in the last couple weeks)...  while it is probably just me
    being a newbie and doing things wrong.. I am wondering also if I'm
    meant to be using AuthKit yet or if it isn't completed yet.

    It correctly displays the login screen when I try to access a
    controller that is protected with the authorize decorator however when
    I try to login with foo and password bar (from pylonsbook
    tutorial).. I get a

    KeyError exception for pylons.pylons not being valid...

    Since I wasn't sure if AuthKit was complete I switched over to trying
    using repoze.who so I can't get a complete stack trace easily now..
    but thought I would ask folks anyhow.

    [1] has anyone had any luck getting AuthKit to log users in / out
    using SQLAlchemy and UsersFromDatabase?  (I mean is AuthKit complete?)
    [2] if so, any times on the exception I'm seeing?

    Steven

  --
  []'
  - Walter
  waltercruz.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: AuthKit Newbie Woes

2008-10-14 Thread James Gardner

There is an incompatibility between AuthKit and Pylons 0.9.7. Just put
the all the AuthKit middleware right at the end of the middleware
stack before the return statement and after the Cascade and then it
should work. (This is explained in the updated documentation).


On Oct 14, 4:04 pm, Steven [EMAIL PROTECTED] wrote:
 I'm going through the tutorials athttp://pylonsbook.comand have been
 trying to get through the AuthKit section for a while.

 I've tried both easy_install AuthKit==dev and easy_install
 AuthKit=0.4.1,=0.4.9, Pylons 0.9.7, SQLAlchemy 0.5.

 In both cases it doesn't seem to work.. it looks like the pylonsbook
 and authkit are a work in progress ( they both look like they've been
 updated in the last couple weeks)...  while it is probably just me
 being a newbie and doing things wrong.. I am wondering also if I'm
 meant to be using AuthKit yet or if it isn't completed yet.

 It correctly displays the login screen when I try to access a
 controller that is protected with the authorize decorator however when
 I try to login with foo and password bar (from pylonsbook
 tutorial).. I get a

 KeyError exception for pylons.pylons not being valid...

 Since I wasn't sure if AuthKit was complete I switched over to trying
 using repoze.who so I can't get a complete stack trace easily now..
 but thought I would ask folks anyhow.

 [1] has anyone had any luck getting AuthKit to log users in / out
 using SQLAlchemy and UsersFromDatabase?  (I mean is AuthKit complete?)
 [2] if so, any times on the exception I'm seeing?

 Steven
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Authkit setup error

2008-10-14 Thread James Gardner

That's right, you need to import your model into the websetup.py file:

from simplesite import model


On Oct 14, 4:58 pm, Steven [EMAIL PROTECTED] wrote:
 I'm a newbie as well (working through the pylonsbook.com) in my
 SimpleSite/simplesite/websetup.py I have this line at the top of the
 file which defines model.

 from simplesite import model

 I think adding it to your websetup.py might do the trick.

 Steven

 On Oct 9, 11:05 am, dw [EMAIL PROTECTED] wrote:

  I'm trying to integrate authkit into my app and I'm going through the
  book online.  I'm using pylons 0.9.7 to match the book and my model is
  set up in the same manner as the simple site tutorial.  When I run the
  setup-app to set up the user tables I get the following error:
  File XXX/websetup.py, line 25, in setup_app
      users = UsersFromDatabase(model)
  NameError: global name 'model' is not defined

  I've been trying to trace this error but can't seem to figure it out.
  This is my first real pylons app so I'm sure I'm missing something
  here.  Any help would be greatly appreciated.  Thanks.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Is AuthKit still acrively being developed?

2008-09-12 Thread James Gardner

Hi all,

AuthKit is still being actively developed and still being used.  As Mike 
says, the documentation is the main problem rather than the code. I'll 
be addressing that after I've completed the Pylons book.

Cheers,

James


Mike Orr wrote:
 On Fri, Sep 12, 2008 at 5:38 AM, Bartosz R [EMAIL PROTECTED] wrote:
   
 Some claim (http://beta.stackoverflow.com/questions/47801) that it is
 not. And so it seems that the last commit was 2 months ago... Can
 anyone clarify?
 

 Cc'ing James Gardner, AuthKit's maintainer.  The main problem with
 AuthKit has been the documentation rather than the code, so I think
 he's been working mainly on that.  The Pylons Book, which he's also
 writing, contains the latest documentation:

 http://pylonsbook.com/alpha1/authentication_and_authorization

   


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Change to AuthKit setup.enable behaviour

2008-06-14 Thread James Gardner

Hi all,

I've just checked in some code to the trunk which changes the
behaviour of the setup.enable option to AuthKit.

If you specify:

setup.enable = False

in a config file it used to disable the AuthKit middleware. It now
also disables all the authorization adaptors too. This is useful if
you want to run test suites on the code itself without having to fake
all the authentication and authorization set up.

I've also added a setup.fakeuser option which sets the REMOTE_USER
variable so that tests can be run as if a particular user is signed
in.

There are two related examples here:

http://authkit.org/svn/AuthKit/trunk/examples/authorize.py
http://authkit.org/svn/AuthKit/trunk/examples/authorize2.py

This new functionality hasn't been widely tested yet so if you spot
any problems please let me know.

Cheers,

James

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: How to make QuickWiki Integration Tutorial on pylons .9.6.1, authkit0.4 and sqlalchemy_04_driver work

2008-01-14 Thread James Gardner

The sqlalchemy_04_driver requires the SQLAlchemyManager middleware to be 
set up. This basically involves setting up SQLAlchemy as middleware 
rather than as part of Pylons as the QuickWiki tutorial does. You can 
follow the example here:

http://authkit.org/trac/browser/AuthKit/trunk/examples/user/database/app.py

Using SQLAlchemyMiddleware isn't the standard way of doing things in 
Pylons but it is the best way if you want to create middleware services 
which rely on an SQLAlchemy session.

There are other SQLAlchemy Drivers which people have submitted on this 
list which don't require the middleware.

HTH,

James

keemor wrote:
 Hi,
 
 I'm trying to make QuickWiki Integration Tutorial work  with
 sqlalchemy_04_driver 
 http://wiki.pylonshq.com/display/pysbook/Authentication+and+Authorization.
 
 I changed websetup.py in a way that is not describe in tutorial:
 
 from authkit.users.sqlalchemy_04_driver import UsersFromDatabase,
 setup_model
 
 def setup_config(command, filename, section, vars):
 Place any commands to setup quickwiki here
 conf = appconfig('config:' + filename)
 load_environment(conf.global_conf, conf.local_conf)
 
 import quickwiki.model as model
 
 # Populate the DB on 'paster setup-app'
 log.info(Setting up database connectivity...)
 engine = config['pylons.g'].sa_engine
 
 log.info (Adding users and roles)
 setup_model(model, model.metadata)
 environ = {}
 environ['sqlalchemy.session'] = model.Session
 environ['sqlalchemy.model'] = model
 
 log.info(Creating tables...)
 model.metadata.create_all(bind=engine)
 log.info(Successfully set up.)
 
 users = UsersFromDatabase(environ)
 users.role_create(delete)
 users.user_create(admin, password=opensesame)
 users.user_add_role(admin, role=delete)
 
 log.info(Adding front page data...)
 page = model.Page()
 page.title = 'FrontPage'
 page.content = 'Welcome to the QuickWiki front page.'
 
 model.Session.save(page)
 model.Session.commit()
 log.info(Successfully set up.)
 
 
 In development.ini I have:
 sqlalchemy.default.url = mysql://root:[EMAIL PROTECTED]/pylons
 sqlalchemy.echo = true
 
 authkit.setup.method = form, cookie
 authkit.form.authenticate.user.type =
 authkit.users.sqlalchemy_04_driver:UsersFromDatabase
 authkit.form.authenticate.user.data = quickwiki.model
 authkit.cookie.secret = secret string
 
 I've taken: 
 http://authkit.org/svn/AuthKit/trunk/authkit/users/sqlalchemy_04_driver.py
 
 When I call:
 paster setup-app development.ini
 
 Everything is all right and proper changes in database are made.
 
 But when I call:
 paster serve --reload development.ini
 
   File /usr/lib/python2.5/site-packages/AuthKit-0.4.0-py2.5.egg/
 authkit/authenticate/form.py, line 131, in make_form_handler
 prefix='authkit.method.form',
   File /usr/lib/python2.5/site-packages/AuthKit-0.4.0-py2.5.egg/
 authkit/authenticate/form.py, line 114, in load_form_config
 format='basic'
   File /usr/lib/python2.5/site-packages/AuthKit-0.4.0-py2.5.egg/
 authkit/authenticate/__init__.py, line 191, in
 get_authenticate_function
 users = user_object(user_conf['data'], encrypt)
   File /usr/lib/python2.5/site-packages/AuthKit-0.4.0-py2.5.egg/
 authkit/users/sqlalchemy_04_driver.py, line 100, in __init__
 if not environ.has_key('sqlalchemy.model') or not
 environ.has_key('sqlalchemy.session'):
 AttributeError: 'str' object has no attribute 'has_key'
 
 If I use files instead of db in development.ini everything works just
 fine:
 authkit.form.authenticate.user.type = authkit.users:UsersFromFile
 authkit.form.authenticate.user.data = /home/keemor/pylons/
 users_information.txt
 
 I think I've digged everything about it, so please give me a clue.
 
 Greetz
 --
 keemor
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: AuthKit problems

2007-12-20 Thread James Gardner

Hi Lythoner,

 Yes. I have modified sqlalchemy_driver.py file to use SqlAlchemy 0.4.

Actually what I meant was that there is already an SQLAlchemy 0.4 driver 
in there:
http://authkit.org/trac/browser/AuthKit/trunk/authkit/users/sqlalchemy_04_driver.py

It uses some experimental middleware I wrote to wrap some of the 
SQLAlchemy functionality in WSGI middleware - this isn't the recommended 
approach in Pylons though so you might prefer to use your driver instead.

 Do 
 you have the unit tests for sqlalchemy_driver?. Please spot me the 
 location, I would give a try. 

Yes try here:
http://authkit.org/trac/browser/AuthKit/trunk/test

You run them using nose. I think the command is:
nose test/test.py

If Trac is temperamental when following the above links just press 
refresh a few times and it should work.

 I am newbie to pylons, sqlalchemy, have  
 little programming experience in Python itself. Whatever I have done MAY 
 NOT be correct.  I have attached the modified file, which I haven't 
 given much review. If you give me some comments/suggestions, I love to 
 do this migration.

Thanks for the offer, do you want to take a look at the existing version 
and see if it meets your needs first? The version I've linked above uses 
a new experimental version of the API which creates a new Users instance 
each time it is called. The methods each have access to the WSGI environ 
  so in principle the new API should be a lot more flexible than the old 
one.

We could add your version in too if you are confident it will end up stable?

 Sorry, It was SessionContext not SAContext.

Ahh, makes more sense.

Cheers,

James


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: AuthKit problems

2007-12-20 Thread James Gardner

Hi Enrico,

 Now the it seems that the 'sqlalchemy_04_driver' have some problem
 with 'environ' object.

Ahh, you've been caught out by the different API used by the 0.4 driver. 
The first argument with the new API should be the WSGI environment. I 
can see why this doesn't quite work in the way you were expecting. If 
you do want to use this driver you'll need to setup the 
SQLAlchemyMiddleware first like this example does:

http://authkit.org/trac/browser/AuthKit/trunk/examples/user/database/app.py

Note this isn't the currently recommended way of using SQLAlchemy with 
Pylons, it is just the one I happen to like.

You might be better off with Lythoner's version perhaps if that works 
for you?

Cheers,

James

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: AuthKit problems

2007-12-19 Thread James Gardner

Hi Lythoner,

You've spotted the SQLAlchemy 0.4 driver have you? AuthKit has never 
used SAContext ever.

Cheers,

James



Lythoner LY wrote:
 Enrico,
 
 AuthKit 0.4 is not updated to use the full power of sqlalchemy 0.4. I 
 had faced a lot of issues with UsersFromDatabase class last week. 
 SAContext is a hook they have added temporarily to help the session 
 management and reduce number of repetitive code. Now sqlalchemy 0.4 has 
 improved in this area. AuthKit 0.4 code is really cruft and it has to be 
 updated in many areas  require clean up.
 
 Myself I did some changes in the UsersFromDatabase class to use the 
 latest version of the sqlalchemy. I don't know whether it is good 
 approach or not. I just enjoy the learning curve(with frustration). 
 Their documentation sucks :-(.
 
 Regards,
 
 Lythoner
 
 On Dec 17, 2007 4:28 PM, enrico secco [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED] wrote:
 
 
 Hi Pylons people,
 I'm trying to test the possibility to develop a web application in
 Pylons and I must handle the permission at row level of my db.
 I did think to use AuthKit but I'm forced to use the UsersFromDatabase
 mode.
 I did try to test the funcionality on following the tutorial relative
 to QuickWiki in the Authentication and Authorization (PylonsBook) but
 I don't be aple to pass the
 
 paster setup-app development.ini
 
 The first problem was the definition of 'meta' and 'ctx'. For meta I
 suppose that there was e change in QuickWiki because MetaData() is
 assigned to a 'metadata' variable. Then i add the line
 
 meta = metadata
 
 and for ctx insert 2 lines in QuickWiki model
 
 from pylons.database import create_engine, session_context
 ...
 ctx = session_context()
 
 I know session_context is deprecated but I find no other way.
 
 Then I stop at the same point with:
 
 
 [EMAIL PROTECTED]:~# paster setup-app test.ini
 Running setup_config() from quickwiki.websetup
 /usr/lib/python2.5/site-packages/QuickWiki-0.1.5-py2.5.egg /quickwiki/
 model/__init__.py:10: DeprecationWarning: pylons.database is
 deprecated, and will be removed from a future version of Pylons.
 SQLAlchemy 0.3.x users are recommended to migrate to SAContext (http://
 cheeseshop.python.org/pypi/SAContext
 http://cheeseshop.python.org/pypi/SAContext) for similar functionality
  from pylons.database import create_engine, session_context
 /usr/lib/python2.5/site-packages/Pylons- 0.9.6.1-py2.5.egg/pylons/
 database.py:142: SADeprecationWarning: SessionContext is deprecated.
 Use scoped_session().
  scopefunc=app_scope)
 Traceback (most recent call last):
  File /usr/bin/paster, line 8, in module
load_entry_point('PasteScript==1.3.6', 'console_scripts', 'paster')
 ()
  File /usr/lib/python2.5/site-packages/PasteScript-1.3.6-py2.5.egg/
 paste/script/command.py, line 78, in run
invoke(command, command_name, options, args[1:])
  File /usr/lib/python2.5/site-packages/PasteScript-1.3.6-py2.5.egg/
 paste/script/command.py, line 117, in invoke
exit_code = runner.run(args)
  File /usr/lib/python2.5/site-packages/PasteScript-1.3.6-py2.5.egg/
 paste/script/appinstall.py, line 68, in run
return super(AbstractInstallCommand, self).run(new_args)
  File /usr/lib/python2.5/site-packages/PasteScript- 1.3.6-py2.5.egg/
 paste/script/command.py, line 212, in run
result = self.command()
  File /usr/lib/python2.5/site-packages/PasteScript-1.3.6-py2.5.egg/
 paste/script/appinstall.py, line 456, in command
self, config_file, section,
 self.sysconfig_install_vars(installer))
  File /usr/lib/python2.5/site-packages/PasteScript-1.3.6-py2.5.egg/
 paste/script/appinstall.py, line 592, in setup_config
mod.setup_config(command, filename, section, vars)
  File /usr/lib/python2.5/site-packages/QuickWiki-0.1.5-py2.5.egg/
 quickwiki/websetup.py, line 20, in setup_config
import quickwiki.model as model
  File /usr/lib/python2.5/site-packages/QuickWiki-0.1.5-py2.5.egg/
 quickwiki/model/__init__.py, line 27, in module
ctx = session_context()
  File /usr/lib/python2.5/site-packages/SQLAlchemy- 0.4.1-py2.5.egg/
 sqlalchemy/orm/scoping.py, line 44, in __call__
return self.registry()
  File /usr/lib/python2.5/site-packages/SQLAlchemy-0.4.1-py2.5.egg/
 sqlalchemy/util.py, line 785, in __call__
return self.registry.setdefault(key, self.createfunc())
  File /usr/lib/python2.5/site-packages/Pylons-0.9.6.1-py2.5.egg/
 pylons/database.py, line 137, in make_session
engine = create_engine(uri, echo=echo, **kwargs)
  File /usr/lib/python2.5/site-packages/Pylons-0.9.6.1-py2.5.egg/
 pylons/database.py, line 84, in create_engine
assert uri
 AssertionError
 
 The tables are created with all the constraints but not the istances

Re: Authkit 0.3.0pre5dev_r92 + Pylons 0.9.6rc2 doesn't works?

2007-09-27 Thread James Gardner

Hi Jose,

The documentation is for AuthKit 0.4 from 
http://authkit.org/svn/AuthKit/branches/0.4 I'm going to make a release 
at the weekend.

The problem might be because Pylons 0.9.6 doesn't have the 
httpexceptions middleware.

Try using AuthKit 0.4 and things are more likely to work.

I've put a note at the top of the chapter. Apologies for not making it 
clear.

James

Jose Figueras wrote:
 Hello,
 
 Following authkit documentation (see
 http://wiki.pylonshq.com/display/pysbook/Authentication+and+Authorization),
 it's impossible to me add security in my pylons app:
 
1) if I include authentication code I, ever, receive 401 error:
 
  authkit.authorize.NotAuthenticatedError: 401 Not
 Authenticated The server could not comply with the request since it is
 either malformed or otherwise incorrect. Not Authenticated
 
2) only surpass this error if I add, on development.ini pylons
 configuration file, 500 code error on authkit.catch option. But,
 then, authkit catch all my app errors!!!. Certainly works but...
 
3) if I include authorization code, my webapp shows:
 
  Internal Server Error
 
 Could you help me to discover where is the source of the problem?
 
 
 
 Here you are (part of) my development.ini file:
 
 ...
 # AuthKit configuration
 authkit.enable = true
 authkit.method = forward
 authkit.cookie.secret = secret_string
 authkit.signin = /login/signin
 authkit.cookie.signout = /login/signout
 authkit.catch = 401, 403
 ...
 
 Here you are (part of) my middleware.py file:
 
 ...
 def make_app(global_conf, full_stack=True, **app_conf):
 Create a WSGI application and return it
 
 global_conf is a dict representing the Paste configuration
 options, the
 paste.deploy.converters should be used when parsing Paste config
 options
 to ensure they're treated properly.
 
 # Load our Pylons configuration defaults
 load_environment(global_conf, app_conf)
 
 # Load our default Pylons WSGI app and make g available
 #app =
 pylons.wsgiapp.PylonsApp(helpers=kmauto_management.lib.helpers,
 #   g=app_globals.Globals)
 #app = ConfigMiddleware(app, config._current_obj())
 app = pylons.wsgiapp.PylonsApp()
 
 # YOUR MIDDLEWARE
 # Put your own middleware here, so that any problems are caught
 # by the error handling middleware underneath
 
 # Setup ToscaWidgets
 from toscawidgets.view import EngineManager
 from toscawidgets.middleware import TGWidgetsMiddleware
 from toscawidgets.mods.pylonshf import PylonsHostFramework
 from pylons.templating import render
 
 def extra_vars():
 return dict(
 py_c=pylons.c._current_obj(),
 g=pylons.g._current_obj(),
 h=kmauto_management.lib.helpers,
 render=render,
 request=pylons.request._current_obj(),
 session=pylons.session._current_obj(),
 translator=pylons.translator,
 ungettext=pylons.i18n.ungettext,
 _=pylons.i18n._,
 N_=pylons.i18n.N_
 )
 
 class CustomHostFramework(PylonsHostFramework):
 engines = EngineManager(extra_vars_func=extra_vars)
 engines.load_all({'mako.directories': config['pylons.paths']
 ['templates']})
 
 app = TGWidgetsMiddleware(app, CustomHostFramework)
 
 # If errror handling will be handled by middleware for multiple
 apps, you
 # will want to set full_stack = False in your config file so that
 it can
 # catch the problems.
 if asbool(full_stack):
 # Error Handling
 app = ErrorHandler(app, global_conf,
 error_template=error_template,
**config['pylons.errorware'])
 
 # Authorization
 #@ref 
 http://wiki.pylonshq.com/display/pysbook/Authentication+and+Authorization
 import authkit.authorize
 from authkit.permissions import ValidAuthKitUser
 app = authkit.authorize.middleware(app, ValidAuthKitUser())
 # Authentication
 import authkit.authenticate
 app = authkit.authenticate.middleware(app, app_conf)
 
 # Display error documents for 401, 403, 404 status codes
 # (if debug is disabled also intercepts 500)
 app = ErrorDocuments(app, global_conf, mapper=error_mapper,
 **app_conf)
 
 # Establish the Registry for this application
 app = RegistryManager(app)
 
 static_app = StaticURLParser(config['pylons.paths']
 ['static_files'])
 javascripts_app = StaticJavascripts()
 app = Cascade([static_app, javascripts_app, app])
 return app
 
 
 
 Regards,
 Jose F.
 
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 

Re: Anti-cacheing headers in Pylons

2007-09-26 Thread James Gardner

You can edit your config/middleware.py file so the end of it looks like 
this:

 ...
 javascripts_app = StaticJavascripts()

 class NoCache(object):
 def __init__(self, app):
 self.app = app
 def __call__(self, environ, start_response):
 def sr(status,headers,exc_info=None):
 headers.append(
 (
 'Cache-Control',
 'no-cache, no-store, must-revalidate'
 )
 )
 return start_response(status,headers,exc_info)
 return self.app(environ, sr)

 app = NoCache(app)

 app = Cascade([static_app, javascripts_app, app])
 return app


If you want to force everything to be refreshed, not just the 
dynamically generated pages you can wrap the whole app in the NoCache 
middleware.

Or you can do it from a controller action with:

response.headers['Cache-Control']='no-cache, no-store, must-revalidate'

James



voltron wrote:
 How does one generate anti-cacheing headers in Pylons?
 
 Thanks!
 
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Setting the content type in Pylons 0.9.6

2007-09-26 Thread James Gardner

Hi Alec,

You need:

response.headers['Content-type'] = application/atom+xml
return render(genshi-xml, atom-feed)

James


alecf wrote:
 I'm trying to render some Atom feeds with Pylons -
 I've got a genshi template that more or less renders the atom feed,
 but I need to return it as application/atom+xml
 
 For the life of me I can't figure out how the new global response
 object works - setting content_type has no effect.. my controller
 looks something like:
 
 response.content_type = application/atom+xml
 response.content = render(genshi-xml, atom-feed)
 
 (I had to write my own 'genshi-xml' engine plugin wrapper for Genshi,
 because Genshi's default requires the file extension to be .html, but
 that's a whole other story...)
 
 Alec
 
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Retrieving multiple similar values from request.params

2007-09-25 Thread James Gardner

Hi voltron,

I wrote a blog entry about this here:
http://jimmyg.org/2007/09/19/multiple-checkboxes-with-formencode/

Basically you use a custom Schema in a ForEach validator and then use a 
NestedVarables pre-validator to decode the data to a list. You then need 
to re-encode it before using HTMLfill to re-populate your form. Your 
form template needs to name the variables in the correct style so that 
FormEncode can decode them correctly.

The blog entry starts off talking about checkboxes but the bit you need 
is slightly further down. I'm writing a chapter for the Pylons book 
about this at the moment so if you need more info let me know and I'll 
send you the draft off-list.

Cheers,

James

voltron wrote:
 Checking up the docs, I really, really would how this works, it would
 be magic. variable_decode, according to the docs, would take a list
 char for decoding into lists, the default is list_char='-', How would
 that work in my case? I could use a code snippet.
 
 Thanks!
 
 On Sep 25, 12:28 pm, Clemens Hermann [EMAIL PROTECTED] wrote:
 On Sep 25, 12:15 pm, voltron [EMAIL PROTECTED] wrote:

 I have asked about something like this before, this is similar but
 more complicated:
 I have answered about something like this before, this is similar and
 the solution is the same :)

 academic_from_year0, academic_till_year0  e.t.c
 academic_from_year1, academic_till_year1 e.t.c
 academic_from_year2, academic_till_year2 e.t.c
 http://formencode.org/module-formencode.variabledecode.html

 hth,

 /ch
 
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons 0.9.6rc1 fails to start helloworld project: Lookup error

2007-07-23 Thread James Gardner

I think this issue might have been due to missing ez_setup.py files. Can 
you try with the latest Pylons SVN and see if that works?

Cheers,

James


Philip Jenvey wrote:
 
 On Jul 19, 2007, at 2:31 PM, Gambit wrote:
 
 
 /usr/lib/python2.4/site-packages/PasteDeploy-1.3.1-py2.4.egg/paste/ 
 deploy/loadwsgi.py,
 line 541, in get_context
  entry_point, protocol, ep_name = self.find_egg_entry_point(
File
 /usr/lib/python2.4/site-packages/PasteDeploy-1.3.1-py2.4.egg/paste/ 
 deploy/loadwsgi.py,
 line 573, in find_egg_entry_point
  raise LookupError(
 LookupError: Entry point 'main' not found in egg 'helloworld' (dir:
 /root/hw/helloworld; protocols: paste.app_factory,
 paste.composite_factory, paste.composit_factory; entry_points: )

 
 We've heard of a couple folks having this issue, it sounded like it  
 was particular to Windows, but you obviously aren't using Windows. I  
 haven't been able to reproduce it
 
 Running python setup.py egg_info seems to fix the problem, but you  
 shouldn't need to do this for a fresh project. If you could run the  
 following few commands, that would be helpful for us to track down  
 the issue. Can you first backup the project's egg-info dir:
 
 cp -Rp helloworld.egg-info helloworld.egg-info.orig
 
 Then run the egg info command:
 
 python setup.py egg_info
 
 Afterwards, verify that the issue was fixed. If so, then diff the old  
 directory with the new one and show us the output:
 
 diff -ruN helloworld.egg-info.orig helloworld.egg-info
 
 --
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: problem creating custom pylons project template

2007-06-26 Thread James Gardner

emery wrote:
 On Jun 25, 6:06 pm, James Gardner [EMAIL PROTECTED] wrote:
   
 Hi,

 Well I just wrote the response below which someone else might find
 useful in the future but in this case I've a hunch the problem is that
 you have chosen the name ``new`` as the test. I expect Python is
 importing the name ``new`` rather than your new project. Try creating a
 test project that doesn't conflict with an existing Python module?
 

 That was exactly it. Poor choice of project name I know.

 Created helloworld and everything working correctly now.

 Thanks again for your help.

 C.Emery
   

Glad to be able to help. That sort of problem is very hard to track down 
so I've added it to the list of things I think we need to improve to 
make Pylons easier.

Cheers,

James


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: problem creating custom pylons project template

2007-06-25 Thread James Gardner

Could you please post your setup.py file? You have probably made a 
mistake in the entry_points section.

Cheers,

James

emery wrote:
 Hello all,
 
 I am trying to customize the paster template for pylons applications
 to eliminate the need for repetitive changes when creating new pylons
 projects (e.g. replacing templates, some port# changes, etc).
 
 I have followed the tutorial here:
 http://docs.pythonweb.org/display/pylonscookbook/Creating+Templates+For+The+paster+create+Command
 (I used the default_project template directory from pylons without
 customizations to begin with, and will start customizing this once I
 get the template working).
 
 I was able to create and install my custom template (displays
 correctly using paster create --list-templates). It also generates the
 directory structure (paster create --template=mycustompylons
 projectname) cleanly as far as I can tell. However, when I try to
 serve the new 'custom' pylons application (paster serve --reload
 development.ini) I get: LookupError: Entry point 'main' not found in
 egg 'projectname'.
 
 I have posted the errors and applicable files here: 
 http://paste.lisp.org/display/43399#2
 . Any help would be appreciated.
 
 C. Emery.
 
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: problem creating custom pylons project template

2007-06-25 Thread James Gardner

Your setup.py file doesn't have the paste.app_factory main entry point 
so the paster command doesn't know where the make_app() function of your 
Pylons app actually is. To fix this make your entry_points look like this:

entry_points=
 [paste.app_factory]
 main=cpccpylons:make_app
 [paste.app_install]
 main=paste.script.appinstall:Installer
 [paste.paster_create_template]
 cpcc_pylons=cpccpylons.cpcc:CPCCTemplate
,

You might need to change the line starting main= so that it points to 
the correct module where you make_app() function is defined.

HTH,

James



emery wrote:
 Thanks for the reply. I've posted the setup.py here:
 http://paste.lisp.org/display/43399#1
 
 Chris
 
 On Jun 25, 2:46 pm, James Gardner [EMAIL PROTECTED] wrote:
 Could you please post your setup.py file? You have probably made a
 mistake in the entry_points section.

 Cheers,

 James

 emery wrote:
 Hello all,
 I am trying to customize the paster template for pylons applications
 to eliminate the need for repetitive changes when creating new pylons
 projects (e.g. replacing templates, some port# changes, etc).
 I have followed the tutorial here:
 http://docs.pythonweb.org/display/pylonscookbook/Creating+Templates+F...
 (I used the default_project template directory from pylons without
 customizations to begin with, and will start customizing this once I
 get the template working).
 I was able to create and install my custom template (displays
 correctly using paster create --list-templates). It also generates the
 directory structure (paster create --template=mycustompylons
 projectname) cleanly as far as I can tell. However, when I try to
 serve the new 'custom' pylons application (paster serve --reload
 development.ini) I get: LookupError: Entry point 'main' not found in
 egg 'projectname'.
 I have posted the errors and applicable files 
 here:http://paste.lisp.org/display/43399#2
 . Any help would be appreciated.
 C. Emery.
 
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: problem creating custom pylons project template

2007-06-25 Thread James Gardner

Hi,

Well I just wrote the response below which someone else might find 
useful in the future but in this case I've a hunch the problem is that 
you have chosen the name ``new`` as the test. I expect Python is 
importing the name ``new`` rather than your new project. Try creating a 
test project that doesn't conflict with an existing Python module?

HTH,

James


Oh I see, well as I mentioned I think the error is because paste can't 
find the paste.app_factory main entry point for the generated package so 
you'll have to experiment a bit. Have a really careful look at 
/home/chris/pylons/new/setup.py and check the entry points are there and 
that you haven't specified the wrong package name by mistake in the 
entry_points line. If it all looks right try running

python setup.py egg_info

to regenerate the egg information. Can you post the actual generated 
setup.py which is going wrong rather than the template one as it is 
tricky to debug otherwise. Also make sure that the make_app() function 
still exists in the correct place (ie that you haven't altered 
package/__init__.py by mistake?).


emery wrote:
 Thanks James, but I think I am still missing something. The setup.py I
 posted is for the custompylons package that contains the template
 directory. The application that is generated using pylons create
 template=cpcc_pylons then has a setup.py (generated from
 setup.py_tmpl) that does contain those entry points. Since make_app is
 actually defined in the generated pylons project, I am not sure how to
 reference it in the custompylons package setup.py.
 
 I've added the setup.py_tmpl I am using in the custom project to
 http://paste.lisp.org/display/43399#3. Forgive me if I am being
 obtuse, entry points and packaging are still very new to me.
 
 
 On Jun 25, 3:12 pm, James Gardner [EMAIL PROTECTED] wrote:
 Your setup.py file doesn't have the paste.app_factory main entry point
 so the paster command doesn't know where the make_app() function of your
 Pylons app actually is. To fix this make your entry_points look like this:

 entry_points=
  [paste.app_factory]
  main=cpccpylons:make_app
  [paste.app_install]
  main=paste.script.appinstall:Installer
  [paste.paster_create_template]
  cpcc_pylons=cpccpylons.cpcc:CPCCTemplate
 ,

 You might need to change the line starting main= so that it points to
 the correct module where you make_app() function is defined.

 HTH,

 James

 emery wrote:
 Thanks for the reply. I've posted the setup.py here:
 http://paste.lisp.org/display/43399#1
 Chris
 On Jun 25, 2:46 pm, James Gardner [EMAIL PROTECTED] wrote:
 Could you please post your setup.py file? You have probably made a
 mistake in the entry_points section.
 Cheers,
 James
 emery wrote:
 Hello all,
 I am trying to customize the paster template for pylons applications
 to eliminate the need for repetitive changes when creating new pylons
 projects (e.g. replacing templates, some port# changes, etc).
 I have followed the tutorial here:
 http://docs.pythonweb.org/display/pylonscookbook/Creating+Templates+F...
 (I used the default_project template directory from pylons without
 customizations to begin with, and will start customizing this once I
 get the template working).
 I was able to create and install my custom template (displays
 correctly using paster create --list-templates). It also generates the
 directory structure (paster create --template=mycustompylons
 projectname) cleanly as far as I can tell. However, when I try to
 serve the new 'custom' pylons application (paster serve --reload
 development.ini) I get: LookupError: Entry point 'main' not found in
 egg 'projectname'.
 I have posted the errors and applicable files 
 here:http://paste.lisp.org/display/43399#2
 . Any help would be appreciated.
 C. Emery.
 
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



London Hack Day

2007-06-16 Thread James Gardner

Are any Pylons users here at the London Hack Day today? If so, drop me 
an email with your mobile, perhaps we could work on something 
Pylons-related?

Cheers,

James

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Revisiting Pylons Branding

2007-06-05 Thread James Gardner

Hi Tim,
 Maybe it's the attitude? Turn the perceived inaccessibility to Pylons'
 advantage and appeal more directly to the hardcore crowd. Give it a
 more rugged image and a bit of a bite. Use a tag line like heavy-duty
 rapid web development, a powerful, customizable web framework, or
 rapid web development for enthusiasts. It certainly fits with what I
 think of a pylon--a strong, proud, imposing structure. Don't bother
 with the our MVC, rapid development framework makes websites quicker
 and better than those other MVC, rapid development frameworks pack.
 It's a crowded field and from an uninformed perspective they can all
 blend together pretty quickly. Instead, emphasize Pylons' raw power
 and potential for customization, and in fairly aggressive terms. Say
 that, yes, it has a steeper learning curve, but in the end you'll have
 a app that you can be proud of and that's truly your own. And you can
 do it without the cruft of Java, the chaos of PHP, or the roadblocks
 of your typical MVC framework. Make it tempting for the people who
 want to know how a system ticks and how to get the most out of their
 code. Then provide the tools and resources for them to do just that
   
I like all your suggestions and whole-heartedly agree. The brand we seem 
to be converging on is Pylons: Power to the developer and everything 
you've written neatly summarizes the ideas that tag line is supposed to 
represent.
 I'd also argue for using customizable over flexible. The former
 word implies more direct interaction and control. You hear about car
 enthusiasts customizing their cars, not their cars being flexible or
 adaptable (or case modders with cases, etc). It gives a better sense
 of Yes, I can change this system to fit my preferences and
 requirements. Just a personal preference, though, of course.
   
I'm happy with that, good point. As part of the next stage I'm keen to 
slightly restructure Pylons so that the way the packages are organised 
better reflects what they actually do so that people can instantly see 
how customisable Pylons is by picking and choosing the best packages.
 The bullet points for me, as far as feature set goes:

 1.a. Rapid development and MVC (which applies to just about everything
 post-RoR)
 1.b. A second generation modern web frameworks, building on ideas from
 Rails, Django, etc, and learning from their flaws
 2. Designed for customization; modular, configurable at any level
 3. Leverages the experience and power of more specialized libraries:
 Paste for low-level WSGI/HTTP, Mason-Myghty-Mako, SQLAlchemy
 4. Good tools for testing and debugging
   
I like the idea of calling it a second generation framework in 
particular but all your points are valid.
 I don't typically post unless I feel it's something that hasn't been
 said and might benefit the project or the community. Hope my comments
 are useful in that regard.
   
Point taken, thanks for the advice.

James

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: installing python-sql on windows

2007-06-05 Thread James Gardner

Hi Voltron,

I haven't tried that but you if you don't mind using psycopg you can get 
the Windows binaries here:
http://www.stickpeople.com/projects/python/psycopg/

James

voltron wrote:
 has anyone tried this lately? I get errors:

 D:\Projects\Pylons_projects\easy_install python-pgsql
 Searching for python-pgsql
 Reading http://www.pylonshq.com/download/
 Reading http://cheeseshop.python.org/pypi/python-pgsql/
 Reading http://people.rpath.com/~gafton
 Reading http://people.rpath.com/~gafton/pgsql/
 Reading http://cheeseshop.python.org/pypi/python-pgsql/0.9.5
 Best match: python-pgsql 0.9.5
 Downloading http://people.rpath.com/~gafton/pgsql/python-pgsql-0.9.5.tar.gz
 Processing python-pgsql-0.9.5.tar.gz
 Running python-pgsql-0.9.5\setup.py -q bdist_egg --dist-dir c:
 \docume~1\sharri~1
 .zeu\locals~1\temp\easy_install-ksf8z2\python-pgsql-0.9.5\egg-dist-tmp-
 d-kcpk
 Traceback (most recent call last):
   File C:\Python24\Scripts\easy_install-script.py, line 7, in ?
 sys.exit(
   File c:\python24\lib\site-packages\setuptools-0.6c5-py2.4.egg
 \setuptools\comm
 and\easy_install.py, line 1670, in main
 with_ei_usage(lambda:
   File c:\python24\lib\site-packages\setuptools-0.6c5-py2.4.egg
 \setuptools\comm
 and\easy_install.py, line 1659, in with_ei_usage
 return f()
   File c:\python24\lib\site-packages\setuptools-0.6c5-py2.4.egg
 \setuptools\comm
 and\easy_install.py, line 1674, in lambda
 distclass=DistributionWithoutHelpCommands, **kw
   File C:\Python24\lib\distutils\core.py, line 149, in setup
 dist.run_commands()
   File C:\Python24\lib\distutils\dist.py, line 946, in run_commands
 self.run_command(cmd)
   File C:\Python24\lib\distutils\dist.py, line 966, in run_command
 cmd_obj.run()
   File c:\python24\lib\site-packages\setuptools-0.6c5-py2.4.egg
 \setuptools\comm
 and\easy_install.py, line 211, in run
 self.easy_install(spec, not self.no_deps)
   File c:\python24\lib\site-packages\setuptools-0.6c5-py2.4.egg
 \setuptools\comm
 and\easy_install.py, line 446, in easy_install
 return self.install_item(spec, dist.location, tmpdir, deps)
   File c:\python24\lib\site-packages\setuptools-0.6c5-py2.4.egg
 \setuptools\comm
 and\easy_install.py, line 471, in install_item
 dists = self.install_eggs(spec, download, tmpdir)
   File c:\python24\lib\site-packages\setuptools-0.6c5-py2.4.egg
 \setuptools\comm
 and\easy_install.py, line 655, in install_eggs
 return self.build_and_install(setup_script, setup_base)
   File c:\python24\lib\site-packages\setuptools-0.6c5-py2.4.egg
 \setuptools\comm
 and\easy_install.py, line 930, in build_and_install
 self.run_setup(setup_script, setup_base, args)
   File c:\python24\lib\site-packages\setuptools-0.6c5-py2.4.egg
 \setuptools\comm
 and\easy_install.py, line 919, in run_setup
 run_setup(setup_script, args)
   File c:\python24\lib\site-packages\setuptools-0.6c5-py2.4.egg
 \setuptools\sand
 box.py, line 26, in run_setup
 DirectorySandbox(setup_dir).run(
   File c:\python24\lib\site-packages\setuptools-0.6c5-py2.4.egg
 \setuptools\sand
 box.py, line 63, in run
 return func()
   File c:\python24\lib\site-packages\setuptools-0.6c5-py2.4.egg
 \setuptools\sand
 box.py, line 29, in lambda
 {'__file__':setup_script, '__name__':'__main__'}
   File setup.py, line 81, in ?

   File setup.py, line 51, in pg_config

 Exception: pg_config tool is not available.


 0.95 Pylons on Windows 2000


 
   


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons Security

2007-06-04 Thread James Gardner

Hi all,

 Who says AuthKit is not ready for production?  Did its author
 disrecommend it?  

Well, I say it isn't ready for production on the main site because I'm 
still tweaking the APIs a bit and have written the full documentation. 
I'm using the 0.4 branch in production systems myself though so it 
should be considered ready for production if you can work out how to use 
it without full documentation. The 0.3 release is a bit out of date now 
so I hope to release the 0.4 version fairly soon.

 I took a quick glance at the manual and it says.
 AuthKit has not been audited by a security expert, please use with
 caution at your own risk (or better yet, report security holes).  But
 the same goes for a lot of reasonably safe Python software.  Of course
 it would be good to hire a security specialist to audit Pylons and its
 commonly-used dependencies -- are you offering to do this and file bug
 reports?

Exactly, it should be safe but I haven't gone through all the algorithms 
and specs to check and I don't guarantee there aren't bugs.

 Does pylons have the means to keep the bad guys out? I'm interesting
 in using it for an e-commerce app, and you anyone can the security
 requirments any e-commerce app would need.

You can run Pylons and AuthKit behind an secure server and then things 
should be pretty secure. You might be interested in my article here:

http://docs.pythonweb.org/x/ZIAI

 The main vulnerabilities derive from the type of
 authentication chosen: plaintext password file, encrypted password
 file, SQL database, LDAP, etc.  Each of these imply certain
 vulnerabilities that really overshadow how well AuthKit manages them.
 Meaning, AuthKit probably does a reasonably good job, but the factors
 outside its control are the ones most likely to bite you, and these
 should be looked at no matter whether you use AuthKit or some other
 library.

+1

Cheers,

James



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons Logo Design

2007-06-04 Thread James Gardner

Hi all,

Dan wrote:
 I think you should consider changing domain names.  I don't think the 
 name Pylons is bad, just combined with the domain pylonshq.com it just 
 doesn't stick.  I'd suggest using pylonsframework.org for the following 
 reasons:
 
 .org - Eludes to an open source/non-profit.   If Pylons is open 
 source/non-profit I think its a feature that you should mention to your 
 visitors... I didn't see licensing information anywhere on the homepage?
 
 pylonsframework - Eludes to Pylons being a framework right in the 
 domain.  I'd click on a URL for pylonsframework.org before pylonshq.com.

My view is that we shouldn't change domain names unless we can get 
pylons.org or pylons.com, both of which I will continue to investigate. 
There is no point in changing domains because it will simply cause 
problems with existing links. Even though Ben has registered 
pylonshq.org I don't think we should change for this same reason.

Also I know tech people like .org but lots of business people think .org 
is what you get when you can't get .com. I know it is ridiculous but I 
have an easier time selling Pylons as a attentional product when it is 
hosted a .com address compared with a .org so I'm keen to keep it that 
way if possible.

I agree with Ben that we should add some sitemap data and mention 
Headquarters somewhere, people often ask what the HQ stands for.

 In general, the things that brought me to Pylons was the 1) speed and 
 libraries of Python and 2) MVC development.  Both are not even mentioned 
 on  the homepage.  It should be in the first paragraph.  WSGI seems 
 important, even if I didn't know why, but not a reason I'd choose Pylons 
 over another framework.  Its not something that I would say in the first 
 paragraph.   I'd say that most people care about two things: speed (both 
 development time and application performance) and stability.  These two 
 key points should be the focus of the introduction, to grab the visitors 
 attention.  I do think Pylons is flexible, which can be a feature, but 
 it can also be a hindrance... especially for newbies.  Thats tricky.
 
 I hate to mention the word, but 'screencasts' is almost a standard.  It 
 wouldn't hurt if someone could put one together.
 
 I hope that I'm not coming off as being overly critical.  Pylons is a 
 great framework.  Keep up the good work!

Really appreciate the comments, very helpful!

Just thinking about the possibility of an Egyptian theme for the logo 
but temple Pylons don't look visually too exciting either. I'm open to 
the idea of changing the name of the project actually but only if people 
have very compelling alternatives and the whole community gets totally 
behind the idea.

By the way I've added some notes about the discussion to this page:
http://docs.pythonweb.org/display/pylonscommunity/Pylons+Logo

If anyone wants to get started on some sample text for any of the 
website pages feel free to create a page off the one above and make a 
start! We can always move pages around to a more appropriate location 
later if necessary.

Cheers,

James

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons Logo Design

2007-06-01 Thread James Gardner

Hi Christoph,

I didn't see the discussion actually but I've just had a look at the 
logs. Actually I like the style of the everaldo icons and logos, do you 
know if they are very costly?

Cheers,

James


Christoph Haas wrote:
 Hi, James...

 On Fri, Jun 01, 2007 at 09:57:31AM +0100, James Gardner wrote:
   
 Ben and I have started thinking again about what really makes Pylons 
 different from other web frameworks and how we can best highlight those 
 differences in the Pylons marketing to help attract people to the 
 community and see Pylons gain further recognition and adoption.

 As part of the process we'd like to hire a professional designer to 
 create a new and striking logo for Pylons but we don't know of anyone 
 suitable ourselves so I'd like to send out a challenge: Does anyone on 
 the list know a top notch logo designer who they can recommend and who 
 might be interested in helping us design a fresh Pylons logo?

 Any recommendations will be much appreciated and after we've discussed 
 the options here on the list we'll commission the person whose work best 
 reflects Pylons.
 

 I'm not sure if you followed the discussion we had on IRC about logos.
 Yannick Gingras pointed out that http://www.everaldo.com/ is supporting
 open-source projects. Might be worth a try. The artwork doesn't look
 ugly.

  Christoph


 
   


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: AuthKit bails out on Unicode usernames

2007-05-14 Thread James Gardner

Hi Christoph,

I've just tested AuthKit 0.4 with an Arabic username and yes, there is a 
problem because the browser encodes the Arabic as HTML entities because 
there is no charset specified when the form is produced. Other than that 
it all seems to work fine. Is it considered standard practice to allow 
non-ascii usernames though? Particularly since usernames are supposed to 
be case-insensitive in AuthKit?

I'm adding functionality now so that the default charset is UTF-8 and so 
that you can arbitrarily set it but I suppose to be totally future proof 
you should be able to add any status and headers you like to override 
the defaults AuthKit uses. The thing is I'm not sure that isn't taking 
things too far, after all, people can always implement their own middleware?

Cheers,

James


Christoph Haas wrote:
 Hi, list...
 
 I'm using AuthKit in my application and seem to have trouble when the
 login form gets me the username as a Unicode string. I use the famous
 line:
 
 form_username = request.params.get('username')
 request.environ['paste.auth_tkt.set_user'](form_username)
 
 This leads to Unicode errors (I currently cannot reproduce it). Things
 start to work though when I run str() on the Unicode string before:
 
 form_username = str(request.params.get('username'))
 request.environ['paste.auth_tkt.set_user'](form_username)
 
 Does AuthKit have trouble with Unicode strings in general? Or am I
 missing a configuration option?
 
 Kindly
  Christoph


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: AuthKit bails out on Unicode usernames

2007-05-14 Thread James Gardner

Hi Christoph,

If you use the latest AuthKit 0.4 and specify:

form_charset=UTF-8

to the authenticate middleware you should find your unicode strings work 
OK. You'll need to make sure your Python source files are properly 
encoded though so the users information correctly picks up the unicode 
usernames - I'm not sure whether specifying them directly in the paste 
config file will work for unicode for example.

Cheers,

James

James Gardner wrote:
 Hi Christoph,
 
 I've just tested AuthKit 0.4 with an Arabic username and yes, there is a 
 problem because the browser encodes the Arabic as HTML entities because 
 there is no charset specified when the form is produced. Other than that 
 it all seems to work fine. Is it considered standard practice to allow 
 non-ascii usernames though? Particularly since usernames are supposed to 
 be case-insensitive in AuthKit?
 
 I'm adding functionality now so that the default charset is UTF-8 and so 
 that you can arbitrarily set it but I suppose to be totally future proof 
 you should be able to add any status and headers you like to override 
 the defaults AuthKit uses. The thing is I'm not sure that isn't taking 
 things too far, after all, people can always implement their own middleware?
 
 Cheers,
 
 James
 
 
 Christoph Haas wrote:
 Hi, list...

 I'm using AuthKit in my application and seem to have trouble when the
 login form gets me the username as a Unicode string. I use the famous
 line:

 form_username = request.params.get('username')
 request.environ['paste.auth_tkt.set_user'](form_username)

 This leads to Unicode errors (I currently cannot reproduce it). Things
 start to work though when I run str() on the Unicode string before:

 form_username = str(request.params.get('username'))
 request.environ['paste.auth_tkt.set_user'](form_username)

 Does AuthKit have trouble with Unicode strings in general? Or am I
 missing a configuration option?

 Kindly
  Christoph
 
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: can't get authkit working in 0.9.5

2007-04-16 Thread James Gardner

Hi Max,

 You're right. I misread the docs and put it right _before_ the 
 httpexceptions middleware.

Glad you sorted it!

 The timestamp is right on http://authkit.org/docs/pylons.html page. ;)

Most strange!

Cheers,

James

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Alternate way to install Pylons

2007-04-07 Thread James Gardner

Hi Rob,

Try pointing easy_install at http://pylonshq.com/download/ using this 
command:

easy_install -f http://pylonshq.com/download/ Pylons

Cheers,

James


RobJ wrote:
 apparently the cheesshop server is having some down time and I need to
 install Pylons. Is there any other place where I can get the latest
 Pylons egg?
 
 robj
 
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: FormBuild doesn't handle FormEncode's unicode messages

2007-04-03 Thread James Gardner

Hi Frederik,

OK, I see. Looks like a FormBuild problem. I'll take a look over the 
next few days.

Cheers,

James


Frederik wrote:
 Hi James,
 
 On Apr 2, 5:49 pm, James Gardner [EMAIL PROTECTED] wrote:
 Hi Frederik,

 Is this now resolved with Ian's new FormEncode release? If not, can you
 send me some code that breaks and I'll look into it.
 
 No, it's still broken. The code is simply from the pylons guide for
 FormBuild: http://formbuild.org/docs/pylons.html
 
 All works fine with pylons built-in form validation as described in
 http://pylonshq.com/docs/0.9.4.1/form_handling.html:
 
 def form(self):
 return render_response('/form.myt')
 
 @validate(schema=model.form.EmailForm(), form='form')
 def email(self):
 return Response('Your email is: %s' %
 self.form_result.get('email'))
 
 When the email address is missing an at-sign, I get this message: Eine
 E-mail Adresse muß ein einzelnes @ Zeichen enthalten
 (Which is, by the way, outdated German, as we now write muss instead
 of muß.)
 
 But with the FormBuild code, I get a UnicodeEncodeError. All messages
 that contain no non-ascii characters work fine. But the one stated
 above (containing 'ß') breaks:
 
 def email_form(self):
 if len(request.params):
 try:
 results =
 model.forms.schema.EmailFormSchema.to_python(
 dict(request.params),
 state=c
 )
 except formencode.Invalid, e:
 c.form = model.forms.build.StandardForm(
 dict(request.params),
 e.error_dict or {}
 )
 return render_response('/email_form.myt')
 else:
 return Response(
 'Your are %s years old and have the following
 email: %s' % (
 results['age'],
 results['email']
 )
 )
 else:
 c.form = model.forms.build.StandardForm()
 return render_response('/email_form.myt')
 
 This gives me:
 
 Error:Error(UnicodeEncodeError): 'ascii' codec can't encode character
 u'\xdf' in position 22: ordinal not in range(128)
 File: /usr/lib/python2.4/site-packages/FormBuild-0.1.6b-py2.4.egg/
 formbuild/builder/layout/basic.py line 21
 Context:
 18: td%(name)
 19:
 20: def entry_end(self, name='', error='' ):
 21: return /td
 22: td valign=top%s/td
 23: /tr\n%(error)
 24:
 
 So I thought it might be rather a FormBuild problem than a FormEncode
 one. But I might be wrong, anyway.
 
 Thanks for looking into this!
 
 Regards,
 Frederik
 
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: formbuild Custom Form

2007-04-02 Thread James Gardner

Hi,

FormBuild forms aren't really designed for you to do that. If you want 
to add extra methods you should so so to either the Fields or Layout 
classes you set the form up with and then access them via the 
form.field.test() if the test method produces a field or 
form.layout.test() if it is for a layout.

HTH,

James


C. Handel wrote:
 Maybe I'm braindead, but what's broken with this:
 
 from formbuild.form import FormBase
 from formbuild.builder.field.basic import HtmlFields
 from formbuild.builder.layout.basic import HtmlLayout
 
 class MForm(FormBase):
 field = HtmlFields()
 layout = HtmlLayout()
 def test(self):
 print test
 
 t = MForm()
 t.test()
 
 
 
 Traceback (most recent call last):
   File test.py, line 11, in ?
 t = MForm()
   File /usr/lib/python2.4/site-packages/FormBuild-0.1.6b-py2.4.egg/
 formbuild/form/__init__.py, line 56, in __init__
 getattr(self, attribute)(self)
 TypeError: test() takes exactly 1 argument (2 given)
 
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: FormBuild doesn't handle FormEncode's unicode messages

2007-04-02 Thread James Gardner

Hi Frederik,

Is this now resolved with Ian's new FormEncode release? If not, can you 
send me some code that breaks and I'll look into it.

Cheers,

James

Alberto Valverde wrote:
 
 On Mar 28, 2007, at 11:23 AM, Frederik wrote:
 
 Hello!

 Current, I'm having a look into Pylons and FormBuild. I went through
 the pylons guide from the FormBuild website. But that email_form
 example raises a UnicodeEncodeError in formbuild/builder/layout/
 basic.py.

 The problem seem to be the localized error messages of FormEncode 0.7.
 They contain non-ascii characters, and this causes the error in
 FormBuild (0.1.6b).

 I think that unicode messages as well as a good harmony between
 FormEncode and FormBuild are quite crucial. So is there a chance that
 there will be a fix for this in FormBuild? Or is there a good
 workaround for this?
 
 I've also stumbled upon some unicode bugs using localized error  
 messages and reported them to the FE mailing list along with a patch,  
 however, seems  good i18n support is not  much of a priority for  
 FE... (bump, bump... ;)
 
 Alberto
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: AuthKit: how to use authorization in Myghty templates?

2007-03-29 Thread James Gardner

Hi Chris,

You need the authorized() function which returns True or False rather 
than raising the exception.

http://authkit.org/docs/module-authkit.pylons_adaptors.html

Hope that helps,

James


something like:

Chris Shenton wrote:
 I'm using AuthKit with an SQLite DB and wrote a couple authorization
 checking classes like:
 
   class RoleIn(Permission):
   Does the user have a role in the supplied list of roles (logical OR).
   A user can have more than one role.
   
   def __init__(self, roles):
   self.roles = _downlist(roles)
   def check(self, app, environ, start_response):
   user = _getuser(environ)
   for role in user.roles:
   if role.name in self.roles:
   return app(environ, start_response)
   warning(User roles=%s not in required=%s % (user.roles, 
 self.roles))
   raise NotAuthorizedError(User roles=%s not in required=%s % 
 (user.roles, self.roles))
 
 I use this as a decorator in a controller like:
 
 @authorize(RoleIn([bianca-admin, account-admin]))
 def user_update(self, id):
 # ...
 
 Now I want to only display a button or link tab on a page if the user
 has permission to use that link; I don't want to display it then give
 them a 403 when the permission decorator subsequently blocks them.
 
 How can I use my Permission objects like RoleIn() above as plain
 python tests in a Myghty template? I naively tried stuff like:
 
   %from bianca.lib.permissions import RoleIn, GroupIn
   %if RoleIn(['account-admin', 'bianca-admin']):
   % h.link_to(Accounts, h.url_for(account_index)) % 
   %#END if RoleIn
 
 but that clearly won't work because I'm just testing a class'
 existence, not a truth value.
 
 The Permission objects don't seem designed to work for templates but
 this seems a common enough need.
 
 Any hints? Thanks.
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: New Pylons site launched

2007-03-26 Thread James Gardner

Congratulations Robert and thanks for sharing the setup with the rest of us!

James

Robert Leftwich wrote:
 Just thought I'd let everyone know that after much hard work we have finally 
 publicly launched our Pylons-based site - http://www.marketshares.com.au
 
 Apologies for the (semi-)spam, but I think it is a good advertisement for the 
 power of Pylons as it is a fairly large site with daily data on more than 600 
 companies. It is a heavy user of Myghty with more than 160 template/component 
 files. Each trading night it processes around 2GB of additional data into the 
 postgres db via SQLAlchemy and creates more than 55,000 individual graphs 
 which 
 are available over more than 3 years (totalling 250G). We are using nginx as 
 the web server/load balancer.
 
 I am indebted to the Pylons and SQLAlchemy people (and the many related 
 projects, such as Paste, FormBuild, Authkit, and more) as it would have been 
 a 
 lot more difficult to get to where we are without these excellent projects to 
 build on.
 
 Robert
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: AuthKit using database for users, groups, roles?

2007-03-26 Thread James Gardner

Hi Chris,

Chris Shenton wrote:
 My implementation may not be the cleanest and I'm still uncertain
 about doing auth in my account.py controller versus doing something
 with valid() in app_globals.py.

Well, you only need to use valid() if you want the AuthKit middleware to 
handle the authentication. Since you are using the forward method your 
application has to handle authentication itself so your setup is correct!

 I've written a HOWTO on what I did at
 
   http://pylonshq.com/project/pylonshq/wiki/PylonsWithAuthKitDatabase

This is really useful actually, thanks! I'm going to see if I can find a 
simple way to package it up so that it can form part of AuthKit itself, 
perhaps using Elixir and ToscaWidgets to make it look a bit simpler.

Cheers,

James


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: ANN: Documentation Wiki Launched

2007-03-20 Thread James Gardner

Hi Dave,

Once again Philip Jenvey is on the case and has implemented a prototype 
rst plugin which currently generates HTML but not PDF.

There isn't a huge amount of Trac content on the Trac wiki (some is rst 
anyway) so it will probably be easier just to move the remaining 
articles across manually and tidy them up in the process but I'll have a 
look at the script as well tonight.

Cheers,

James

primco wrote:
 anybody about to take a whack at trac or reStructuredText markup to
 confluence converter?
 
 I found this http://confluence.atlassian.com/display/CONFEXT/Trac+Importer
 
 It at least has a start with the syntax.
 
 Davep
 
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: formbuild questions

2007-03-20 Thread James Gardner

Hi Cliff,

Just to clarify, FormBuild isn't going to be deprecated, discontinued or 
merged as such, I'll continue to maintain it, but as ToscaWidgets 
becomes more stable I'm going to recommend people use ToscaWidgets 
instead of FormBuild because it provides a more natural development 
model and it makes sense for the Pylons community to share as much work 
with the TurboGears developers as possible. Also widgets are easy to 
share so if we all put our efforts into ToscaWidgets everyone stands to 
benefit from having lots of useful reusable components.

Cheers,

James


Cliff Wells wrote:
 On Tue, 2007-03-20 at 09:16 +, James Gardner wrote:
 
 The relevant sections of the manual 
 (http://formbuild.org/docs/manual.html) to get you started are
 
 I seem to recall (perhaps incorrectly) that formbuild was being
 deprecated/discontinued/merged with another project.  Is this the case
 or is that... um, remember stuff... thing... I have in my head failing
 me?
 
 Cliff
 
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons Logo...

2007-03-18 Thread James Gardner

Hi Todd,

 Is this tied to any release plans or just a general initiative/plan?
 In other words is this for a 1.0 party (or more conservatively
 0.9.6 :-) or just a general effort to increase visibility?

It is part of a general effort to increase visibility, but that being 
said I think we'd all like to have a solid brand in place ready for the 
1.0 release!

 I've always found the website overall to have a decent fit and finish,
 but a bit gloomy, like a rainy day. I wouldn't propose screaming happy
 yellow everywhere, but perhaps a bit less dour? It's a big can of
 worms though I know... but when you're learning something and banging
 your head on the desk, even a little cheer can help!

OK, that's the black on the top then I suppose. I think if we had a 
really strong logo we could probably lighten up the whole thing.

Cheers,

James

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: AuthKit bug: users.py UsersFromFile should read from fp, not filename

2007-03-16 Thread James Gardner

Thanks, this is fixed now.

James

Chris Shenton wrote:
 Using AuthKit-0.3.0pre5.
 
 The code gets the file pointer but then reads from the filename string:
 
def __init__(self, filename):
 string = None
 try:
 fp = open(filename, 'r')
 string = filename.read()
 finally:
 fp.close()
 
 should be:
 
 string = fp.read()
 
 
 I tried to log a ticket in AuthKit's trac but don't have an account.
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: AuthKit using database for users, groups, roles?

2007-03-16 Thread James Gardner

Hi Pauli,

I always implement my own database, permissions and valid() function in 
my code. The users API is simply meant for use in small systems where 
there isn't any need for a more sophisticated solution. Although you 
could create your own implementation of the API to use a database, it is 
really just as easy to start from scratch and use the lower-level tools 
AuthKit provides.

Cheers,

James

 I've also been wondering what is the best way to use Authkit when the
 user database is an external one.
 
 There's this page [1] about how to make Authkit forward
 authentication and authorization fully to your application. One way so
 seems to use this forward method, and handle all authentication and
 authorization by yourself, [2] i.e., implement the login/logout
 actions, and on start of each request put the user info to c.user, for
 example, based on  environ['REMOTE_USER'] (which is set by Authkit).
 It's quite easy to write your own set of authkit Permissions for
 checking whether user is in given group or has a given role.
 
 But I'm not really sure whether this is the best way to go, or would
 it be more sensible to leverage Authkit's user system. A starting
 point for this seems to be the authkit.users.object  other config
 settings [3] that allow defining a custom class that implements the
 authkit user database API  custom password validation.
 
 [1] http://pylonshq.com/project/pylonshq/wiki/PylonsWithAuthKitForward
 [2] http://authkit.org/docs/manual.html#manually-handling-user-management
 [3] http://authkit.org/docs/manual.html#using-the-user-management-api
 
 --
 Pauli Virtanen
 
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: paste.recursive.include

2007-03-15 Thread James Gardner

Hi Ksenia

The problem here is that the recursive middleware can only forward to 
paths below it. In this case, the recursive middleware is setup in the 
error document middleware in the myproject app so when you try to 
include /someapp the recursive middleware thinks you mean /someapp below 
myproject, not /someapp below the root URL.

To fix this you would need to setup recursive middleware above the 
composite app you've setup by adding a recursive filter. I don't know if 
it is possible to put a filter before the composite:main section in the 
config file itself but depending on how you are serving the file you can 
do something like this:

from paste.recursive import RecursiveMiddleware
from paste.deploy import loadapp

app = loadapp('config:/path/to/config.ini')
app = RecursiveMiddleware(app)

if __name__ == '__main__':
 from paste.httpserver import serve
 serve(app, port=8000, host=0.0.0.0

I haven't tested this so let me know if there are any problems.

If you give me some more detail about what the inter-application 
templating system is for I might be able to give you some alternative 
suggestions? The simplest solution would probably be to just create a 
python module which handles the templating calls and can be imported by 
both applications.

Hope that helps,

James

Ksenia Marasanova wrote:
 /someapp/test is a valid path, but it's a different WSGI application,  
 mounted in the configuration file:
 
 [composite:main]
 use = egg:Paste#urlmap
 / = myproject
 /someapp = someapp
 
 [app:myproject]
 use = egg:myproject
 cache_dir = %(here)s/cache/myproject
 session_key = myproject
 session_secret = somesecret
 
 [app:someapp]
 use = egg:someapp
 cache_dir = %(here)s/cache/groovy
 session_key = someapp
 session_secret = somesecret
 
 After upgrading to Pylons==dev the error gives more information:
 exceptions.NotImplementedError: Action someapp is not implemented
 
 Is it by design? I am looking for a way to implement some kind of  
 simple inter-application templating system, and recursive.include  
 seemed to be the easiest way to do that. But if there is better  
 alternative, I'd be glad to hear that :)
 
 Thanks,
 Ksenia.
 
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: custom authkit permission

2007-03-14 Thread James Gardner

Hi,

The example you gave should have worked.

I'm not sure I quite understand the question though. Do you mean that 
the exception is raised but that a sign in isn't triggered or that even 
after you have signed in, only a NotAuthenticatedError is raised any 
that you never get a NotAuthorizedError?

Cheers,

James


bearsprite wrote:
 I use authkit0.3.0pre5 with pylons0.9.5dev_r1895.
 
 In lib/base.py I create a new permission:
 
 class UserNotIn(RequestPermission):
 def __init__(self, users):
 if isinstance(users, list) or isinstance(users, tuple):
 users_ = []
 for user in users:
 users_.append(user.lower())
 self.users = users_
 elif isinstance(users, str):
 self.users = [users]
 else:
 raise PermissionSetupError('Expected users to be a list or
 a string, not %r'%users)
 
 def check(self, app, environ, start_response):
 if not environ.has_key('REMOTE_USER'):
 raise NotAuthenticatedError('Not Authenticated')
 if environ['REMOTE_USER'] in self.users:
 raise NotAuthorizedError('You are not one of the users
 allowed to access this resource.')
 return app(environ, start_response)
 
 
 I hope it can limit someone to some action:
 
 someperm = UserNotIn(['someone'])
 class SomeController(BaseController):
 @authorize(someperm)
 def some_action(self):
 ...
 
 But when I do this action, only NotAuthenticatedError('Not
 Authenticated') was raised, not redirect
 
 Does ONLY the authkit predefined permission can raise a redirect?
 
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: paste.recursive.include

2007-03-14 Thread James Gardner

Hi Ksenia,

The ErrorDocuments middleware also uses the recursive middleware so you 
don't need to include it again.

Other than that, if you are trying to display the redirected page you 
need to do this (I've tested it with Pylons==dev and it works fine):

def index(self):
 result = request.environ['paste.recursive.include']('/someapp/test')
 return Response(result)

The reason the 404 is generated in your code is likely to be because 
/someapp/test isn't a valid path in your application. Try typing it 
directly into the address bar and see if it gives a 404 there too perhaps?

Does the index.html file your code returns actually exist? Perhaps that 
is triggering the 404?

Hope that helps,

James


Ksenia Marasanova wrote:
 Hi list,
 
  From the Paste documentation:
 paste.recursive.include:
 When you call environ['paste.recursive.include'](new_path_info) a 
 response will be returned. The response has a body attribute, a status 
 attribute, and a headers attribute.
 
 It doesn't seem to work for Pylons, I think this key is already used for 
 some internal Pylons stuff. So I added RecursiveMiddleware to middleware.py:
 
 app = RecursiveMiddleware(app, global_conf)
 
 The problem now is that 404 error is raised whenever I call it:
 
 class MainController(BaseController):
 def index(self):
 # The next line raises 404 error
 result = request.environ['paste.recursive.include']('/someapp/test')
 return render_response('index.html')
 
 
 Any idea what can be wrong?
 
 
 --Ksenia
 
 
 
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: mod_proxy example

2007-03-13 Thread James Gardner

Actually you are right. I've disabled it and everything still works, 
including my SSL setup.

Cheers,

James

__wyatt wrote:
 On Mar 12, 10:44 am, James Gardner [EMAIL PROTECTED] wrote:
 ...
 sudo a2enmod proxy
 sudo a2enmod proxy_http
 sudo a2enmod proxy_connect
 
 I don't seem to need the proxy_connect module in my setup. Is it
 required for anything in particular?
 
 __wyatt
 
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: mod_proxy example

2007-03-12 Thread James Gardner

Hi wyatt,

That's exactly right. For completeness if these modules aren't already 
enabled can enable them with this:

sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_connect

The only complication with the proxying approach occurs if you are 
proxying to an application that isn't at the root URL but was written to 
be served from the root URL. For example say your virtual host config 
has this in:

ProxyPass /forms http://localhost:5000
ProxyPassReverse /forms http://localhost:5000

In that case you just need to tweak your development.ini with a 
proxy-prefix so that it all behaves as if it is being served from /forms 
even though it was written to be served from /. All the routes URLs, etc 
will be automatically adjusted.

[app:main]
use = egg:Forms
filter-with = proxy-prefix
# Usual options here

[filter:proxy-prefix]
use = egg:PasteDeploy#prefix
prefix = /forms

Cheers,

James


wyatt-bC wrote:
 Before today, I had never set up a reverse proxy. I've seen it
 mentioned here as a good deployment option, but I couldn't seem to
 find a good, complete example. After screwing around for a while, I
 think I've finally got it figured out. Here's my setup in case it
 might help someone else.
 
 
 I compiled Apache from source using this configuration:
 
 ./configure --enable-mods-shared='rewrite speling proxy'
 
 This automatically added a bunch (6) of 'LoadModule proxy_* ...' lines
 to my httpd.conf, but only the following seem to be necessary:
 
 LoadModule proxy_module modules/mod_proxy.so
 LoadModule proxy_http_module modules/mod_proxy_http.so
 
 
 I put this in the top level of my httpd.conf:
 
 
 ProxyRequests Off
 Proxy http://127.0.0.1:5666/*
 Order deny,allow
 Allow from all
 /Proxy
 ProxyPass / http://127.0.0.1:5666/
 ProxyPassReverse / http://127.0.0.1:5666/
 
 
 Note the trailing slashes on the ProxyPass directives. Note also the
 use of 127.0.0.1 instead of localhost.
 
 
 This is my production.ini:
 
 
 [DEFAULT]
 debug = false
 email_to = [EMAIL PROTECTED]
 smtp_server = 127.0.0.1
 error_email_from = [EMAIL PROTECTED]
 
 [server:main]
 use = egg:Paste#http
 host = 0.0.0.0
 port = 5666
 use_threadpool = true
 threadpool_workers = 10
 
 [app:main]
 # same as development.ini
 
 
 Note the use of 127.0.0.1 instead of localhost for the smtp_server. In
 my case, using localhost works on my dev box (Ubuntu 6.10) but not on
 my production box (Fedora Core 6).
 
 
 In the end, there's not much to it.
 
 
 __wyatt
 
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Deplyoing Pylons applications as Debian packages?

2007-03-06 Thread James Gardner

Hi Christoph,

I think there are two issues here:

1. People like to install multiple versions of the software on the same 
machine
2. Python software, pylons included, isn't as stable from version to 
version as most of the software in Debian stable

Although Debian packages are brilliant when you want a system-wide 
installation of a particular piece of software, they are less good when 
you want multiple versions of the same software installed on the same 
machine.

A lot of the arguments you've made also make the assumption that any 
Debian package is going to be stable from one release to the next due to 
the efforts of the maintainer to ensure a smooth upgrade path. That 
works fine for system packages but seriously, Python software develops 
at a much faster rate than say Apache and whilst we try to maintain 
backward compatibility in Pylons, there are still one or two very small 
incompatibilities along the 0.9.x branch which I do not believe could 
easily be solved by a package maintainer because otherwise we would have 
solved them ourselves in the first place!

The truth is that incompatibilities between different versions of Python 
software aren't *solved* by the packaging mechanism so Debian packages 
can't be better in that regard than using easy_install.

The issue really boils down to which system you understand better. For 
most people who understand easy_install *and* the Debian package 
management system, easy_install with workingenv or a virtual Python 
install is the best approach and the one we will continue to recommend.

As I mentioned in my first email though, if you can find a way of neatly 
packaging a virtual Python install or a workingenv install into a Debian 
package, that might be a good compromise between the two!

Hope that helps,

James

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Deplyoing Pylons applications as Debian packages?

2007-03-06 Thread James Gardner

Hi Christoph,

 thanks for your point-of-view. I hope mine isn't seen as trolling. I'm 
 seriously trying to find a way to unite both the easy_install and the 
 deb-package world. And at the moment everybody just seems to defend their 
 own position. Many Python developer probably don't even care for 
 Debian. :)

No, I understand, there are pros and cons to both approaches.

 Why is that needed in reality? To try out the newest features? Or are there 
 really multiple applications on a server where each one uses different 
 versions of software? 

Well, for example I have authkit.org, formbuild.org, 3aims.com, 
pythonweb.org and a load of test applications under 3aimsapps.com all 
running on the same server. I updated authkit.org more recently than 
3aims.com so it runs a different version of Pylons. Because there are 
minor changes between different Pylons versions it is handy to sandbox 
each installation so that I can start a new project with the latest 
Pylons without changing the software used by the old ones which I've 
tested and know works.

 I'm running Debian's unstable branch at home which 
 means having mostly the same versions of Python modules installed that are 
 in the CheeseShop - just as Debian packages.

That's fine then, you just have to make sure all your application are 
constantly modified so they work with whatever is in unstable at any 
particular moment. That could be tricky though because those packages 
will probably change fairly often.

I prefer to sandbox each Pylons app in its own virtual install so each 
app can use whichever versions are most appropriate for it. That way I 
don't have to worry about ensuring I'm always using the latest software 
for each app but I know that the app is using the software I tested it 
with. It is really just the most pragmatic approach.

 The application I am currently about to write should be running for years 
 (at least a Debian stable period which is 1-3 years) without having to 
 bother about new Pylons versions. So my intent is to use the current Paste 
 version and the current Pylons version (and what else is needed). 

Great, well use a virtual Python install with easy_install and you won't 
have to worry about it again because the Pylons dependencies are kept 
separate from the constantly changing versions in Debian unstable.

 I understand that. But wouldn't it be feasable to just use a set of 
 packages that are considered stable _now_ and use them for the next time? 

Yes but it is up to you which ones you consider stable for your 
purposes. By using a virtual Python install and easy install you can 
make that decision based on your needs rather than having to use 
whatever the Debian packagers decide is best.

 I know a few web developers who prefer a stable API over the newest 
 features. When working with Pylons I currently get these annoying 
 deprecation versions because the version of Pylons here didn't work with 
 the newer Paste version. If I had the old versions installed I didn't 
 have to deal with such issues.

Well, if you used a virtual Python install and easy_install you could 
just setup your application to use the old version of Paste that doesn't 
have the warnings. It is about control being in the hands of the 
developer (who knows what is best for their application) rather than in 
the hands of the package maintainers.

 That's right. The pace is a bit slower if you stay with Debian stable. 
 But there is a time that you surely update the software and then 
 applications may break. At least during that period nobody has to expect 
 surprises.

But it works on an a very long cycle, the release cycle for Pylons is 
about 3 months max with lots of changes to the dependencies along the 
way so the Debian model doesn't fit projects like Pylons so well. That's 
not to say we won't eventually or either to imply the Debian approach is 
better, they are just different.

 I'll start working with it and see if that's feasible. That approach surely 
 has advantages. You always have the newest version if you like. And you 
 don't have to create another package from something that looks like a 
 package already.

Let me know if it works!

 Say, is there a way to package a Pylons application with all dependent 
 packages into a single egg? I mean... if there would be an easy way to 
 distribute an egg that creates a workingenv without interfering with the 
 rest of the system that is at least one valid approach. 

I don't understand why you'd want to do this. You can specify the 
*exact* dependencies you wish to use (down to the version number of an 
SVN checkout if you like) in your setup.py file and they'll be 
automatically installed with easy_install so you always ensure the exact 
dependencies your app needs are installed anyway. You can even specify 
that easy_install should install the required eggs from your server 
rather than the cheeseshop you can guarantee your packages are going to 
be installed.

 You will 

Re: Deplyoing Pylons applications as Debian packages?

2007-03-05 Thread James Gardner

Hi Christoph,

I use Debian and the way I deploy my apps is using a virtual Python 
installation into a user account I setup for each app. I usually then 
just checkout the latest source code and run:

~/bin/python setup.py develop

The problem with trying to package up a Pylons app into a Debian package 
is that you have to worry about all the dependencies. You could package 
up all the dependencies too but that would be a pain.

I suppose the alternative solution if you really want to use a Debian 
package is to setup workingenv and then make a package out of the entire 
workingenv directory with the dependencies included as part of the one 
package.

I've always been happy to stick to using easy_install and eggs myself 
but when packages have C extensions the benefits of creating .debs 
become more apparent.

Also it is useful to have different packages available to different 
Pylons apps and if you just use .debs to install software into the main 
Python directories you can't do that.

I'd be interested to hear if you come up with a good solution though?

Cheers,

James

Christoph Haas wrote:
 Dear list,
 
 I'm spending some of my spare time as a Debian developer which means 
 creating Debian (binary) packages from software. In Debian you don't use 
 easy_install to install Python modules but rely on packages that the 
 distribution provides. E.g. to install Pylons and all it's dependencies 
 you issue an aptitude install python-pylons which means that certain 
 other packages are installed automatically:
 
 python
 python-routes
 python-myghty
 python-paste
 python-pastedeploy
 python-pastescript
 python-formencode
 python-simplejson
 python-webhelpers
 python-nose
 python-beaker
 
 Naturally I wondered how to properly deploy a self-made Pylons application 
 on Debian. Perhaps someone with more insight of the Paster deployment 
 process can help understand what's going on and whether that can be 
 scripted to make it a Debian package. Or perhaps other readers who are 
 familiar with Debian package have an idea, too?
 
 I could imagine a tool like pylons-buildpackage which creates a Pylons 
 application and makes a proper Debian package of it that can be 
 apt-installed. I'm eager to hear other people's ideas on that.
 
 For those not being involved into Debian package management: a Debian 
 package takes the (upstream) software itself (usually a 
 software-1.0.tar.gz file) and adds a special debian/ subdirectory that 
 contains control information on the page. Such information deals with 
 copyright, what other packages are needed (as stated above), which files 
 are to be put where in the file system and a Makefile/shell script that is 
 run to make the software (like ./configure; make; make install).
 
 I'm also interested in how other Debian users deploy Pylons applications. 
 Do you just copy the project directory onto another computer? Or do you 
 deploy into /usr/local? Or am I the only one using Debian here? :)
 
 Kindly
  Christoph
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: ANN: AuthKit 0.3.0pre4

2007-02-19 Thread James Gardner

Hi Cliff and Robert,

There was a simple typo in 0.3.0pre4 which meant none of the config data 
was getting passed correctly to the middleware. Thanks for pointing it 
out. I corrected it and released 0.3.0pre5 so you should upgrade to 
that. It isn't an issue with your application Cliff!

 To add another data point, I upgraded to svn version 57 (pre5?) from v43 and 
 it 
 all worked as expected. It even appears to have corrected an intermittent 
 problem someone reported while testing where the authkit cookie was being set 
 to 
 an empty string, using a host with a leading dot in addition to an existing 
 authkit cookie set to the correct value, using a host w/o a leading dot. I 
 hadn't had a chance to try and chase down this issue, so having it go away is 
 a 
 good thing. FWIW, I'm using forwarding along with RemoteUser() and middleware.

The cookie handling was tweaked a bit too a while ago and has some extra 
options now including server side expiring and including the client IP. 
The middleware also removes the cookie if it has a bad digest rather 
than raising an exception.

There is OpenID authentication support in this version too.

Cheers,

James

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Fast Python webserver

2007-02-18 Thread James Gardner

Hi Robert, Ian

 I'm going to be doing some performance tests on my setup in the next few 
 days, 
 but one thing I've  noticed in preliminary playing is that using 
 fastcgi/flup 
 with nginx is noticeably faster than a straight proxy.

I've been interested to see how well Pylons works with Nginx and FastCGI 
too because I've heard lots of people say good things about the setup.

On my server with a fairly simple app, using Nginx 0.4.13 to proxy to a 
paste http server takes about 11.5ms per request (over 1000 requests).

With Nginx and FastCGI the same app took about 51ms per request.

Using the paste without the proxy takes about 10.6ms per request.

Unless I've set something up very wrong, that means that there is about 
a 1ms overhead using Nginx as a proxy compared to doing the requests 
directly but that using HTTP is about 5 times faster than using FastCGI. 
Should I be using a different version of Nginx?

I would say though that Nginx is very easy to setup and I do like it, 
even if the FastCGI setup doesn't seem faster than the HTTP setup with 
Pylons.

 FastCGI doesn't seem substantially easier to parse than HTTP, so I'm not 
 sure why that'd be.  Maybe flup is just faster than paste.httpserver. 
 Or maybe there's something different about the way connections are 
 handled (are FastCGI connections persistent in any way?).

I would have been surprised if the FastCGI version was faster too, and 
in my tests it isn't.

I'd be very interested to hear your results though Robert.

Cheers,

James

P.S. For anyone interested, this is still my favorite method of 
deploying Pylons/Paste apps in production:

http://pylonshq.com/project/pylonshq/wiki/DaemonTools

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Fast Python webserver

2007-02-18 Thread James Gardner

Hi guys,

 Maybe you could try with the latest (0.5.12) version?

I've rerun the tests with 0.5.12 and the difference is exactly the same. 
FastCGI is 5 times *slower* than simple HTTP!

 Well by default nginx is going to cache the proxied server's response
 before sending it to the client, that could explain the 1msec or so.
 I'm sure you'd have different results over a slower link where it
 makes more sense to do that kind of caching.

I'm not so worried about the 1ms difference. There is bound to be an 
overhead adding another component to the stack. What does seem strange 
is that people are claiming FastCGI performance is better than HTTP 
performance when in my tests the HTTP performance is 5 times faster!

 I'm sure there's things that can be done to paste.httpserver to make
 it come closer to FastCGI in performance.

Hang on a sec, FastCGI is 5 times slower than HTTP, surely it is the 
FastCGI implementation that requires improvement?

 Maybe.  I'm going to be investigating fapws (and perhaps CherryPy's WSGI
 server as well) to see if there's any significant gain by using those
 rather than paste.httpserver (although I suspect most of the overhead is
 in the framework and application, not the HTTP server itself, so even
 significant gains in HTTP performance might not add up to much overall)

Again, my tests clearly show HTTP is 5 times faster than FastCGI. Am I 
missing a trick?

Cliff: Do you still have the links to the benchmarks you mentioned, I'd 
be interested to see the setup being tested.

Perhaps you are proxying to multiple FastCGI backends which is of course 
going to be faster than a single HTTP backend but you can also proxy to 
multiple HTTP backends so that isn't comparing like with like.

I'd really like to get to the bottom of these rumours because if there 
is a faster way of serving a Pylons app I'm keen to document it so that 
everyone can benefit.

Cheers,

James



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Fast Python webserver

2007-02-18 Thread James Gardner

Hi Ian,

 I've rerun the tests with 0.5.12 and the difference is exactly the same. 
 FastCGI is 5 times *slower* than simple HTTP!
 
 Someone mentioned caching -- are you sure that the HTTP server is 
 getting all the requests?  If Nginx is caching some responses and not 
 passing them through, it will of course be much faster.

Yes, I'm sure there is no caching when using HTTP because I can 
benchmark the paste server directly and it is about 1ms faster per 
request than using Nginx to proxy to it.

 Perhaps you are proxying to multiple FastCGI backends which is of course 
 going to be faster than a single HTTP backend but you can also proxy to 
 multiple HTTP backends so that isn't comparing like with like.
 
 It shouldn't dramatically improve performance to use multiple FastCGI 
 backends.  Unless you have a SMP machine or something, which could 
 change performance in all kinds of ways.

Fair point, but it depends a bit on what is going on that is making the 
FastCGI performance so poor.

James



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Fast Python webserver

2007-02-18 Thread James Gardner

Hi Bob,

 I'm curious as to why anyone would want to use FastCGI in the first
 place if proxying is available? Implementation wise, there's very
 little reason why FastCGI would be markedly faster or slower than the
 HTTP protocol.

Agreed, there's no point unless FastCGI is significantly faster which 
would be unexpected.

Since the tests show it isn't faster I'm going to carry on using my 
existing HTTP setup. We can put the FastCGI rumour to bed.

Cheers,

James

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Fast Python webserver

2007-02-18 Thread James Gardner

Robert Leftwich wrote:
 As I'm the one that said it was faster earlier in the thread, I think I 
 should 
 be the one to put the rumour to bed :-))

Sure.

I've heard the same rumour in other places too though actually, 
particularly related to rails but also with Pylons eg:
http://www.rkblog.rk.edu.pl/w/p/pylons-benchmark-various-servers/

 As mentioned in the earlier post, I was playing around with some preliminary 
 configurations on my laptop and it was faster using flup/fastcgi (via ab, not 
 wall clock). 

Interesting. I was using ab too.

 I have been waiting for another server to be setup side by side at 
 my hosting company before I did any 'real' testing, as any testing done 
 outside 
 the host network just saturated the b/w I had available from my office 
 (nothing 
 faster than 128k ISDN where I live/work) w/o getting the server warmed up. 

OK, I was testing on localhost.

 I 
 probably should have just kept my email shut until doing some real testing - 
 stay tuned.

I look forward to the results. Could you let me know the platform you 
are on too please? Sometimes Debian etch is a bit weird!

Cheers,

James

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: AuthKit and AuthDemo

2007-02-11 Thread James Gardner

Hi Hamish,

 I need some simple cookie-based authentication: the user should
 initially be presented with a page asking for their email address; an
 email should be sent to that address containing a link; when the user
 visits that link, an association is made between cookie and email
 address. If the user subsequently deletes the cookie, they will get a
 new one and will need to associate it with their email address again
 in the same way.
 
 Would AuthKit be suitable for this? Would something more lightweight
 be better?

AuthKit is extremely light-weight although there isn't any code that 
does exactly what you are after built in so you will have to read the 
manual and decide the best way to integrate the cookie middleware in 
authkit.authenticate.auth_tkt into your application.

 Also, I tried to install AuthDemo but get:
 
 pkg_resources.VersionConflict: (web 0.6.0 (/Library/Frameworks/
 Python.framework/Versions/2.4/lib/python2.4/site-packages/web-0.6.0-
 py2.4.egg), Requirement.parse('web=0.6.1,0.7'))
 
 I can't find web0.6.0, and neither can easy_install. It's a bit
 difficult to google for a package called web, can anyone point me to
 where I might find a later version?

Sorry, it is part of some legacy code I wrote at pythonweb.org. You can 
install it with:

easy_install -f 
http://pythonweb.org/eggs/http://pythonweb.org/eggs/web-0.6.1-py2.4.egg

The AuthDemo might be a bit sophisticated for your needs since it 
includes a full registration and permissions system but it might give 
you some ideas for your own app.

HTH,

James

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: More on unicode (plus new i18n features like fallbacks)

2007-02-02 Thread James Gardner

Hi Uwe,

Uwe Feldtmann wrote:
 All is translating fine using _() although it would be nice if there was 
 some quick way to get all the strings from a template.

As luck would have it I was documenting this yesterday around line 844 here:

http://pylonshq.com/project/pylonshq/browser/Pylons/trunk/docs/internationalization.txt?order=name

You can do something like this to extract strings, if you give it a go 
I'd be interested to hear if you have any problems.

find translate_demo -type f -name '*myt'  translate_demo/i18n/filelist
find translate_demo -type f -name '*mak' translate_demo/i18n/filelist
find translate_demo -type f -name '*py'  translate_demo/i18n/filelist
cat translate_demo/i18n/filelist | xargs xgettext -o \  
 translate_demo/i18n/messages.pot \
 --language=Python --from-code=utf-8 \
 --keyword=_ --keyword=N_ --keyword=ugettext \
 --keyword=gettext --keyword=ngettext --keyword=ungettext

 Another question however:
 
 Is  request.environ['HTTP_ACCEPT_LANGUAGE'] the best way to get access 
 to the languages acceptable to the browser? 
 
 This is what I get when I execute the above:-
 en-GB,en;q=0.9,en-us;q=0.8,en-US;q=0.6,ar-AE;q=0.5,ar;q=0.4,en-gb;q=0.3,en;q=0.1
 
 Is there a further breakdown or list or should I parse the line manually?
 
 request.environ.languages returing a list would be cool.
 
 The list for the above might look like 
 ['en-GB','en',en-us','en-US','ar-AE','ar','en-gb']
 leaving off the duplicate 'en' off the end.

Believe it or not you are in luck again. Ben has just implemented this. 
If you upgrade to the latest paste and pylons dev you should be able to 
access all the languages as request.languages.

One other thing I implemented yesterday, but have yet to test properly 
and write up, was language fallbacks so that if a word doesn't exist in 
one catalog you can look it up in a fallback or the source instead. This 
means you can setup fallbacks for all the languages in 
request.languages. You'll need Pylons dev again but here's how it works:

from helloworld.lib.base import *
from pylons.i18n.translation import add_fallback

class HelloController(BaseController):
 def index(self):
 h.set_lang('en')
 add_fallback('es')
 return Response(_('Hello')+' '+_('World')+_('!'))

If Hello is in the en .mo file as Hi, World is only in es as 
Mundo and none of the catalogs defined ! you will get the english, 
spanish then the source words. So the message would be Hi Mundo!.

Cheers,

James


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: More on unicode (plus new i18n features like fallbacks)

2007-02-02 Thread James Gardner

Hi Max,

 from helloworld.lib.base import *
 from pylons.i18n.translation import add_fallback

 class HelloController(BaseController):
  def index(self):
  h.set_lang('en')
  add_fallback('es')
  return Response(_('Hello')+' '+_('World')+_('!'))

 If Hello is in the en .mo file as Hi, World is only in es as
 Mundo and none of the catalogs defined ! you will get the english,
 spanish then the source words. So the message would be Hi Mundo!.
 
 Is there is a way to setup this in config file?
 
 E.g.: lang = ru en

Well, you can do lang=en already to specify the main language but it's a 
good idea to able to specify the fallbacks too, I'll implement that.

 If not, how can I setup this fallback globally? Add this to
 BaseController?

Best place is probably the __init__() method of the Globals object in 
lib/app_globals.py actually. I'd have thought it was best not to do it 
in a controller action like I described above otherwise you will be 
adding numerous fallbacks. I'll also write some code so that fallbacks 
are only added if they aren't in place already.

Cheers,

James

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: More on unicode

2007-02-02 Thread James Gardner

Hi Damjan,

Damjan wrote:
 While on the topic ... can someone take a look at
 http://routes.groovie.org/trac/routes/ticket/37

This is fixed in the latest routes. Try:

easy_install -U routes==dev

I've closed the ticket.

Cheers,

James

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: What's the best way to provide a patch ?

2007-02-01 Thread James Gardner

Ben Bangert wrote:
 A diff attached to the Trac ticket as a file upload ending in .diff  
 is ideal, along with a test case when appropriate. I'll try and  
 remember to get this doc'd on the front page of the Wiki as well.

I've followed up Alberto's suggestion of basing our doc on the TG 
guidelines. You can find the document here:

http://pylonshq.com/project/pylonshq/wiki/ReportingProblems

Cheers,

James



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: AuthKit: support for encrypted passwords

2007-02-01 Thread James Gardner

Hi Josh,

Josh Heitzman wrote:
 I dug around a bit.  What Unix systems used to was called crypt.  Some
 are currently a salt + MD5, but apparently the better algorithm is
 considered to be bcrypt, which includes a 128-bit salt and uses are
 variable cycle encryption algorithm.
 
 A python implementation of bcrypt can be had here
 http://www.mindrot.org/projects/py-bcrypt, but pehaps all AuthKit needs
 a mechanism for the client to specify a function it should call to
 compare a submitted password to a stored password.  By default AuthKit
 would supply a function that just did a straight comparison, keeping
 the default behavior as it is now, but allowing the client to override
 that with whatever password encryption scheme they prefer.
 
 Sound reasonable?

This already exists actually. You just need to specify a custom 
valid_password() function (or digest_password() if you are using HTTP 
digest).

It is documented here:
http://authkit.org/docs/manual.html#basic-http-1-0-authentication

Since you mentioned bcrypt, here's an example I expect would work:

 from authkit.authenticate import middleware, test_app
 import bcrypt

 def valid(environ, username, password):
 if not environ.has_key('authkit.users'):
 raise Exception(You haven't setup any users)
 users = environ['authkit.users']
 if users.passwords.has_key(username.lower()):
 hashed = users.passwords[username.lower()]
 return bcrypt.hashpw(password, hashed) == hashed
 return False

 app = middleware(
 test_app,
 method='basic',
 realm='Test Realm',
 users_valid=valid
 )

 from paste.httpserver import serve
 serve(app, host='0.0.0.0', port=8080)

Cheers,

James


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Authentication and Authorization Systems

2007-02-01 Thread James Gardner

Hi Uwe,

 Here is a complete Pylons auth system using SQLAlchemy and OpenID to 
 get you started:
 http://authkit.org/trac/browser/AuthKit/trunk/examples/pylons/AuthDemo
 I've looked at the above example and I was wondering why there appears 
 to be 3 separate persistence tools namely DBUtils, MySQLStore and 
 SQLAlchemy?  Is there a reason for this or am I wrong?

Well, the OpenID libraries don't use SQLAlchemy so I thought I'd have a 
separate connection for them. The DBUtils are used to strengthen the 
MySQLdb connection because I found it regularly disappeared if it wasn't 
used for 8 hours. As it happened using DBUtils didn't help, so yes 
DBUtils could go. I'd still like to keep SQLAlchemy and OpenID separate 
though.

 Do you have any plans to extend AuthKit to be an OpenID server?

Well I've written an OpenID server supporting the simple registration 
protocol (see http://passurl.com) but haven't had a chance to tidy up 
the code for a release yet. I wasn't planning on adding it to AuthKit 
though, but if you want to be involved, perhaps drop me an email off list?

Cheers,

James

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: More on unicode

2007-02-01 Thread James Gardner

Hi Uwe,

The translation should occur at run time so this shouldn't be a problem. 
How are you doing the translation?

If you are using the Pylons _() function in the template everything 
should be fine surely?

Cheers,

James

Uwe Feldtmann wrote:
 I've cross posted this on the Mako list as well.
 
 Now I'm not sure if this is a question for this list or the Mako list.
 
 The scenario:-
 
 A template contains translatable strings and is rendered by the Pylons
 controller via Mako.
 The translated and compiled template ends up in data/templates/xxx.py
 
 user A wants the page in English
 user B wants it in ForeignLang
 
 What happens if both users request the page at the same time?  I assume
 it will be generated twice (which seems wasteful), once for each
 language overwriting the one before it.
 
 Is there a way to avoid overwriting an already generated page?
 
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Concepts of Pylons (proposal for an introductory article to web frameworks)

2007-01-29 Thread James Gardner

Hi Chris,

I think your introduction is very helpful so thanks for writing it up. 
I've added a note to the TowardsOnePointZero page that we should add 
something similar to the main docs.

 Is there a review
 process? Does the documentation get checked into the svn? After all the 
 main documentation that you get when you click on the Docs link is not 
 part of the wiki and seems to needs an admin. Who gets access and who 
 grants access? Until then we have no other chance than to keep it in the 
 wiki.

Ben, myself and Philip Jenvey have written most of the main project 
docs. They are stored in subversion here and any of the main developers 
have access to update them:
http://pylonshq.com/project/pylonshq/browser/Pylons/trunk/docs?order=name

The usual process is that documentation starts of life on the wiki (with 
discussion on the mailing list or IRC) and then one of us takes all the 
concepts and puts them together for inclusion in the main docs.

Cheers,

James



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: pylons controller's self vs. c global

2007-01-29 Thread James Gardner

Hi Max,

From reading the docs at http://pylonshq.com/docs/0.9.4.1/module-
 pylons.controllers.html I assume that new controller instance is 
 created to handle each incoming request and discarded after it is 
 processed. This means I can safely set and read self.foobar attributes 
 without worrying about threading issues.

Yup, that's correct. If you are interested it actually happens in 
pylons.wsgiapp in the dispatch() method of PylonsBaseWSGIApp.

http://pylonshq.com/project/pylonshq/browser/Pylons/trunk/pylons/wsgiapp.py?order=name

 Can I be sure this won't change in new releases or should I assign to 
 c global and never use self?

It's *extremely* unlikely to change so you are safe using self.

HTH,

James



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: [AuthKit] fallback for no cookie support, AtomPP in a forward auth app

2007-01-29 Thread James Gardner

Hi David,

I agree it would be handy to have a way for the app to test for the 
client's ability to use cookies but I think the fallback mechanism needs 
to be thought through to be a little more generic.

I was discussing this with someone else a while back too so I'll try and 
find the thread.

In the meantime I've added it as a ticket.
http://authkit.org/trac/ticket/8

Cheers,

James



David Smith wrote:
 Hi, I'm trying to integrate Atom publishing support in my blog
 app which already uses authkit with the forward method very nicely.
 
 I'm thinking about how to handle the authentication on the
 AtomPP side, and in general what to do if the client doesn't
 support cookies, and would like to hear other's thoughts
 (especially James) regarding run-time configuration of authkit.
 
 I've attached two patches [1], [2] to authkit. The first makes
 it automatically test for cookie support. The second adds
 support for a authkit.cookie.fallback = [basic | digest]
 setting in the config file that will be used when the browser
 does not have cookie support.
 
 The result is that by specifying a cookie fallback to basic and
 authkit.users.valid to a simple function to do the checking,
 the rest of my app shouldn't need any modification for
 authentication purposes.
 
 If this seems like a good solution, please test the patches.
 
 Thanks,
 
 Footnotes:
 [1]  
 http://bosabosa.org/~dds/darcs/index.cgi?r=authkit;a=commitdiff;h=20070128091755-1caef-e8b6c2d707cf2c1ae8049ffdd8e4628b6aa8ad3c.gz
 
 [2]  
 http://bosabosa.org/~dds/darcs/index.cgi?r=authkit;a=commitdiff;h=20070128091942-1caef-dbae36aca4db738649885628d4d30f391057bb29.gz
 
 --
   David D. Smith


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: how to build a portlet style site?

2007-01-17 Thread James Gardner


Hi Paul,

I'm developing a new templating system called art which handles this 
particular case. Instead of using a controller to call a template and 
display the result, the template effectively defines which content it 
requires and calls the different controllers (called plugins in art) 
automatically.


The individual plugins can run on multiple servers so that content can 
be pulled in from remote locations and all the fetching is done in 
parallel with threads so performance is pretty good.


There are some other features too such as the ability to define 
templates from layout objects so that the people making the templates 
don't necessarily need to know HTML, they just choose a header, footer 
and two columns say.


If you are interested I'll try and put the latest code up in the next 
few days.


Of course, in Pylons you can always have a single controller call 
actions from other controllers (they are just WSGI applications) and 
then assemble them yourself?


Cheers,

James




Hi all,

coming from the world of plone...

All the example code uses a single controller per page, which is all
good and fine for crud operations on a database, but seems rather
limited for what we do.

I'd like to build a website (read a typical portal site) that brings
together several controllers/views into a single page (i.e.
/doc/view/123, /news/latest, /user/list, /user/view/myid)

How to do this in pylons? Is this a templating issue? Is it possible to
render a template fragment using a different controller?

thanks a lot for our insight.




--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Authentication and Authorization Systems

2007-01-16 Thread James Gardner


Hi Alagu,

All of them will work! I'd recommend AuthKit because I wrote it with 
Pylons in mind. I'm biased though ;-)


AuthKit is based on paste.auth so includes some of the paste.auth 
middleware. I also tried to ensure it does everything that barrel does.


Here are the AuthKit pylons docs:
http://authkit.org/docs/pylons_authentication_and_authorization.html

Here is a complete Pylons auth system using SQLAlchemy and OpenID to get 
you started:

http://authkit.org/trac/browser/AuthKit/trunk/examples/pylons/AuthDemo

I'm updating AuthKit all the time so let me know if you have any problems!

Cheers,

James


Alagu Madhu wrote:


Hi,


paste.auth
Barrel
Authkit


What is suitable for the Pylons ?





Thanks,

Madhu Alagu


 



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: gettext doesn't work in Mighty template?

2007-01-10 Thread James Gardner

Hi Max,

Have you set your encoding to UTF-8 in the Myghty config as described here?

http://pylonshq.com/docs/internationalization.html#templating

HTH

James

Max Ischenko wrote:
 Hello,
 
 I am testing i18n support in Pylons and run into this error:
 
 
   Myghty Template Error
 
 Error:Error(UnicodeDecodeError): 'ascii' codec can't decode byte 0xd0 
 in position 0: ordinal not in range(128)
 File: 
 /home/max/projects/dou-trunk/site/doupy/doupy/templates/pages/contacts.myt 
 line 3
 Context:  1: # encoding: utf-8
 2:
 3: h2% _(Contacts) %/h2
 4:
 5:
 6:
 Traceback: 
 /home/max/projects/dou-trunk/site/doupy/doupy/templates/pages/contacts.myt:3
 
 
 Here is original traceback:
 
 File 
 '/home/max/projects/dou-trunk/site/doupy/doupy/controllers/page.py', 
 line 15 in index
   return render_response('pages/%s.myt' % name, output_encoding='utf-8')
 File 
 '/usr/lib/python2.4/site-packages/Pylons-0.9.3-py2.4.egg/pylons/templating.py',
  
 line 307 in render_response
   response = pylons.Response(render(*args, **kargs))
 File 
 '/usr/lib/python2.4/site-packages/Pylons-0.9.3-py2.4.egg/pylons/templating.py',
  
 line 293 in render
   namespace=kargs, **cache_args)
 File '/usr/lib/python2.4/site-packages/Pylons- 
 0.9.3-py2.4.egg/pylons/templating.py', line 206 in render
   return engine_config['engine'].render(namespace, template=full_path,
 File 
 '/usr/lib/python2.4/site-packages/Pylons-0.9.3-py2.4.egg/pylons/templating.py',
  
 line 254 in render
   global_args=global_args, out_buffer=buf,
 File 
 '/usr/lib/python2.4/site-packages/Myghty-1.1-py2.4.egg/myghty/interp.py', 
 line 156 in execute
   return self.make_request(component = component, **params).execute()
 File 
 '/usr/lib/python2.4/site-packages/Myghty-1.1-py2.4.egg/myghty/request.py', 
 line 275 in execute
   raise error
 Error: Error(UnicodeDecodeError): 'ascii' codec can't decode byte 0xd0 
 in position 0: ordinal not in range(128) at 
 /usr/lib/python2.4/site-packages/Myghty- 
 1.1-py2.4.egg/myghty/requestbuffer.py line 367
 
 Looks like it doesn't like my unicode message returned by gettext.
 
 I have tried to use ugettext but then Pylons complains it is not 
 available. I also tried to use Pylons 0.9.4.1 http://0.9.4.1 but then 
 I get some strange error about do_run_component() function.
 
 Max.
 
  


--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Can Pylons be more aggressive ?

2007-01-05 Thread James Gardner


Hi Kendall,

I've talked to James about writing a piece about Pylons when it goes  
1.0, and I still want to do that (i.e., if James is still interested,  
he's got dibbs on the main 1.0 piece). 


I'm still up for that. In fact perhaps now that others on the mailing 
list seem to think it is time to start pushing Pylons more heavily 
perhaps I should get started!


James

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Problem with the Flickr tutorial

2006-12-22 Thread James Gardner


I just noticed that there was a change in Paste 1.1 which might affect 
things:


   paste.request.parse_formvars didn't accept parameters in
   CONTENT_TYPE. prototype.js sets a charset parameter, which caused a
   problem.

Have you tried upgrading to Paste 1.1? Does that fix the issue or is it 
totally unrelated?


Cheers,

James


Yves-Eric wrote:


Ben Bangert wrote:

Can you
try the absolute latest Scriptaculous 1.7.0 beta and see if that
fixes the issue? Here's the d/l link:
http://script.aculo.us/beta/scriptaculous-js-1.7.0_beta2.zip


Argh, sorry, IE's overzealous cache got me again. After more extensive
testing, 1.7.0_beta2 fails in the same ways as 1.6.5 / webhelpers
0.2.3dev-r1612, with that nasty empty request.params error.

So the current status of prototype.js is:

from webhelpers 0.2.2: BAD
from webhelpers 0.2.3dev-r1612: VERY BAD
from scriptaculous 1.6.4: GOOD
from scriptaculous 1.7.0_beta2: unfortunately still VERY BAD


Cheers,




--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: pase 1.1 troubles (solution)

2006-12-21 Thread James Gardner


Hi Ian,

I'd like to release a new version of Paste with these Windows fixes 
before I leave for vacation on Friday.  So maybe best to leave off the 
directory indexes for now.


I've checked in a new version of the code that doesn't use your 
recursive technique. Hope that's OK.


Cheers,

James




--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pudge troubles

2006-12-20 Thread James Gardner


Hi,

You'll need Kid==0.9.3 (0.9.4 doesn't work) and you'll need to remove 
all the .pyc files in docs/pudge_template too.


Once I've done this the main docs compile nicely, thanks Ben. I get the 
following warning though:


C:\Documents and 
Settings\James\Desktop\SVN\pylonshq.com\Pylons\trunk\docs\pudge
_template\common.py:326: SyntaxWarning: name 'top_level_module' is 
assigned to before global declaration


This prevents any of the module docs compiling.

Any ideas how to tweak common.html so that top_level_module is defined 
Ben? Does this not happen for you? Which version of Kid to you have?


Cheers,

James


Ben Bangert wrote:


Ok Stephen, update Pylons svn, and the pudge docs should build now.  The 
last tweaks needed were applied a little earlier today.


Cheers,
Ben



 



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: pase 1.1 troubles (solution)

2006-12-20 Thread James Gardner


Hi Jose,

I've tried your suggestion of using:

self.directory = os.path.normpath(directory)

and that works fine too so I'll check that in instead if you'd prefer?

James Gardner wrote:
 At the moment if I put in a URL which resolves to a directory this
 code kicks in (line 460 of paste.urlparser):

 if os.path.isdir(full):
 # @@: Cache?
 child_root = self.root_directory is not None and \
 self.root_directory or self.directory
 return self.__class__(full, root_directory=child_root,
cache_max_age=self.cache_max_age)(environ,
start_response)


Ian Bicking wrote:
 Huh... it's supposed to do the recursive traversal of directories.  So
 it just creates another instance of StaticURLParser that points to the
 subdirectory, and then passes the request off to that.

I don't understand why you'd ever want to do this? It only ever gets 
called if the URL maps to a directory and if that is the case it should 
return a 403. I'll change it.


 It doesn't seem to have reasonable behavior when a StaticURLParser
 instance is asked to serve itself, not a subfile.  Probably it should
 return 403 Forbidden in that case

Should it do this rather than 404? I only ask because it is used in the 
config/middleware.py Cascade and if a 403 is returned, other parts of 
the app won't get called but if this is the correct behavior that's fine.


Cheers,

James





Dear James,
I was wondering if you'd had time to investigate the strange redirects?
Are you happy with your checked in code? I was going to upgrade to the
svn version of paste to get the updates but wanted to check to see what
the status was
Jose

On Dec 18, 10:20 am, James Gardner [EMAIL PROTECTED] wrote:

Hi all,

I've checked in some changes to paste.urlparser to work with Windows but
I've noticed a problem with certain URLs now redirecting to themselves
which I'm investigating.

Cheers,

James

programmer.py wrote:
 Oh, I think this is what you really wanted to know about normpath...

 os.path.normpath(r'c:/tmp/pylons-sandbox/helloworld')
 'c:\\tmp\\pylons-sandbox\\helloworld'

 It does seem to fix the path separator on windows.

 jw

 On Dec 18, 11:51 am, programmer.py [EMAIL PROTECTED] wrote:
 fwiw, im on windows -

 import os.path
 
os.path.normpath(r'c:\tmp\pylons-sandbox\helloworld')'c:\\tmp\\pylons-sandbox\\helloworld' 


 Also, Ian is right, the problem is in urlparser.py ...  I printed out
 the `full' and self.root_directory before the check @457 and got -

 c:\tmp\pylons-sandbox\helloworld\helloworld\public\index.html
 c:/tmp/pylons-sandbox/helloworld/helloworld/public

 ouch.

 Thanks all!
 jw

 On Dec 18, 10:47 am, Ian Bicking [EMAIL PROTECTED] wrote:

 James Gardner wrote:
 Hi Jose,
 The problem is that StaticURLParser keeps some variables with / path
 separators and \ characters with others if you don't specify the
 root_directory on Windows.
 The solution on Windows is to specify both the directory and the
 root_directory when setting up the static file parser and ensure 
they

 use Windows \ separators.
 In your Pylons project config/middleware.py change this line:
  static_app = StaticURLParser(..)
 to this:
  static_app = StaticURLParser(
  directory=config.paths['static_files'].replace('/','\\'),
  
root_directory=config.paths['static_files'].replace('/','\\')

  )I suppose in StaticURLParser we could do:
 if os.path.sep != '/':
  directory = directory.replace('/', os.path.sep)
 and ditto root_directory.  Would that resolve the problem?  Does
 os.path.normpath do this replacement on Windows?  That seems like 
a more

 ideal solution.  I'm guessing the reason it isn't working is when it
 tests on urlparser.py:450 full.startswith(self.root_directory) that
 the backslash/slash confusion causes the problem.  That should 
probably

 be updated to at least give a slightly more useful not found message
 (via the optional debug_message argument to not_found).
 Since you are on Windows, can you try these things out?
 --
 Ian Bicking | [EMAIL PROTECTED] |http://blog.ianbicking.org



 



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: pase 1.1 troubles (solution)

2006-12-20 Thread James Gardner


Hi Ian,


self.directory = os.path.normpath(directory)

I think that makes sense.


Great.


This is how subdirectories are handled:

  SCRIPT_NAME=''; PATH_INFO='/foo/bar/baz.html'
  maps to app StaticURLParser('/www')

That in turn forwards the request as:

  SCRIPT_NAME='/foo'; PATH_INFO='/bar/baz.html'
  maps to app StaticURLParser('/www/foo')

And so forth, until you get to a real file.

But if you end up at a directory instead of a file, it isn't working.


Ahh right, makes sense. I'll try and track down the problem.

404 would be okay, I guess, though the actual error message should say 
something different so people realize why they get a 404.  Apache gives 
a 403, though IMHO that's probably a bad convention.  It's only 
Forbidden in Apache because indexes weren't turned on, but calling 
enabling indexes a permission (that can be revoked) doesn't make any 
sense.  So sure, 404 with a message No index file displayed for 
directories or something like that.  Alternately we could display 
index.html (probably based on a class method, or something passed to the 
constructor, which would be a list of index filenames -- but I'm also 
fine leaving it out so long as the 404 is sent in a special method that 
can be overridden).


Yup. I'd prefer 404 too so we'll go with that. I'll have a look at 
adding some options for directory indexes too, probably tomorrow now.


Cheers,

James


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: new project and so many files

2006-12-19 Thread James Gardner

Hi Max,

 Is it really necessarily? Is it because no one yet figured out how to
 simplify things or this approach does provide some benefits?

Well, it's a simple case of trying to make things as simple as possible 
but leaving everything in there that a developer is actually going to use.

If the default is too much for you there is also a pylons-minimal 
template in development. You can try it as it stands like this:

easy_install -U Pylons==dev
paster create --template=pylons_minimal TestProject

Perhaps there is more we could do to reduce code in the default template 
though.

 Now there is a pile code developer may never touch but the framework
 still expects it to work and have no control over it. E.g. any changes
 in framework' APIs should take this into account.

That's true but because Pylons is made from middleware it is fairly easy 
to make API changes that don't affect existing code too much.

 May be it's just me, but Robaccia(*) approach feels much better: you
 start with a clean state and add cruft as needed.  I remember Python
 people ditching Java frameworks for being too verbose and bragging
 about zero-configuration Python apps.

I think you are preaching to the converted a bit here because most 
people on this list would agree with you!

The Pylons developers have been pushing the WSGI standard and working 
hard to adapt existing code to work as middleware so that you can put 
together whatever configuration of tools you like, Robaccia being a good 
example.

The whole point of our efforts on all the various projects we work on is 
to give you all this flexibility to produce your own setup *and* also to 
provide you with a useful default setup in Pylons that you can change if 
you like.

Cheers,

James


--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: AuthKit: code typo

2006-12-18 Thread James Gardner

Hi Bill,

Thanks, I've fixed this now.

Cheers,

James

Bill wrote:
 http://authkit.org/trac/browser/AuthKit/trunk/authkit/authenticate/__init__.py#L327
 references AuthConfigError instead of AuthKitConfigError:
 
 #
 # Configure the config files
 #
 
 if config_file and config_paste:
 raise AuthConfigError(HERE
 'Please specify a conf_paste dictionary or a
 config_filename '
 'but not both'
 )
 
 Cheers,
 Bill
 
 
  


--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: pase 1.1 troubles

2006-12-18 Thread James Gardner

Hi Jose,

I get the same problem. No doubt something to do with Windows paths. 
First thing to do is see if it is a Pylons or Paste problem so I'll do 
some checks.

Cheers,

James

 I just tried the removing all the spaces from my paths and it still does
 not work. I'm also not getting much in the way of helpful error messages
 so I really can't provide much more info.  Here is my setup, just to see
 if that helps:

 OS winXP sp2
 processer AMD Athlon 64 3200+
 memory 2 GIG
 AV  bitdefender 10

 test: 
 from the command prompt I typed
 paster create --template=pylons space
 cd space
 paster serve development.ini

 opened browser to localhost:5000 and I get a 404 error

 Any ideas how to debug this? everything worked fine with 1.0, I've not
 tried the 1.0.1 yet but will and report back
 Jose

   
 It works as expected with paste 1.0.1 but not 1.1.  this is with nothing
 odd in the urls or paths only normal ascii and no spaces.  what should I
 look at to hunt down the problem?
 Jose
 
  


--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: pase 1.1 troubles (solution)

2006-12-18 Thread James Gardner

Hi Jose,

The problem is that StaticURLParser keeps some variables with / path 
separators and \ characters with others if you don't specify the 
root_directory on Windows.

The solution on Windows is to specify both the directory and the 
root_directory when setting up the static file parser and ensure they 
use Windows \ separators.

In your Pylons project config/middleware.py change this line:

 static_app = StaticURLParser(..)

to this:

 static_app = StaticURLParser(
 directory=config.paths['static_files'].replace('/','\\'),
 root_directory=config.paths['static_files'].replace('/','\\')
 )

Then everything should work.

Cheers,

James


James Gardner wrote:
 Hi Jose,
 
 I get the same problem. No doubt something to do with Windows paths. 
 First thing to do is see if it is a Pylons or Paste problem so I'll do 
 some checks.
 
 Cheers,
 
 James
 
 I just tried the removing all the spaces from my paths and it still does
 not work. I'm also not getting much in the way of helpful error messages
 so I really can't provide much more info.  Here is my setup, just to see
 if that helps:

 OS winXP sp2
 processer AMD Athlon 64 3200+
 memory 2 GIG
 AV  bitdefender 10

 test: 
 from the command prompt I typed
 paster create --template=pylons space
 cd space
 paster serve development.ini

 opened browser to localhost:5000 and I get a 404 error

 Any ideas how to debug this? everything worked fine with 1.0, I've not
 tried the 1.0.1 yet but will and report back
 Jose

   
 It works as expected with paste 1.0.1 but not 1.1.  this is with nothing
 odd in the urls or paths only normal ascii and no spaces.  what should I
 look at to hunt down the problem?
 Jose

 
 
  


--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: pase 1.1 troubles

2006-12-18 Thread James Gardner

Hi jw,

You probably don't want to do that though because of the potential 
security issue in that version of Paste. Just modify your 
config/middleware.py file as I described in my last email and everything 
should work.

Cheers,

James



programmer.py wrote:
 I had the same problem as Jose.  I'm using windows also.  I downgraded
 to Paste 1.0.1 and it works.
 
 jw
 
 On Dec 18, 8:04 am, James Gardner [EMAIL PROTECTED] wrote:
 Hi Jose,

 I get the same problem. No doubt something to do with Windows paths.
 First thing to do is see if it is a Pylons or Paste problem so I'll do
 some checks.

 Cheers,

 James

 I just tried the removing all the spaces from my paths and it still does
 not work. I'm also not getting much in the way of helpful error messages
 so I really can't provide much more info.  Here is my setup, just to see
 if that helps:
 OS winXP sp2
 processer AMD Athlon 64 3200+
 memory 2 GIG
 AV  bitdefender 10
 test:
 from the command prompt I typed
 paster create --template=pylons space
 cd space
 paster serve development.ini
 opened browser to localhost:5000 and I get a 404 error
 Any ideas how to debug this? everything worked fine with 1.0, I've not
 tried the 1.0.1 yet but will and report back
 Jose
 It works as expected with paste 1.0.1 but not 1.1.  this is with nothing
 odd in the urls or paths only normal ascii and no spaces.  what should I
 look at to hunt down the problem?
 Jose
 
 
  


--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: pase 1.1 troubles (solution)

2006-12-18 Thread James Gardner

Hi all,

I've checked in some changes to paste.urlparser to work with Windows but 
I've noticed a problem with certain URLs now redirecting to themselves 
which I'm investigating.

Cheers,

James

programmer.py wrote:
 Oh, I think this is what you really wanted to know about normpath...
 
 os.path.normpath(r'c:/tmp/pylons-sandbox/helloworld')
 'c:\\tmp\\pylons-sandbox\\helloworld'
 
 It does seem to fix the path separator on windows.
 
 jw
 
 On Dec 18, 11:51 am, programmer.py [EMAIL PROTECTED] wrote:
 fwiw, im on windows -

 import os.path
 os.path.normpath(r'c:\tmp\pylons-sandbox\helloworld')'c:\\tmp\\pylons-sandbox\\helloworld'
 Also, Ian is right, the problem is in urlparser.py ...  I printed out
 the `full' and self.root_directory before the check @457 and got -

 c:\tmp\pylons-sandbox\helloworld\helloworld\public\index.html
 c:/tmp/pylons-sandbox/helloworld/helloworld/public

 ouch.

 Thanks all!
 jw

 On Dec 18, 10:47 am, Ian Bicking [EMAIL PROTECTED] wrote:

 James Gardner wrote:
 Hi Jose,
 The problem is that StaticURLParser keeps some variables with / path
 separators and \ characters with others if you don't specify the
 root_directory on Windows.
 The solution on Windows is to specify both the directory and the
 root_directory when setting up the static file parser and ensure they
 use Windows \ separators.
 In your Pylons project config/middleware.py change this line:
  static_app = StaticURLParser(..)
 to this:
  static_app = StaticURLParser(
  directory=config.paths['static_files'].replace('/','\\'),
  root_directory=config.paths['static_files'].replace('/','\\')
  )I suppose in StaticURLParser we could do:
 if os.path.sep != '/':
  directory = directory.replace('/', os.path.sep)
 and ditto root_directory.  Would that resolve the problem?  Does
 os.path.normpath do this replacement on Windows?  That seems like a more
 ideal solution.  I'm guessing the reason it isn't working is when it
 tests on urlparser.py:450 full.startswith(self.root_directory) that
 the backslash/slash confusion causes the problem.  That should probably
 be updated to at least give a slightly more useful not found message
 (via the optional debug_message argument to not_found).
 Since you are on Windows, can you try these things out?
 --
 Ian Bicking | [EMAIL PROTECTED] |http://blog.ianbicking.org
 
 
  


--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Recent i18n Pylons changes

2006-12-14 Thread James Gardner

We all seem to be having different suggestions here.

The issues were:

1. Whether to drop the h. prefix
2. Whether to point h._ to ugettext rather than gettext
3. How to integrate the aquarium code

The current opinion seems to be edging towards:

1. keep _() in the global namespace and as h._ but point it to ugettext()
2. have the internationalization functions in the global namespace
3. leave the aqaurium code until 0.9.5 when the issue have settled down 
a bit

My proposal is this:

1. Deprecate the use of _() and h._(). They will still work in 0.9.4 but 
will print a deprecation warning. In 1.0 (or maybe before) they will be 
removed. We'd push the use of h.gettext(), h.ugettext(), h.ngettext() 
and h.ungettext() and they won't be available in the global namespace, 
it would just clutter things and what happens if we add more functions? 
They are more logical in helpers. Apparently xgettext extracts the h. 
form fine anyway. If people really don't like this they can always 
import the objects from pylons.helpers manually or create new variables 
with which ever spelling they like!

2. 3. same as the current proposal.

If anyone strongly objects to this please pipe up now with detailed 
reasons and we can come to a final consensus.

Cheers,

James

--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: pylons and Apache's DocumentRoot

2006-12-13 Thread James Gardner

Dear Ramon,

It sounds like you are simply bewildered by choice here! Since you are 
serving only 50 requests/day it really doesn't matter which deployment 
technique you use. Here are a load of bullet points which hopefully 
clear up all the various areas you have touched on!

* Pylons doesn't have a server so you serve a Pylons app in whichever 
way you prefer with whichever server

* Pylons is thread safe so you can use multi-threaded as well as 
multi-process server techniques

* Pylons doesn't do any threading itself even though it can be used in a 
multi-threaded environment so life is nice and simple

* One way of deploying a Pylons app is with paster serve. It is useful 
for testing and (with care) can be used for production deployment.

* People who deploy with paster serve typically use Apache with 
ProxyPass so that the visitors don't have to see the port and so that 
they can take advantage of Apache's virtual hosts and mod_rewrite 
capabilities.

* You can also use dedicated reverse proxies such as pound to load 
balance to your running some paster serve apps

* If you deploy a Pylons app using paster serve it is wise to setup a 
cron job to check the server is still running and restart it if 
necessary. I use daemontools as described on the Pylons wiki to achieve 
a similar thing.

* If you are serving a Pylons application you don't need to do anything 
special with static files, Pylons itself handles them for you. Of 
course, if you want Apache to handle them you can set that up too. The 
easiest way is to copy them into your htdocs directory and then setup a 
mod_rewrite rule so that Apache serves from the static directory where 
possible and passes the request on to Pylons where it is not. I'm using 
this for one of my apps, feel free to adapt it for your use:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule   ^([-_a-zA-Z0-9/\.]+)$  /cgi-bin/dispatch.cgi/$1

Something like the above would check the filename first then internally 
redirect the request to the dispatch.cgi file which could serve the 
Pylons app. If you are doing this then the Pylons app will actually be 
at a different location to the URL so you will need some middleware that 
manually alters the environment so it thinks it is running at that 
correct URL and therefore generates links that work before the rewrite.

If you do this you could also disable Pylons' static file support by 
taking the static file app out of the Cascade middleware in 
config/middleware.py since it won't be needed.

 What I (think) I understand
 ---
 Regardless of other intermediate things in between, you (almost)
 always need to have paster serving the thing. If using Apache (at
 least without mod_python), paster MUST be up and running, serving
 things at some address and port. 

Nope, not at all. You don't *need* to have a standalone running server, 
it is just that some people find that the most simple/flexible way.

You can also deploy via CGI, FastCGI or mod_python and more which are 
all described in detail on the wiki.

CGI and FastCGI methods use a dispatch.cgi or dispatch.fcgi file which 
you could put in your rewrite rules for static file.

 However, I am still puzzled by:
 
 Apache is an incredibly mature technology, and having the knowledge
 that when Apache is up, my site is up is quite nice.  by Ben Bangert
 in
 http://groups.google.com/group/pylons-discuss/tree/browse_frm/thread/5de35593c4571633/a1ac095664259688?rnum=1_done=%2Fgroup%2Fpylons-discuss%2Fbrowse_frm%2Fthread%2F5de35593c4571633%2F%3F#doc_ad8deb4f3acec8e1
 
 Is this because of mod_python? Don't they need to have paster running
 underneath?

Exactly, Ben's just saying that if you deploy via Apache you pretty much 
know everything will be working because Apache is good at CGI, FastCGI 
etc where as if you go down the standlaone server (eg paster serve) 
route you need to write some monitoring code to restart the server if it 
fails. Neither should be difficult, it just depends which approach you 
prefer.

 As for connectors, we do not server thousands of short requests a day;
 our apps. take a while to run (5 to 50 minutes) and there are rarely
 more than 20 requests per appl. per day. (I.e., speed is an issues in
 the number crunching code; it is inconsequential in the web-serving
 part). I think plain CGI will be just fine.

Yup, that sounds fine unless your app displays thousands of static files 
because with CGI to serve each static file a new Pylons app will be 
loaded and unloaded. This can be avoided using the mod_rewrite approach 
and having Apache serve your static files.

 But I think we cannot just dump Apache because:
 
 a) We have 7 applications, and right now only 3 or 4 of those would be
 ready to run with Pylons. We need to make sure the others can still
 run. I thought using Pylons via Apache would allow us a non-traumatic
 transition (just re-write the relevant parts of httpd.conf when
 ready).

Keep it 

Re: Recent i18n Pylons changes

2006-12-13 Thread James Gardner

The plan in 0.9.4 is to use h.ugettext() instead of _(). h._() will be 
the same as h.ugettext(). Have you seen the new docs? I think we've 
pretty much agreed on what is in this document now? Most of the 
interesting stuff is at the bottom.

http://pylonshq.com/project/pylonshq/browser/Pylons/trunk/docs/internationalization.txt

Any reason why any of this is a bad idea?

I think discussion is still open as to whether h.ugettext() is better or 
just ugettext().

Cheers,

James



Pedro Algarvio, aka, s0undt3ch wrote:
 What is pylons _() attached to? ugettext?
 Or you explicitly call ugettext and/or ngettext?
 
 
  


--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Using Durus with Pylons

2006-12-12 Thread James Gardner

Hi Mike,

 The globals object is *not* thread-specific!  I suggest you instead
 create the connection in lib/base.py within the __call__.
 
 Then I'll be creating a connection for every request.  Is there no
 better place to do it once per thread?

Well, the thing is Pylons is thread-safe but doesn't actually manage any 
of the creating of the threads itself. Thread creation is handled by 
whichever server is running the Pylons app. This means if you want one 
connection *per thread* rather than *per request* you would probably 
have to set it up in the server part.

For example. If you were using a paste.httpserver you could write your 
own thread handling that added one connection to the environ when each 
thread was created. You would then be able to access the connection in 
your Pylons app via request.environ.

Hope that helps,

James






--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: New tutorials

2006-12-12 Thread James Gardner

Hi Mike,

These look really good! I'm sure people will find them useful.

Many thanks,

James


Mike Orr wrote:
 Here's what I've been up to.  I've written down notes of my study of
 Pylons.  There's a detailed article tracing the code execution of
 QuickWiki, tips for controller actions, and an article on using Durus
 with Pylons.
 
 http://sluggo.scrapping.cc/python/
 
 I've also put a link in the Pylons wiki in the User Contributions -
 Development Tutorials section.
 


--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Error importing kid from example

2006-12-11 Thread James Gardner

Hi Sean,

I expect you are missing the TurboKid package. You can install it 
manually with:

easy_install TurboKid

or, as is the case with all of the optional Pylons packages you can do:

easy_install -U Pylons[kid]

The extras are described here:
http://pylonshq.com/docs/0.9.3/install

I'll update the docs so that this is clearer.

Cheers,

James

Sean Davis wrote:
 I am in the process of moving over from Catalyst on the perl side to 
 Pylons (yeah!!!).  I am working with the simple example code in the Docs 
 to include kid templating.  I have modified the middleware.py file as 
 suggested on that page.  I used easy_install to install kid and can 
 import it just fine using the interpreter.  However, when I try to start 
 the server, I get a TemplateEngineMissing exception (traceback below).  
 What am I missing?  What other information should I provide to help fix 
 this problem?
 
 Thanks,
 Sean
 
 
 paster serve development.ini
 Traceback (most recent call last):
   File /usr/local/bin/paster, line 5, in ?
 pkg_resources.run_script('PasteScript==1.0', 'paster')
   File 
 /usr/local/lib64/python2.4/site-packages/setuptools-0.6c3-py2.4.egg/pkg_resources.py,
  
 line 407, in run_script
 self.require(requires)[0].run_script(script_name, ns)
   File /usr/local/lib64/python2.4/site-packages/setuptools- 
 0.6c3-py2.4.egg/pkg_resources.py, line 1084, in run_script
 execfile(script_filename, namespace, namespace)
   File 
 /usr/local/lib64/python2.4/site-packages/PasteScript-1.0-py2.4.egg/EGG-INFO/scripts/paster,
  
 line 18, in ?
 command.run()
   File 
 /usr/local/lib64/python2.4/site-packages/PasteScript-1.0-py2.4.egg/paste/script/command.py,
  
 line 76, in run
 invoke(command, command_name, options, args[1:])
   File /usr/local/lib64/python2.4/site-packages/PasteScript- 
 1.0-py2.4.egg/paste/script/command.py, line 115, in invoke
 exit_code = runner.run(args)
   File 
 /usr/local/lib64/python2.4/site-packages/PasteScript-1.0-py2.4.egg/paste/script/command.py,
  
 line 210, in run
 result = self.command()
   File 
 /usr/local/lib64/python2.4/site-packages/PasteScript-1.0-py2.4.egg/paste/script/serve.py,
  
 line 184, in command
 relative_to=base)
   File /usr/local/lib64/python2.4/site-packages/PasteScript- 
 1.0-py2.4.egg/paste/script/serve.py, line 204, in loadapp
 return loadapp(app_spec, name=name, relative_to=relative_to)
   File 
 /usr/local/lib64/python2.4/site-packages/PasteDeploy-1.0-py2.4.egg/paste/deploy/loadwsgi.py,
  
 line 193, in loadapp
 return loadobj(APP, uri, name=name, **kw)
   File 
 /usr/local/lib64/python2.4/site-packages/PasteDeploy-1.0-py2.4.egg/paste/deploy/loadwsgi.py,
  
 line 214, in loadobj
 return context.create()
   File /usr/local/lib64/python2.4/site-packages/PasteDeploy- 
 1.0-py2.4.egg/paste/deploy/loadwsgi.py, line 596, in create
 return self.object_type.invoke(self)
   File 
 /usr/local/lib64/python2.4/site-packages/PasteDeploy-1.0-py2.4.egg/paste/deploy/loadwsgi.py,
  
 line 99, in invoke
 return fix_call(context.object, context.global_conf, 
 **context.local_conf)
   File 
 /usr/local/lib64/python2.4/site-packages/PasteDeploy-1.0-py2.4.egg/paste/deploy/util/fixtypeerror.py,
  
 line 57, in fix_call
 val = callable(*args, **kw)
   File 
 /home/sdavis/sherlock/sdavis/projects/web/helloworld/helloworld/config/middleware.py,
  
 line 33, in make_app
 g=app_globals.Globals)
   File /usr/local/lib64/python2.4/site-packages/Pylons- 
 0.9.3-py2.4.egg/pylons/wsgiapp.py, line 306, in __init__
 app = PylonsBaseWSGIApp(config.map, config.package, g, helpers=helpers)
   File /usr/local/lib64/python2.4/site-packages/Pylons-0.9.3-py2.4.egg 
 /pylons/wsgiapp.py, line 75, in __init__
 alias=e['alias'], **e['template_options'])
   File 
 /usr/local/lib64/python2.4/site-packages/Pylons-0.9.3-py2.4.egg/pylons/templating.py,
  
 line 64, in prepare
 raise TemplateEngineMissing('Please install a plugin for '
 pylons.templating.TemplateEngineMissing: Please install a plugin for 
 kid to use its functionality
 
 
  


--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Error importing kid from example

2006-12-11 Thread James Gardner

Hi Sean,

 Thanks, James.  Just a quick link on that page back to the install 
 instructions would be helpful, although it is quite obvious on the 
 install page that this needs to be done for kid templates to work.

No problem, I've updated the docs with this paragraph:

http://pylonshq.com/project/pylonshq/changeset/1579

Cheers,

James

--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Internationalization - utf-16

2006-12-11 Thread James Gardner

Hi Alagu,

Presumably you have created the binary message catalog with the
following command as described in the docs:

python setup.py lang_compile

If so I have a similar problem. The tutorial works fine with ASCII 
characters but not with Unicode.

I've tried re-writing Python's msgfmt.py file (which Pylons uses) to use 
unicode but I'm not having much luck. It might be worth trying a more 
general Python list because someone must know how to use unicode with 
the built-in Python tools to generate a .mo file but I agree it isn't clear.

The solution might involve using these tools instead of msgfmt.py:
http://www.iro.umontreal.ca/contrib/po-utils/HTML/ because I have a 
feeling it would all work if I could create the correct .mo file.

If you already have a .mo file from elsewhere and compiling it isn't an 
issue, try upgrading to the dev version of Pylons and using h.ugettext() 
instead of _(). You'll need to add:

from pylons.helpers import ugettext.

Let me know how you get on!

Cheers,

James


Alagu Madhu wrote:
 Hello,
 
 
 i18n/
 
 en:
 
 msgid Hello
 msgstr Hello
 
 
 ar(arabic):
 
 msgid Hello
 msgstr عبدالرحمن عبدالله الصبيحي 
 
 
 I am getting the following error when I am using the unicode (utf-16)
 string.
 
 
 Error Traceback
 clear this
 clear this
 Module translate_demo.controllers.hello:17 in index
   resp.write('Default: %sbr /' % _('Hello'))
 for lang in ['en','ar']:
 h.set_lang(lang)
 resp.write(%s: %sbr / % (h.get_lang(), _('Hello')))
 return resp  h.set_lang(lang)
 Module pylons.helpers:93 in set_lang
   raise LanguageError('Language catalog %s not found' % \
 os.path.join(project_name,
 catalog_path))
 translator = egg_translation(project_name,
 lang=catalog_path)
 translator.pylons_lang = lang
 registry.replace(pylons.translator, translator)
 translator = egg_translation(project_name, lang=catalog_path)
 Module pylons.i18n.translation:14 in egg_translation
   
 class_ = GNUTranslations
 return class_(resource_stream(domain, os.path.join(lang,
 '%s.mo' % domain)))  return class_(resource_stream(domain,
 os.path.join(lang, '%s.mo' % domain)))
 Module gettext:180 in __init__
   self._fallback = None
 if fp is not None:
 self._parse(fp)
 
 def _parse(self, fp):  self._parse(fp)
 Module gettext:337 in _parse
   if self._charset:
 msg = unicode(msg, self._charset)
 tmsg = unicode(tmsg, self._charset)
 catalog[msg] = tmsg
 # advance to next entry in the seek tables
   tmsg = unicode(tmsg, self._charset)
 Module encodings.utf_8:16 in decode
 
 def decode(input, errors='strict'):
 return codecs.utf_8_decode(input, errors, True)
 
 class IncrementalEncoder(codecs.IncrementalEncoder):  return
 codecs.utf_8_decode(input, errors, True)
 type 'exceptions.UnicodeDecodeError': 'utf8' codec can't decode bytes
 in position 0-1: invalid data
 
 
 
 thanks
 
 Madhu Alagu
 
 
  
 


--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Internationalization - utf-16

2006-12-11 Thread James Gardner

Hi Alagu,

OK, I've cracked it. As I suspected there is nothing wrong with the 
implementation in Pylons, it is just that Python's msgfmt.py 
implementation to create the binary catalogs is not even slightly adequate.

The solution is to use GNU gettext or a third party tool to create the 
catalog instead.

There are some good instructions here for wordpress which could be adapted:

http://codex.wordpress.org/Translating_WordPress

I used poEdit from:

http://www.poedit.org/

and did the following:

Install it
Create a new catalog
A dialog pops up:
 Project Info tab: Fill in *all* the fields
 Paths tab:Enter the path of the root of your project
   eg translation_demo
 Keyword tab:  Add the keywords ugettext and gettext

You can then click OK, it will find all the strings and then you can 
enter your translations in whatever charset you chose at in the project 
info tab.

You then save the catalog and rename the .mo file produced to 
translate_demo.mo and put it in the translate_demo/i18n/es/LC_MESSAGES 
directory or whatever is appropriate for your translation.

I've tested it on Windows with your Arabic phrase and it works fine.

Let me know if you have any problems.

Cheers,

James




--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: QuickWiki source

2006-12-08 Thread James Gardner

Hi Mike,

The source is here:
http://pylonshq.com/project/pylonshq/browser/sandbox/examples/QuickWiki

You can check it out with:
svn co http://pylonshq.com/svn/sandbox/examples/QuickWiki

Cheers,

James

Mike Orr wrote:
 Is there a source tarball for QuickWiki available?  I'm particularly
 interested in the setup.py: how it exploits setuptools features. The
 Cheeseshop has only the finished egg, and easy_install -e -b src
 QuickWiki says,
 
 error: Could not find suitable distribution for
 Requirement.parse('QuickWiki')
 


--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons on Ubuntu (with Python 2.5)

2006-12-08 Thread James Gardner

You could try installing Cheetah 1.0 instead. Using the Python 2.5 
version of easy_install and all one line:

easy_install -U 
http://cheeseshop.python.org/packages/source/C/Cheetah/Cheetah-1.0.tar.gz#md5=aaa4907b8877093b9bb11e6cea6b029b

Then try to install Pylons again.

Let me know if that doesn't work.

HTH,

James

3KWA wrote:
 Hi all,
 
 I have successfully installed Pylons on Edgy Eft by just doing:
 
 easy_install -f http://pylonshq.com/download/ Pylons
 
 Now what I would like to do is install it for Python2.5.
 
 I have installed:
 * gcc 3.4
 * python2.5
 * python2.5-dev
 
 using Synaptic, did a ln -s python2.5 python in usr/bin, re-installed
 easy_install just in case and tried to do the same thing i.e:
 
 easy_install -f http://pylonshq.com/download/ Pylons
 
 It seems to be working ok but then crashes miserably trying to compile
 Cheetah.
 
 Any idea what I am doing wrong?
 
 Thanks,
 
 EuGeNe
 
 PS: I am pretty new to Linux so I hope what I am saying makes sense.
 
 PPS: I have tried several times and finally decided to try to log some
 errors which gave (for some reason it stopped before all the warning
 and error started pouring out):
 
 Searching for Pylons
 Best match: Pylons 0.9.3
 Processing Pylons-0.9.3-py2.5.egg
 Pylons 0.9.3 is already the active version in easy-install.pth
 
 Using /usr/lib/python2.5/site-packages/Pylons-0.9.3-py2.5.egg
 Processing dependencies for Pylons
 Searching for Cheetah
 Reading http://www.python.org/pypi/Cheetah/
 Reading http://www.python.org/pypi/Cheetah/1.0
 Reading http://www.CheetahTemplate.org/
 Reading http://www.python.org/pypi/Cheetah/2.0rc7
 Best match: Cheetah 2.0rc7
 Downloading
 http://cheeseshop.python.org/packages/source/C/Cheetah/Cheetah-2.0rc7.tar.gz#md5=8a3749a203719e0de6b0af0e841f5371
 Processing Cheetah-2.0rc7.tar.gz
 Running Cheetah-2.0rc7/setup.py -q bdist_egg --dist-dir
 /tmp/easy_install-aJJ58E/Cheetah-2.0rc7/egg-dist-tmp-6I6ui-
 warning: no files found matching '*.cfg'
 warning: no files found matching 'examples'
 warning: no files found matching 'docs'
 warning: no files found matching 'bin'
 warning: no files found matching '*' under directory 'docs'
 warning: no files found matching '*' under directory 'examples'
 warning: no previously-included files matching '*.pyc' found under
 directory 'src'
 warning: no previously-included files matching '*~' found under
 directory 'src'
 warning: no previously-included files matching '*.aux' found under
 directory 'src'
 warning: no previously-included files matching '*~' found under
 directory 'docs'
 warning: no previously-included files matching '*.aux' found under
 directory 'docs'
 
 
  


--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons on Ubuntu (with Python 2.5)

2006-12-08 Thread James Gardner

OK, this is a bit desperate but download cheetah 1.0, extract it, then 
disable the _namemapper extension by commenting out lines 24-29 of 
SetupConfig.py then run python2.5 setup.py sdist to create a source 
distribution. The file will be in the dist sub directory and then you 
can install your new egg:

easy_install -U Cheetah-1.0.egg

If I'm not mistaken this should install Cheetah without doing the 
compilation and I think it should work without it, just a little slower. 
Then you can install Pylons again.

If that doesn't work you could try looking for an Ubuntu package that 
someone has already made?

Hope it works,

James




3KWA wrote:
 James Gardner wrote:
 You could try installing Cheetah 1.0 instead. Using the Python 2.5
 version of easy_install and all one line:

 easy_install -U
 http://cheeseshop.python.org/packages/source/C/Cheetah/Cheetah-1.0.tar.gz#md5=aaa4907b8877093b9bb11e6cea6b029b
 
 Hi James,
 
 I tried but didn't reach the try installing Pylons again stage as
 Cheetah fails:
 
 Downloading
 http://cheeseshop.python.org/packages/source/C/Cheetah/Cheetah-1.0.tar.gz#md5=aaa4907b8877093b9bb11e6cea6b029b
 Processing Cheetah-1.0.tar.gz
 Running Cheetah-1.0/setup.py -q bdist_egg --dist-dir
 /tmp/easy_install-3_5yGP/Cheetah-1.0/egg-dist-tmp-Q2IkMn
 
 [...]
 
 src/_namemapper.c:456: warning: excess elements in struct initializer
 src/_namemapper.c:456: warning: (near initialization for
 `namemapper_methods[5]')
 src/_namemapper.c: In function `init_namemapper':
 src/_namemapper.c:466: error: `m' undeclared (first use in this
 function)
 src/_namemapper.c:466: error: `d' undeclared (first use in this
 function)
 src/_namemapper.c:466: error: `pprintMod' undeclared (first use in this
 function)
 src/_namemapper.c:466: warning: left-hand operand of comma expression
 has no effect
 src/_namemapper.c:466: warning: left-hand operand of comma expression
 has no effect
 src/_namemapper.c:469: error: syntax error before ')' token
 src/_namemapper.c:479: error: syntax error before ')' token
 src/_namemapper.c:479: error: syntax error before ')' token
 src/_namemapper.c:479: error: syntax error before ')' token
 src/_namemapper.c: In function `wrapInternalNotFoundException':
 src/_namemapper.c:95: warning: statement with no effect
 src/_namemapper.c: In function `init_namemapper':
 src/_namemapper.c:466: warning: statement with no effect
 error: Setup script exited with error: command 'gcc' failed with exit
 status 1
 
 I am in the dark ... :(
 
 Thanks for your help,
 
 EuGeNe
 
 
  


--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: set up a host to provider Pylons service

2006-12-06 Thread James Gardner

Hi Thomas,

I didn't quite understand your question but if you are looking for a
Pylons web hosting company I can highly recommend WebFaction
www.webfaction.com. They have a web-based control panel app that sets
you up with a Pylons app quickly and easily. Mention Pylons when you
sign up and they will make a contribution back to the Pylons project too.

http://pylonshq.com/docs/0.9.3/hosting.html

Best wishes,

James

Thomas Che wrote:
 Hi, All
 I want to set up a host to provider Pylons service. I just need it has
 basic functions.
 you can login it, and you can put your Pylons application to a specific
 position, then you can visit your web application.
 I am weak in it, can you give me some suggestions? I am hurried.
 Thanks!
 
 Best Regards,
 Thomas
 
 
  


--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: who can give me a simple database demo?

2006-12-04 Thread James Gardner

Hi Thomas,

Have you seen these:

http://pylonshq.com/docs/0.9.3/quick_wiki.html
http://pylonshq.com/project/pylonshq/wiki/SqlAlchemyWithPylons

You could also do it directly without using SQLAlchemy.

HTH,

James

Thomas Qi wrote:
 Hi, All
 I want to use Pylons to do a simple page, it should contains how can I
 get the data from database and show them.
 thanks!
 
 Best Regards,
 Thomas
 
 
  


--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



  1   2   >