summaryrefslogtreecommitdiffstats
path: root/fdoor_file.py
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-04-13 21:16:12 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-04-13 21:16:12 +0200
commiteeb9927c89d6d2425a74c33ff8773bceba39af1c (patch)
treee5e770fc041fa27b6e13a78dc9c3dc3f75c7c213 /fdoor_file.py
parent99561b834dbd9d52b83aa7b0fb980431fa1aa056 (diff)
downloadpyevenja-master.zip
pyevenja-master.tar.gz
reformat filesHEADmaster
Diffstat (limited to 'fdoor_file.py')
-rw-r--r--fdoor_file.py102
1 files changed, 51 insertions, 51 deletions
diff --git a/fdoor_file.py b/fdoor_file.py
index d2819b6..0606bac 100644
--- a/fdoor_file.py
+++ b/fdoor_file.py
@@ -35,55 +35,55 @@ from returncodes import RET_CANNOTSAVE
class Fdoor_file(FevenDoor):
- def __init__(self):
- FevenDoor.__init__(self) # force constructor
- self.file = None
-
- def __str__(self):
- return "\t"+FevenDoor.__str__(self)+\
- "Fdoor_file - file : "+str(self.file)+"\n"
-
- def start(self,port,node):
- ret = Fport.start(self,port,node)
- if ret == RET_OK:
- self.gotoChildren()
- if self.Find("filename",False) == RET_OK:
- str = self.getContent()
- try:
- self.file = file(str,"rw")
- except:
- return RET_CANNOTACCESS
- self.filename = str
- if file <> None:
- data = self.getFreeEvenData()
- data.definePortAction(ACT_GET,self.getString())
- self.sendEvenData(data)
- else:
- return RET_CANNOTACCESS
- return ret
-
- def receive_evenData(self,evenData):
- if evenData.getCurrentDestination().getAction().equals(gvActionGet):
- line = self.file.readline()
- if line:
- # send line
- evenData.reset()
- evenData.setData("filename",self.filename)
- evenData.setData("TXT",line)
- self.sendEvenData(evenData)
+ def __init__(self):
+ FevenDoor.__init__(self) # force constructor
+ self.file = None
- # say "I got more"
- data = self.getFreeEvenData()
- data.definePortAction(ACT_GET, self.getString())
- self.sendEvenData(data)
- return RET_OK
-
-
- def end(self):
- ret = Fport.end(self)
- if ret == RET_OK and self.file <> None:
- try:
- self.file.close()
- except:
- return RET_CANNOTSAVE
- return ret
+ def __str__(self):
+ return "\t"+FevenDoor.__str__(self)+\
+ "Fdoor_file - file : "+str(self.file)+"\n"
+
+ def start(self,port,node):
+ ret = Fport.start(self,port,node)
+ if ret == RET_OK:
+ self.gotoChildren()
+ if self.Find("filename",False) == RET_OK:
+ str = self.getContent()
+ try:
+ self.file = file(str,"rw")
+ except:
+ return RET_CANNOTACCESS
+ self.filename = str
+ if file <> None:
+ data = self.getFreeEvenData()
+ data.definePortAction(ACT_GET,self.getString())
+ self.sendEvenData(data)
+ else:
+ return RET_CANNOTACCESS
+ return ret
+
+ def receive_evenData(self,evenData):
+ if evenData.getCurrentDestination().getAction().equals(gvActionGet):
+ line = self.file.readline()
+ if line:
+ # send line
+ evenData.reset()
+ evenData.setData("filename",self.filename)
+ evenData.setData("TXT",line)
+ self.sendEvenData(evenData)
+
+ # say "I got more"
+ data = self.getFreeEvenData()
+ data.definePortAction(ACT_GET, self.getString())
+ self.sendEvenData(data)
+ return RET_OK
+
+
+ def end(self):
+ ret = Fport.end(self)
+ if ret == RET_OK and self.file <> None:
+ try:
+ self.file.close()
+ except:
+ return RET_CANNOTSAVE
+ return ret