diff orpg/mapper/miniatures_handler.py @ 8:33582ce538b5 grumpy-goblin

CherryPy improvements.
author sirebral
date Sat, 18 Jul 2009 11:40:34 -0500
parents d63ad196cc0d
children 5df1340bda13
line wrap: on
line diff
--- a/orpg/mapper/miniatures_handler.py	Fri Jul 17 01:56:41 2009 -0500
+++ b/orpg/mapper/miniatures_handler.py	Sat Jul 18 11:40:34 2009 -0500
@@ -38,6 +38,8 @@
 from grid import GRID_RECTANGLE
 from grid import GRID_HEXAGON
 from grid import GRID_ISOMETRIC
+import os
+
 LABEL_TOOL = wx.NewId()
 LAYER_TOOL = wx.NewId()
 MIN_LIST_TOOL = wx.NewId()
@@ -159,10 +161,11 @@
             y = dc.DeviceToLogicalY(0)
             thread.start_new_thread(self.canvas.layers['miniatures'].upload, (postdata, dlg.GetPath()), {'pos':cmpPoint(x,y)})
         else:
-            min_url = self.settings.get_setting('LocalImageBaseURL') + filename
-            if dlg.GetDirectory() == orpg.dirpath.dir_struct["user"]+'webfiles/Textures' or dlg.GetDirectory() == orpg.dirpath.dir_struct["user"]+'webfiles\Textures': min_url = self.settings.get_setting('LocalImageBaseURL') + 'Textures/' + filename
-            if dlg.GetDirectory() == orpg.dirpath.dir_struct["user"]+'webfiles/Maps' or dlg.GetDirectory() == orpg.dirpath.dir_struct["user"]+'webfiles\Maps': min_url = self.settings.get_setting('ImageServerBaseURL') + 'Maps/' + filename
-            if dlg.GetDirectory() == orpg.dirpath.dir_struct["user"]+'webfiles/Miniatures' or dlg.GetDirectory() == orpg.dirpath.dir_struct["user"]+'webfiles\Miniatures': min_url = self.settings.get_setting('LocalImageBaseURL') + 'Miniatures/' + filename
+            try:
+                min_url = open_rpg.get_component("cherrypy") + filename
+            except:
+                return
+            min_url = dlg.GetDirectory().replace(orpg.dirpath.dir_struct["user"]+'webfiles' + os.sep, open_rpg.get_component("cherrypy")) + '/' + filename
             # build url
             if min_url == "" or min_url == "http://":
                 return