Index
2010-03-22 11:13Ed Leafe : [dabo-dev] dabo Commit 5762
2010-03-22 12:15Paul McNett : Re: [dabo-dev] dabo Commit 5762
2010-03-22 12:34Ed Leafe : Re: [dabo-dev] dabo Commit 5762
2010-03-22 13:01Paul McNett : Re: [dabo-dev] dabo Commit 5762
2010-03-22 13:20Ed Leafe : Re: [dabo-dev] dabo Commit 5762
2010-03-22 15:38Paul McNett : Re: [dabo-dev] dabo Commit 5762
2010-03-22 15:50Ed Leafe : Re: [dabo-dev] dabo Commit 5762
2010-03-22 17:00Paul McNett : Re: [dabo-dev] dabo Commit 5762
Back to top
[dabo-dev] dabo Commit 5762

Author: Ed Leafe

Posted: 2010-03-22 11:13:06   Link

dabo Commit

Revision 5762

Date: 2010-03-22 08:13:05 -0700 (Mon, 22 Mar 2010)

Author: Ed

Trac: http://trac.dabodev.com/changeset/5762

Changed:

U trunk/dabo/dApp.py

Log:

Changed the HomeDirectory setter to write an errorLog entry instead of throwing an exception when an invalid path is passed. Again, this is an issue with moving a cdxml from one system to another.

Diff:

Modified: trunk/dabo/dApp.py

===================================================================

--- trunk/dabo/dApp.py 2010-03-22 14:36:04 UTC (rev 5761)

+++ trunk/dabo/dApp.py 2010-03-22 15:13:05 UTC (rev 5762)

@@ -1450,7 +1450,7 @@

if os.path.exists(val):

self._homeDirectory = os.path.abspath(val)

else:

- raise ValueError(_("%s: Path does not exist.") % val)

+ dabo.errorLog.write(_("Setting App HomeDirectory: Path does not exist. '%s'") % val)

def _getIcon(self):

_______________________________________________

Post Messages to: Dabo-dev@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Searchable Archives: http://leafe.com/archives/search/dabo-dev

This message: http://leafe.com/archives/byMID/20100322151306.58EFE318703@mail.paulmcnett.com

©2010 Ed Leafe
Back to top
Re: [dabo-dev] dabo Commit 5762

Author: Paul McNett

Posted: 2010-03-22 12:15:31   Link

On 3/22/10 8:13 AM, Ed Leafe wrote:

> dabo Commit

> Revision 5762

> Date: 2010-03-22 08:13:05 -0700 (Mon, 22 Mar 2010)

> Author: Ed

> Trac: http://trac.dabodev.com/changeset/5762

>

> Changed:

> U trunk/dabo/dApp.py

>

> Log:

> Changed the HomeDirectory setter to write an errorLog entry instead of throwing an exception when an invalid path is passed. Again, this is an issue with moving a cdxml from one system to another.

Not objecting, just discussing.

If someone is explicitly setting HomeDirectory, but the path doesn't exist, IMO an

exception *should* be raised.

I've never found the need to *set* HomeDirectory.

Not sure what to recommend as I know you've done lots of refactoring of HomeDirectory

lately, but the original intent of HomeDirectory was to be the location of the root

of the application at runtime. That can obviously be different depending on what OS

we are on, where the user decided to install the application, whether we are frozen

into an exe, app, etc. So I guess it doesn't make sense to save HomeDirectory as a

cdxml property in the first place.

But it *does* make sense to me to raise exceptions when the appdev sets properties

incorrectly.

Paul

_______________________________________________

Post Messages to: Dabo-dev@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Searchable Archives: http://leafe.com/archives/search/dabo-dev

This message: http://leafe.com/archives/byMID/4BA797A3.6090000@ulmcnett.com

©2010 Paul McNett
Back to top
Re: [dabo-dev] dabo Commit 5762

Author: Ed Leafe

Posted: 2010-03-22 12:34:39   Link

On Mar 22, 2010, at 12:15 PM, Paul McNett wrote:

> Not objecting, just discussing.

>

> If someone is explicitly setting HomeDirectory, but the path doesn't exist, IMO an

> exception *should* be raised.

>

> I've never found the need to *set* HomeDirectory.

HomeDirectory is now added automatically in the Class Designer, as a way of handling path resolution. We discussed this at PyCon. As usual, though, Windows will store something like 'E:\foo\bar', which will always fail on POSIX systems. I'm looking into a way to make this a little more x-platform, but in the meantime, crashing isn't the best way of handling things.

-- Ed Leafe

_______________________________________________

Post Messages to: Dabo-dev@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Searchable Archives: http://leafe.com/archives/search/dabo-dev

This message: http://leafe.com/archives/byMID/C75ED24D-9080-42B9-869D-6101F700F8D1@leafe.com

©2010 Ed Leafe
Back to top
Re: [dabo-dev] dabo Commit 5762

Author: Paul McNett

Posted: 2010-03-22 13:01:49   Link

On 3/22/10 9:34 AM, Ed Leafe wrote:

> On Mar 22, 2010, at 12:15 PM, Paul McNett wrote:

>

>> Not objecting, just discussing.

>>

>> If someone is explicitly setting HomeDirectory, but the path doesn't exist, IMO an

>> exception *should* be raised.

>>

>> I've never found the need to *set* HomeDirectory.

>

> HomeDirectory is now added automatically in the Class Designer, as a way of handling path resolution. We discussed this at PyCon. As usual, though, Windows will store something like 'E:\foo\bar', which will always fail on POSIX systems. I'm looking into a way to make this a little more x-platform, but in the meantime, crashing isn't the best way of handling things.

I remember listening to the problem you were solving, that HomeDirectory wasn't

resolving correctly in all situations (basically, it was resolving to the location of

ClassDesigner.py instead of to the location of the app being developed, causing a

mismatch between development-time and run-time relative file locations. Since we want

all files to be relative to the HomeDirectory, it's important for the appdev to know

where that HomeDirectory is and to be able to specify it).

But setting HomeDirectory in a portable file just seems like it is going to be prone

to all kinds of trouble, especially if it is absolute (and it needs to be absolute to

have the intended use). The user could install the app anywhere on their system, yet

HomeDirectory is still set to '/home/pmcnett/MyCoolApp', even on Windows where that

path makes no sense.

I just don't think that HomeDirectory is a portable property, and it shouldn't be set

in stone in the cdxml file.

I think that the appdev being able to set the current HomeDirectory for the app being

developed is good, but I don't think persisting that HomeDirectory to the cdxml file

is good or even necessary. At runtime, Dabo will correctly resolve the HomeDirectory

based on the location of the main application script (if this isn't working in some

cases, we need to fix it, but it's been working for me for years) so we are only

talking about design-time needs.

But that discussion we had at PyCon was only a couple minutes, so if I'm missing part

of the puzzle please indulge me! :)

Paul

_______________________________________________

Post Messages to: Dabo-dev@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Searchable Archives: http://leafe.com/archives/search/dabo-dev

This message: http://leafe.com/archives/byMID/4BA7A27D.8010002@ulmcnett.com

©2010 Paul McNett
Back to top
Re: [dabo-dev] dabo Commit 5762

Author: Ed Leafe

Posted: 2010-03-22 13:20:16   Link

On Mar 22, 2010, at 1:01 PM, Paul McNett wrote:

> But setting HomeDirectory in a portable file just seems like it is going to be prone

> to all kinds of trouble, especially if it is absolute (and it needs to be absolute to

> have the intended use). The user could install the app anywhere on their system, yet

> HomeDirectory is still set to '/home/pmcnett/MyCoolApp', even on Windows where that

> path makes no sense.

>

> I just don't think that HomeDirectory is a portable property, and it shouldn't be set

> in stone in the cdxml file.

As it stands now, I agree: it isn't portable. What I was thinking of doing is finding a way to make it portable, so that it can work x-platform. I have a few ideas, but nothing I've tested at all.

-- Ed Leafe

_______________________________________________

Post Messages to: Dabo-dev@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Searchable Archives: http://leafe.com/archives/search/dabo-dev

This message: http://leafe.com/archives/byMID/DEADAC11-9453-496B-8656-D07FD9717956@leafe.com

©2010 Ed Leafe
Back to top
Re: [dabo-dev] dabo Commit 5762

Author: Paul McNett

Posted: 2010-03-22 15:38:15   Link

On Mar 22, 2010, at 10:20, Ed Leafe <ed@leafe.com> wrote:

> As it stands now, I agree: it isn't portable. What I was thinking of

> doing is finding a way to make it portable, so that it can work x-

> platform. I have a few ideas, but nothing I've tested at all

The missing piece, as you pointed out in our discussion at pycon, is

the project manager. One of the key things (the only thing?) in a

project file is the home directory for the project. If when opening a

project file the directory doesn't exist the appdev could be prompted

for it.

For the time being couldn't we just implement this in

dabopreferences.db?

Or at the app level with a ProjectHomeDir (means a different thing and

only relevant at design time) property?

Portability aside, it makes no sense for an app property set at design

time to determine the home directory at run time. Unless you are going

to require the end user to put the application in a proscribed

location...

Paul

_______________________________________________

Post Messages to: Dabo-dev@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Searchable Archives: http://leafe.com/archives/search/dabo-dev

This message: http://leafe.com/archives/byMID/9C24E5CB-B5B0-412B-A75C-F710FCCB8C98@ulmcnett.com

©2010 Paul McNett
Back to top
Re: [dabo-dev] dabo Commit 5762

Author: Ed Leafe

Posted: 2010-03-22 15:50:17   Link

On Mar 22, 2010, at 3:38 PM, Paul McNett wrote:

>> As it stands now, I agree: it isn't portable. What I was thinking of

>> doing is finding a way to make it portable, so that it can work x-

>> platform. I have a few ideas, but nothing I've tested at all

>

> The missing piece, as you pointed out in our discussion at pycon, is

> the project manager. One of the key things (the only thing?) in a

> project file is the home directory for the project. If when opening a

> project file the directory doesn't exist the appdev could be prompted

> for it.

That's one of the solutions I was considering.

> For the time being couldn't we just implement this in

> dabopreferences.db?

I think that that would be a) rather clumsy to implement and b) totally non-portable.

> Or at the app level with a ProjectHomeDir (means a different thing and

> only relevant at design time) property?

Design time is not all that different than run time. I find it best not to think about things that way.

> Portability aside, it makes no sense for an app property set at design

> time to determine the home directory at run time. Unless you are going

> to require the end user to put the application in a proscribed

> location...

Not at all. The ability to either prompt for (ugly) or discover (elegant) the HomeDirectory should make it easier, not harder, to move apps around without the pathing issues we had when assuming that the main script being run was always in the HomeDirectory.

I don't have time to work on this now, but I'll see about looking into this next weekend when I might have more free time.

-- Ed Leafe

_______________________________________________

Post Messages to: Dabo-dev@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Searchable Archives: http://leafe.com/archives/search/dabo-dev

This message: http://leafe.com/archives/byMID/C48FB708-4DF6-49EB-AE37-6608974181C6@leafe.com

©2010 Ed Leafe
Back to top
Re: [dabo-dev] dabo Commit 5762

Author: Paul McNett

Posted: 2010-03-22 17:00:29   Link

On 3/22/10 12:50 PM, Ed Leafe wrote:

> On Mar 22, 2010, at 3:38 PM, Paul McNett wrote:

>

>>> As it stands now, I agree: it isn't portable. What I was thinking of

>>> doing is finding a way to make it portable, so that it can work x-

>>> platform. I have a few ideas, but nothing I've tested at all

>>

>> The missing piece, as you pointed out in our discussion at pycon, is

>> the project manager. One of the key things (the only thing?) in a

>> project file is the home directory for the project. If when opening a

>> project file the directory doesn't exist the appdev could be prompted

>> for it.

>

> That's one of the solutions I was considering.

>

>> For the time being couldn't we just implement this in

>> dabopreferences.db?

>

> I think that that would be a) rather clumsy to implement and b) totally non-portable.

Definitely clumsy, but it would get us rolling until we get the project manager. The

status-quo is already non-portable.

My point is that the information in question (where the root of the project is) only

really makes sense to keep on a per-system basis. I could be working on the exact

same code base from any number of locations on any number of systems.

>> Or at the app level with a ProjectHomeDir (means a different thing and

>> only relevant at design time) property?

>

> Design time is not all that different than run time. I find it best not to think about things that way.

And usually we can get away with that. But at design-time you have two application

objects to work with: 1) the Class Designer and 2) the application the developer is

producing. So I think in this case at least you are forced to separate design-time

and run-time.

>> Portability aside, it makes no sense for an app property set at design

>> time to determine the home directory at run time. Unless you are going

>> to require the end user to put the application in a proscribed

>> location...

>

>

> Not at all. The ability to either prompt for (ugly) or discover (elegant) the HomeDirectory should make it easier, not harder, to move apps around without the pathing issues we had when assuming that the main script being run was always in the HomeDirectory.

If you are planning to prompt for or discover the HomeDirectory at run-time anyway,

why save the HomeDirectory to the cdxml at all? If the answer is, "so the class

designer maintains a consistent reference to it", then this really points to the need

to maintain a separate property somewhere. I believe otherwise we have one too many

purposes for HomeDirectory.

> I don't have time to work on this now, but I'll see about looking into this next weekend when I might have more free time.

I have no time, either. Hopefully this discussion has been constructive!

Paul

_______________________________________________

Post Messages to: Dabo-dev@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Searchable Archives: http://leafe.com/archives/search/dabo-dev

This message: http://leafe.com/archives/byMID/4BA7DA6D.6040904@ulmcnett.com

©2010 Paul McNett