Re: Addind imports to a class namespace

2009-07-13 Thread Ryan K
Thank you for your replies. I have factored out the dependency and everything is solved. Cheers, Ryan -- http://mail.python.org/mailman/listinfo/python-list

Re: Addind imports to a class namespace

2009-07-11 Thread Ryan K
Thanks for your help Peter. I'm thinking that perhaps this isn't a circular import and that I don't understand importing. Here is a better explanation of my case (I am using Django): I have file x.py that declares classes A, B, C. There is also a file y.py that contains two methods T, U and the

Re: Addind imports to a class namespace

2009-07-11 Thread Ryan K
Okay so below is the acutal code. I am starting to think there is no reason why I can't install the post_save signal in signals.py itself and thereby avoid this issue entirely. models.py: class Link(CommonAbstractModel): ... class Menu(CommonAbstractModel): class

Addind imports to a class namespace

2009-07-10 Thread Ryan K
Greetings, In order to avoid circular imports, I have a class that I want to improve upon: Class GenerateMenuXhtml(threading.Thread): Subclasses a threading.Thread class to generate a menu's XHTML in a separate thread. All Link objects that have this menu associated with it are

Validating cElementTrees with lxml

2008-02-16 Thread Ryan K
If I have a cElementTree.ElementTree (or the one from the Standard Library), can I use lxml's validation features on it since it implements the same ElementTree API? Thanks, Ryan -- http://mail.python.org/mailman/listinfo/python-list

Stripping whitespace

2008-01-23 Thread ryan k
Hello. I have a string like 'LNAME PASTA ZONE'. I want to create a list of those words and basically replace all the whitespace between them with one space so i could just do lala.split(). Thank you! Ryan Kaskel -- http://mail.python.org/mailman/listinfo/python-list

Re: Stripping whitespace

2008-01-23 Thread ryan k
On Jan 23, 2:04 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Wed, 23 Jan 2008 10:50:02 -0800, ryan k wrote: Hello. I have a string like 'LNAME PASTA ZONE'. I want to create a list of those words and basically replace all the whitespace between them with one space

Re: Stripping whitespace

2008-01-23 Thread ryan k
I am taking a database class so I'm not asking for specific answers. Well I have this text tile: http://www.cs.tufts.edu/comp/115/projects/proj0/customer.txt And this code: # Table and row classes used for queries class Row(object): def __init__(self, column_list, row_vals): print

Re: Stripping whitespace

2008-01-23 Thread ryan k
On Jan 23, 2:53 pm, John Machin [EMAIL PROTECTED] wrote: On Jan 24, 6:17 am, ryan k [EMAIL PROTECTED] wrote: I am taking a database class so I'm not asking for specific answers. Well I have this text tile: http://www.cs.tufts.edu/comp/115/projects/proj0/customer.txt Uh-huh, column

Re: Stripping whitespace

2008-01-23 Thread ryan k
On Jan 23, 3:02 pm, John Machin [EMAIL PROTECTED] wrote: On Jan 24, 6:57 am, ryan k [EMAIL PROTECTED] wrote: So yea i will just have to count dashes. Read my lips: *you* counting dashes is dumb. Writing your code so that *code* is counting dashes each time it opens the file is smart. Okay

Re: Stripping whitespace

2008-01-23 Thread ryan k
On Jan 23, 5:37 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Wed, 23 Jan 2008 11:05:01 -0800, Paul Rubin wrote: ryan k [EMAIL PROTECTED] writes: Hello. I have a string like 'LNAME PASTA ZONE'. I want to create a list of those words and basically replace

Re: Stripping whitespace

2008-01-23 Thread ryan k
On Jan 23, 5:37 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Wed, 23 Jan 2008 11:05:01 -0800, Paul Rubin wrote: ryan k [EMAIL PROTECTED] writes: Hello. I have a string like 'LNAME PASTA ZONE'. I want to create a list of those words and basically replace

Re: Stripping whitespace

2008-01-23 Thread ryan k
On Jan 23, 6:30 pm, John Machin [EMAIL PROTECTED] wrote: On Jan 24, 9:50 am, ryan k [EMAIL PROTECTED] wrote: Steven D'Aprano, you are a prick. And your reasons for coming to that stridently expressed conclusion after reading a posting that was *not* addressed to you are .? Because his

Displaying future times

2007-10-17 Thread ryan k
I have a schedule of times in the future that I want to display in a timezone the user sets. There is a useful module http://www.purecode.com/~tsatter/python/README.txt (at that URL) with a function that takes seconds from the epoch and a time zone and returns what is basically a datetime object.

Displaying future times

2007-10-17 Thread ryan k
I have a schedule of times in the future that I want to display in a timezone the user sets. There is a useful module http://www.purecode.com/~tsatter/python/README.txt (at that URL) with a function that takes seconds from the epoch and a time zone and returns what is basically a datetime object.

Re: Displaying future times

2007-10-17 Thread ryan k
On Oct 17, 1:52 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Wed, 17 Oct 2007 12:20:06 +, ryan k wrote: I have a schedule of times in the future that I want to display in a timezone the user sets. There is a useful module http://www.purecode.com/~tsatter/python

Embedding interactive interpreter

2007-06-05 Thread Ryan K
Hi. I am trying to embed an interactive interpreter in a C++ application. I need to capture the output of int PyRun_InteractiveOne(FILE *fp, const char *filename). Is redirecting sys.stdout and sys.stderr after initializing the interpreter the best way to do this? Thanks, Ryan --

text wrapping help

2007-02-28 Thread Ryan K
I'm trying to text wrap a string but not using the textwrap module. I have 24x9 matrix and the string needs to be text wrapped according to those dimensions. Is there a known algorithm for this? Maybe some kind of regular expression? I'm having difficulty programming the algorithm. Thanks, Ryan

Re: text wrapping help

2007-02-28 Thread Ryan K
wrap_text(sample_text, 24) /pre It doesn't even run but when I go through it interactively it seems okay. Once again, any help is appreciated. On Feb 28, 7:06 pm, Ryan K [EMAIL PROTECTED] wrote: I'm trying to text wrap a string but not using the textwrap module. I have 24x9 matrix

Re: text wrapping help

2007-02-28 Thread Ryan K
That works great but I need to replace the newlines with 24-(the index of the \n) spaces. On Feb 28, 8:27 pm, [EMAIL PROTECTED] wrote: On Feb 28, 4:06 pm, Ryan K [EMAIL PROTECTED] wrote: I'm trying to text wrap a string but not using the textwrap module. I have 24x9 matrix and the string

Help with dbm TypeError

2006-01-09 Thread ryan k
I am writing a web application for mod_python that catalogs my home (book) library. For now, I am using the Python dbm module to store string representations of mod_python's req.form (using the mod_python.publisher handler) using unique IDs as keys. In the .db file, there is a key 'next' that