Re: How to set object parameters nicely?

2009-12-02 Thread allen.fowler
On Dec 2, 6:36 pm, Carl Banks wrote: > For the record, I don't really agree that a lot of parameters is code > smell.  It's maybe a red flag that you are doing too much in one > function and/or class, but nothing inherently shady. > > One thing to ask yourself: are there a lot of combinations of

Re: How to set object parameters nicely?

2009-12-02 Thread allen.fowler
> >>> Is there a better way to do this? > >> class MyOb(object): > >>      def __init__(self, **kwargs): > >>          self.__dict__.update(kwargs) > > >> ob1 = MyOb(p1="Tom", p3="New York") > >> ob2 = MyOb(p1="Joe", p2="j...@host", p3="New Jersey") > > > I've tried this, but have found two issues:

Re: How to set object parameters nicely?

2009-12-01 Thread allen.fowler
> > Is there a better way to do this? > > class MyOb(object): >      def __init__(self, **kwargs): >          self.__dict__.update(kwargs) > > ob1 = MyOb(p1="Tom", p3="New York") > ob2 = MyOb(p1="Joe", p2="j...@host", p3="New Jersey") I've tried this, but have found two issues: 1) I can't set de

How to set object parameters nicely?

2009-12-01 Thread allen.fowler
Hello, I've got a bunch of code that looks something like: class MyOb(object): def __init__(self, p1=None, p2=None, p3=None, ...): self.p1 = p1 self.p2 = p2 self.p3 = p3 self.pN = ... ob1 = MyOb(p1="Tom", p3="New York") ob2 = MyOb(p1="Joe", p2="j...@host", p3="New Jersey") ..

Edit MP4 and/or WMV file metadata?

2008-03-04 Thread allen.fowler
Hello, I have many WMV files with bad embedded author/title/date information. However, the correct information is correctly encoded in the file name.. i.e. "title-author-date.wmv" I am about to conver these fiiles to MP$ for use on an iPod. The video software I am using will, I think, transfer t

Re: CGI and external JavaScript nightmare

2007-10-17 Thread allen.fowler
> > One CGI question - since all of my CGIs are spitting out HTML is their > source code safe? wget and linking to the source deliver the output > HTML. Are there any other methods of trying to steal the source CGI I > need to protect against? > > Thank you. Not sure I fully understand the questi

Re: Simple HTML template engine?

2007-10-15 Thread allen.fowler
CherryPy looks nice... though I am just looking to generate static reports. Thanks anyway... I'll keep it in mind for the future. On Oct 15, 4:38 am, "Ciprian Dorin Craciun" <[EMAIL PROTECTED]> wrote: > Have you tried CherryPy?http://www.cherrypy.org/ > > It's not a template engine, but a

Re: Simple HTML template engine?

2007-10-15 Thread allen.fowler
On Oct 15, 1:26 am, John Nagle <[EMAIL PROTECTED]> wrote: > allen.fowler wrote: > > Hello, > > > Can anyone recommend a simple python template engine for generating > > HTML that relies only on the Pyhon Core modules? > > > No need for caching, template compi

Re: Simple HTML template engine?

2007-10-15 Thread allen.fowler
On Oct 15, 1:26 am, John Nagle <[EMAIL PROTECTED]> wrote: > allen.fowler wrote: > > Hello, > > > Can anyone recommend a simple python template engine for generating > > HTML that relies only on the Pyhon Core modules? > > > No need for caching, template compi

Re: Simple HTML template engine?

2007-10-15 Thread allen.fowler
CherryPy looks nice... though I am just looking to generate static reports. Thanks anyway... I'll keep it in mind for the future. On Oct 15, 4:38 am, "Ciprian Dorin Craciun" <[EMAIL PROTECTED]> wrote: > Have you tried CherryPy?http://www.cherrypy.org/ > > It's not a template engine, but a

Simple HTML template engine?

2007-10-14 Thread allen.fowler
Hello, Can anyone recommend a simple python template engine for generating HTML that relies only on the Pyhon Core modules? No need for caching, template compilation, etc. Speed is not a major issue. I just need looping and conditionals. Template inheritance would be a bonus. I've seen Genshi

Re: Exceptions: Logging TB and local variables?

2007-10-10 Thread allen.fowler
> Two possibilieies: > > You will need to determine ALL the exceptions that the 3rd party party modules > can raise. If they are custom exceptions you will need to import them into > your > application from their modules. > > example: > > say that 3rd party modules raise TransientError, IOError,

Exceptions: Logging TB and local variables?

2007-10-09 Thread allen.fowler
Hi, My code looks like this: for item in bigset: self.__sub1(item) self.__sub2(item) self.__sub3(item) # the subX functions, in turn, use various 3rd party modules. Now, I would like to do this: for item in bigset: try: self.__sub1(item) self.__sub2(item) self.__sub3(item)