Re: Is the DoesNotExist exception the only way to check if an object exists?

2010-04-09 Thread Kevin Teague
There is nothing exceptional about exceptions in Python. McDonc does a good job at explaining how to think about exceptions as less than exceptional: http://plope.com/Members/chrism/exceptions_arent_errors/view The only arguably exceptional part is that ideally the ORM would raise a plain

Re: django buildout trouble

2010-03-17 Thread Kevin Teague
> > I think it is a path problem, since the /polls/ part of the running site > can't find views and the /admin part can't find views. > > I'm looking into why buildout would leave the pythonpath incomplete > and think it is just a buildout.cfg problem.  The same site structure worked > in a

Re: Got Django and Buildout working, but what about PIL and Postgres?

2010-01-06 Thread Kevin Teague
This is what I use for PostgreSQL and psycopg2 installation with Buildout: First, adjust the eggs to pull-in a custom-built psycopg2 egg: eggs = ${psycopg2:egg} ${buildout:eggs} Then for psycopg2 do: [psycopg2] recipe = zc.recipe.egg:custom egg = psycopg2 include-dirs =

Re: database password in settings.py

2010-01-05 Thread Kevin Teague
The keyring library provides an easy way of using passwords stored securely in your Keychain|Wallet|Keyring. I use it and it works Very Nicely(TM): http://pypi.python.org/pypi/keyring -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: virtualenv, PIP, fabric and patches to external projects

2009-11-24 Thread Kevin Teague
With patching Python code, there is always the option of dynamically modifying the code at run-time ... aka doing it monkey style. You can do this in a bit more orderly fashion by using something like the 'monkey' package, which lets you use a signature on the function being packaged, so that you

Re: Use one project for a blog, forums, and custom application?

2009-10-16 Thread Kevin Teague
This isn't Django-specific, but to simplify things, you may want to go for: mysite.com/blog mysite.com/forums mysite.com/custom Since browsers send authentication based on the domain, if you use different sub-domains for each app in a web site, it will be necessary to login (albiet using the

Re: Form processing using bash script

2009-10-06 Thread Kevin Teague
On Oct 6, 12:02 pm, Carlos Gustavo wrote: > Thanks Kevin, > > I would give it a shot. Doesn't sound as easy as I had hoped. :-) > To make things even harder, keep in mind that any data gotten from the HTTP request which is passed on to a shell call as an argument must

Re: Form processing using bash script

2009-10-06 Thread Kevin Teague
Use the os.subprocess module in the python standard library to invoke the bash script from your django view code: http://docs.python.org/library/subprocess.html Although in my experience, when there is a bash script wrapping a number of calls to other programs, I tend to find it easier to work

Re: Designing django projects.

2009-10-05 Thread Kevin Teague
On Oct 5, 3:53 pm, nbv4 wrote: > Also, once I do find a designer, how are they going to submit their > work? The django template was designed to be ultra simple and designer > friendly, but that whole philosophy is underminded by the fact that in > order to get the system

Re: How do I create project independent apps.

2009-10-05 Thread Kevin Teague
On Oct 5, 6:45 am, Johan wrote: > Actually the TEMPLATE_DIRS does nothing. In order to get my apps to > work outside of the project directory I edited the manage.py file and > added : > > import sys > sys.path.append('..\\..\\..\\django-apps\\trunk') > > This allows me to

Re: are django applications portable?

2009-09-25 Thread Kevin Teague
On Sep 25, 9:59 am, dijxtra wrote: > Hi everybody, > > Django applications, as I understood them should be pluginable on > project basis. That is, I should be able to install them to my > *project*, not to my django installation. So I downloaded django- > tagging and run the

Re: where to place import statements

2009-09-24 Thread Kevin Teague
imports don't usually take up too much memory. I'd guess that even importing a very large number of modules isn't going to grow your process size by more than 10 MB. imports are only evaluated once. So if you nest the import into a view, your process will be smaller until the first time that

Re: Automated Functional Testing

2009-07-10 Thread Kevin Teague
Yes, how many times have you followed the practice of: 1. write some new code 2. (re)start dev server and/or update dev database 3. tab over to your browser and click away 4. tab back to terminal to see the traceback when you hit an error With a functional test suite, it becomes sooo

Re: Hard linking an image

2009-06-25 Thread Kevin Teague
Presumably you already have all of the data required to generate a chart on the server? If so, then store the chart data in a model, and just reference it by id. e.g. (or w/ a pretty URL: ) And create a Chart object and store it before sending out the HTML response. Then update your chart

Re: Update an object with a dictionary

2009-06-10 Thread Kevin Teague
__dict__ is an attribute of every Python object. It's typically only an internal detail, and generally not accessed directly. One area where __dict__ modification would differ from attribute access is with an attribute that's a property. Modifying the __dict__ would ignore the property

Re: Update an object with a dictionary

2009-06-10 Thread Kevin Teague
On Jun 10, 9:27 am, Paolo Corti wrote: > Hi > is it possible to update an object with a dictionary? > > I tried something like this: > myobject.save(force_update=True, **my_dict) > > getting an error, though: > TypeError at ... > save() got an unexpected keyword argument

Re: conventions for adding pluggable apps to Django

2009-04-21 Thread Kevin Teague
To answer the question in terms of Python packaging (typically consuming Django apps isn't going to differ from consuming any other python package) ... On Apr 21, 11:44 am, Bryan Wheelock wrote: > I have a question about using Pluggable apps with Django. > > My

Re: Three Physical Tiers

2009-03-05 Thread Kevin Teague
On Mar 4, 12:21 pm, ruffeo wrote: > Does anyone know how to develop a complex django project in a 3 tiered > network environment, still using the MCV architecture? > > I.E. Web Server (view and control code), App Server (model code), and > Database Server You have to

Re: Location of files that are part of my application

2009-03-03 Thread Kevin Teague
The __file__ attribute of a module can be used as a starting point for getting at data files within a python package. However, packages can be installed in zipped format, so if you need to account for this you can use the pkg_resources module in setuptools:

Re: Versioning/revisioning content (a la Mediawiki)

2009-02-25 Thread Kevin Teague
On Feb 25, 3:33 pm, Horst Gutmann wrote: > Or you could leave the versioning to dedicated tools like bzr and git > and use django-rcsfield :-) > > http://code.google.com/p/django-rcsfield/ > I'm not sure what you gain from using a VCS for storing versions? They're

Re: Questions on packaging a project and naming conventions

2008-10-18 Thread Kevin Teague
I think there are two issues at play here: 1. Separate your site or application into multiple Python projects to promote re-usability, maintainability, extensibility. 2. Place your packages within a top-level package to prevent namespace collisions to increase re-usability. Note there is a

Re: Help: Running 1.0 and 0.96 side by side?

2008-09-12 Thread Kevin Teague
On Sep 12, 10:06 am, "Matt Conrad" <[EMAIL PROTECTED]> wrote: > On Fri, Sep 12, 2008 at 11:15 AM, Jeff Anderson > > <[EMAIL PROTECTED]> wrote: > > You can influence what this list is, by setting the PYTHONPATH > > environmental variable. All you need to do is set your PYTHONPATH > >

Re: What do you use as a build tool (like Ant or make)

2008-09-09 Thread Kevin Teague
There is a list of all Python-based build tools on the python.org wiki: http://wiki.python.org/moin/ConfigurationAndBuildTools I haven't used any of them with Django, but for managing Zope, Plone and Grok based web apps, zc.buildout is the current preferred tool. It's a configuration-based

Re: hanging os.system() when doing pdf generation

2008-05-27 Thread Kevin Teague
Milan Andric wrote: > > Furthermore I just did > > import sys > sys.stderr.write(os.system(cmd)) > sys.stderr.flush() > > to see what the error message from the command is in the production > server log. > > Try using the subprocess module (Python 2.4+) to call your program instead of