summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--photoblaster/.ropeproject/globalnamesbin1808 -> 1824 bytes
-rwxr-xr-xphotoblaster/modules/pblandscape/__init__.py41
2 files changed, 22 insertions, 19 deletions
diff --git a/photoblaster/.ropeproject/globalnames b/photoblaster/.ropeproject/globalnames
index cc1ff5d..fd96358 100644
--- a/photoblaster/.ropeproject/globalnames
+++ b/photoblaster/.ropeproject/globalnames
Binary files differ
diff --git a/photoblaster/modules/pblandscape/__init__.py b/photoblaster/modules/pblandscape/__init__.py
index d002df8..b03dce0 100755
--- a/photoblaster/modules/pblandscape/__init__.py
+++ b/photoblaster/modules/pblandscape/__init__.py
@@ -1,15 +1,21 @@
-from photoblaster.config import *
import base64
from photoblaster.modules import Pb
-import urlparse, re
+import urlparse
+import re
+
class PbLandscape(Pb):
- example_params = {
- 'imgdata' : open('photoblaster/modules/pblandscape/_base64img', 'rb').read(),
- 'texture' : 'http://someurl.biz/someimg.jpg',
- 'heightmap' : 'http://someurl.biz/someimg.jpg',
- 'name' : 'donkey'
- }
+ try:
+ example_params = {
+ 'imgdata': open(
+ './photoblaster/modules/pblandscape/_base64img', 'rb').read(),
+ 'texture': 'http://someurl.biz/someimg.jpg',
+ 'heightmap': 'http://someurl.biz/someimg.jpg',
+ 'name': 'donkey'
+ }
+ except:
+ example_params = {}
+
def __init__(self, **kwargs):
super(PbLandscape, self).__init__(**kwargs)
_definitions = {
@@ -18,9 +24,14 @@ class PbLandscape(Pb):
'texture': {'type': 'string'},
'username': {'type': 'string'},
}
- self.params.definitions_import(_definitions, kwargs, classname=self.__class__.__name__)
+ self.params.definitions_import(
+ _definitions,
+ kwargs,
+ classname=self.__class__.__name__)
_namepart = re.sub(r'https?:?/?/?', '', str(self.params.texture))
- self.filename, self.filepath = self._filename_filepath_create(url=_namepart, extension="png")
+ self.filename, self.filepath = self._filename_filepath_create(
+ url=_namepart, extension="png"
+ )
self._db_url_param = str(self.params.texture)
@@ -28,15 +39,7 @@ class PbLandscape(Pb):
try:
up = urlparse.urlparse(str(self.params.imgdata))
head, data = up.path.split(',', 1)
- bits = head.split(';')
- #mime_type = bits[0] if bits[0] else 'text/plain'
- #charset, b64 = 'ASCII', False
- #for bit in bits[1]:
- # if bit.startswith('charset='):
- # charset = bit[8:]
- # elif bit == 'base64':
- # b64 = True
-
+ # bits = head.split(';')
# Do something smart with charset and b64 instead of assuming
plaindata = base64.b64decode(data)