コード例 #1
0
ファイル: storage.py プロジェクト: siebenmann/dwiki
	def fill(self):
		if not self.real or self._state != None:
			return
		# At this point, self.rfo and self.fstore should be
		# empty.
		self.rfo = rcsfile.rcsfile(self.rname)
		try:
			with open(self.name, "r") as fp:
				self.fstore = fp.read()
		except EnvironmentError:
			pass

		# Now we check consistency.
		# First: real file must exist:
		if not self.fstore:
			self._state = sBad
		elif not self.rfo:
			self._state = sNoRCS
		elif self.rfo.headlocked():
			self._state = sLocked
		# If head is unlocked, the on-disk file must be the
		# same as the RCS file.
		elif not rcsfile.consistent(self.rfo, self.fstore):
			self._state = sInconsist
			# Mark us as non-displayable:
			self.fstore = None
		else:
			self._state = sGood
コード例 #2
0
ファイル: storage.py プロジェクト: samveen/dwiki
    def fill(self):
        if not self.real or self._state != None:
            return
        # At this point, self.rfo and self.fstore should be
        # empty.
        self.rfo = rcsfile.rcsfile(self.rname)
        try:
            with open(self.name, "r") as fp:
                self.fstore = fp.read()
        except EnvironmentError:
            pass

        # Now we check consistency.
        # First: real file must exist:
        if not self.fstore:
            self._state = sBad
        elif not self.rfo:
            self._state = sNoRCS
        elif self.rfo.headlocked():
            self._state = sLocked
        # If head is unlocked, the on-disk file must be the
        # same as the RCS file.
        elif not rcsfile.consistent(self.rfo, self.fstore):
            self._state = sInconsist
            # Mark us as non-displayable:
            self.fstore = None
        else:
            self._state = sGood
コード例 #3
0
ファイル: storage.py プロジェクト: siebenmann/dwiki
	def isdirty(self):
		if self._state == sInconsist:
			return True
		elif self._state in (sBad, sGood, sNoRCS):
			return False
		else:
			assert(self._state == sLocked)
			return not rcsfile.consistent(self.rfo, self.fstore)
コード例 #4
0
ファイル: storage.py プロジェクト: samveen/dwiki
 def isdirty(self):
     if self._state == sInconsist:
         return True
     elif self._state in (sBad, sGood, sNoRCS):
         return False
     else:
         assert (self._state == sLocked)
         return not rcsfile.consistent(self.rfo, self.fstore)