Re: [Sugar-devel] [Dextrose] [PATCH] Copying files multiple times results in bogus names. (SL#2060)

2010-11-12 Thread Shanjit Singh Jajmann
Hi all,

Firstly, I thank you all for having a look at the patch.

What i was trying to do was change the file names to
file_name(copy_number_of_the_file, starting with 2).
i had done so because of an earlier conversation with Aleksay and Sascha.

My most recent conversation with Aleksay has made me aware of the impact of
my changes and thus i would be incorporating the changes suggested above.


Thanks again.

Regards
Shan



On Thu, Nov 11, 2010 at 3:46 PM, Martin Dengler wrote:

> On Wed, Nov 10, 2010 at 05:57:18PM -0300, Gonzalo Odiard wrote:
> > Mhh, is sufficient with doing the split out of the while
>
> looks good
>
> > Gonzalo
>
> Martin
>
>
> ___
> Sugar-devel mailing list
> Sugar-devel@lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
>
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [Dextrose] [PATCH] Copying files multiple times results in bogus names. (SL#2060)

2010-11-11 Thread Martin Dengler
On Wed, Nov 10, 2010 at 05:57:18PM -0300, Gonzalo Odiard wrote:
> Mhh, is sufficient with doing the split out of the while

looks good

> Gonzalo

Martin



pgpomQQkzmzeP.pgp
Description: PGP signature
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [Dextrose] [PATCH] Copying files multiple times results in bogus names. (SL#2060)

2010-11-10 Thread Gonzalo Odiard
Mhh, is sufficient with doing the split out of the while

Gonzalo


[gonz...@nautilus journal]$ git diff model.py
diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py
index 81ca7d4..a422f6b 100644
--- a/src/jarabe/journal/model.py
+++ b/src/jarabe/journal/model.py
@@ -528,9 +528,9 @@ def _get_file_name(title, mime_type):

 def _get_unique_file_name(mount_point, file_name):
 if os.path.exists(os.path.join(mount_point, file_name)):
+name, extension = os.path.splitext(file_name)
 i = 1
 while len(file_name) <= 255:
-name, extension = os.path.splitext(file_name)
 file_name = name + '_' + str(i) + extension
 if not os.path.exists(os.path.join(mount_point, file_name)):
 break
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel