Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/AnonR/smanonr..../usr/lib64/python2....
File: mhlib.py
except os.error:
[500] Fix | Delete
# Try copying
[501] Fix | Delete
try:
[502] Fix | Delete
shutil.copy2(path, topath)
[503] Fix | Delete
os.unlink(path)
[504] Fix | Delete
except (IOError, os.error), msg:
[505] Fix | Delete
errors.append(msg)
[506] Fix | Delete
try:
[507] Fix | Delete
os.unlink(topath)
[508] Fix | Delete
except os.error:
[509] Fix | Delete
pass
[510] Fix | Delete
continue
[511] Fix | Delete
tofolder.setlast(ton)
[512] Fix | Delete
refiled[n] = ton
[513] Fix | Delete
if refiled:
[514] Fix | Delete
if keepsequences:
[515] Fix | Delete
tofolder._copysequences(self, refiled.items())
[516] Fix | Delete
self.removefromallsequences(refiled.keys())
[517] Fix | Delete
if errors:
[518] Fix | Delete
if len(errors) == 1:
[519] Fix | Delete
raise os.error, errors[0]
[520] Fix | Delete
else:
[521] Fix | Delete
raise os.error, ('multiple errors:', errors)
[522] Fix | Delete
[523] Fix | Delete
def _copysequences(self, fromfolder, refileditems):
[524] Fix | Delete
"""Helper for refilemessages() to copy sequences."""
[525] Fix | Delete
fromsequences = fromfolder.getsequences()
[526] Fix | Delete
tosequences = self.getsequences()
[527] Fix | Delete
changed = 0
[528] Fix | Delete
for name, seq in fromsequences.items():
[529] Fix | Delete
try:
[530] Fix | Delete
toseq = tosequences[name]
[531] Fix | Delete
new = 0
[532] Fix | Delete
except KeyError:
[533] Fix | Delete
toseq = []
[534] Fix | Delete
new = 1
[535] Fix | Delete
for fromn, ton in refileditems:
[536] Fix | Delete
if fromn in seq:
[537] Fix | Delete
toseq.append(ton)
[538] Fix | Delete
changed = 1
[539] Fix | Delete
if new and toseq:
[540] Fix | Delete
tosequences[name] = toseq
[541] Fix | Delete
if changed:
[542] Fix | Delete
self.putsequences(tosequences)
[543] Fix | Delete
[544] Fix | Delete
def movemessage(self, n, tofolder, ton):
[545] Fix | Delete
"""Move one message over a specific destination message,
[546] Fix | Delete
which may or may not already exist."""
[547] Fix | Delete
path = self.getmessagefilename(n)
[548] Fix | Delete
# Open it to check that it exists
[549] Fix | Delete
f = open(path)
[550] Fix | Delete
f.close()
[551] Fix | Delete
del f
[552] Fix | Delete
topath = tofolder.getmessagefilename(ton)
[553] Fix | Delete
backuptopath = tofolder.getmessagefilename(',%d' % ton)
[554] Fix | Delete
try:
[555] Fix | Delete
os.rename(topath, backuptopath)
[556] Fix | Delete
except os.error:
[557] Fix | Delete
pass
[558] Fix | Delete
try:
[559] Fix | Delete
os.rename(path, topath)
[560] Fix | Delete
except os.error:
[561] Fix | Delete
# Try copying
[562] Fix | Delete
ok = 0
[563] Fix | Delete
try:
[564] Fix | Delete
tofolder.setlast(None)
[565] Fix | Delete
shutil.copy2(path, topath)
[566] Fix | Delete
ok = 1
[567] Fix | Delete
finally:
[568] Fix | Delete
if not ok:
[569] Fix | Delete
try:
[570] Fix | Delete
os.unlink(topath)
[571] Fix | Delete
except os.error:
[572] Fix | Delete
pass
[573] Fix | Delete
os.unlink(path)
[574] Fix | Delete
self.removefromallsequences([n])
[575] Fix | Delete
[576] Fix | Delete
def copymessage(self, n, tofolder, ton):
[577] Fix | Delete
"""Copy one message over a specific destination message,
[578] Fix | Delete
which may or may not already exist."""
[579] Fix | Delete
path = self.getmessagefilename(n)
[580] Fix | Delete
# Open it to check that it exists
[581] Fix | Delete
f = open(path)
[582] Fix | Delete
f.close()
[583] Fix | Delete
del f
[584] Fix | Delete
topath = tofolder.getmessagefilename(ton)
[585] Fix | Delete
backuptopath = tofolder.getmessagefilename(',%d' % ton)
[586] Fix | Delete
try:
[587] Fix | Delete
os.rename(topath, backuptopath)
[588] Fix | Delete
except os.error:
[589] Fix | Delete
pass
[590] Fix | Delete
ok = 0
[591] Fix | Delete
try:
[592] Fix | Delete
tofolder.setlast(None)
[593] Fix | Delete
shutil.copy2(path, topath)
[594] Fix | Delete
ok = 1
[595] Fix | Delete
finally:
[596] Fix | Delete
if not ok:
[597] Fix | Delete
try:
[598] Fix | Delete
os.unlink(topath)
[599] Fix | Delete
except os.error:
[600] Fix | Delete
pass
[601] Fix | Delete
[602] Fix | Delete
def createmessage(self, n, txt):
[603] Fix | Delete
"""Create a message, with text from the open file txt."""
[604] Fix | Delete
path = self.getmessagefilename(n)
[605] Fix | Delete
backuppath = self.getmessagefilename(',%d' % n)
[606] Fix | Delete
try:
[607] Fix | Delete
os.rename(path, backuppath)
[608] Fix | Delete
except os.error:
[609] Fix | Delete
pass
[610] Fix | Delete
ok = 0
[611] Fix | Delete
BUFSIZE = 16*1024
[612] Fix | Delete
try:
[613] Fix | Delete
f = open(path, "w")
[614] Fix | Delete
while 1:
[615] Fix | Delete
buf = txt.read(BUFSIZE)
[616] Fix | Delete
if not buf:
[617] Fix | Delete
break
[618] Fix | Delete
f.write(buf)
[619] Fix | Delete
f.close()
[620] Fix | Delete
ok = 1
[621] Fix | Delete
finally:
[622] Fix | Delete
if not ok:
[623] Fix | Delete
try:
[624] Fix | Delete
os.unlink(path)
[625] Fix | Delete
except os.error:
[626] Fix | Delete
pass
[627] Fix | Delete
[628] Fix | Delete
def removefromallsequences(self, list):
[629] Fix | Delete
"""Remove one or more messages from all sequences (including last)
[630] Fix | Delete
-- but not from 'cur'!!!"""
[631] Fix | Delete
if hasattr(self, 'last') and self.last in list:
[632] Fix | Delete
del self.last
[633] Fix | Delete
sequences = self.getsequences()
[634] Fix | Delete
changed = 0
[635] Fix | Delete
for name, seq in sequences.items():
[636] Fix | Delete
if name == 'cur':
[637] Fix | Delete
continue
[638] Fix | Delete
for n in list:
[639] Fix | Delete
if n in seq:
[640] Fix | Delete
seq.remove(n)
[641] Fix | Delete
changed = 1
[642] Fix | Delete
if not seq:
[643] Fix | Delete
del sequences[name]
[644] Fix | Delete
if changed:
[645] Fix | Delete
self.putsequences(sequences)
[646] Fix | Delete
[647] Fix | Delete
def getlast(self):
[648] Fix | Delete
"""Return the last message number."""
[649] Fix | Delete
if not hasattr(self, 'last'):
[650] Fix | Delete
self.listmessages() # Set self.last
[651] Fix | Delete
return self.last
[652] Fix | Delete
[653] Fix | Delete
def setlast(self, last):
[654] Fix | Delete
"""Set the last message number."""
[655] Fix | Delete
if last is None:
[656] Fix | Delete
if hasattr(self, 'last'):
[657] Fix | Delete
del self.last
[658] Fix | Delete
else:
[659] Fix | Delete
self.last = last
[660] Fix | Delete
[661] Fix | Delete
class Message(mimetools.Message):
[662] Fix | Delete
[663] Fix | Delete
def __init__(self, f, n, fp = None):
[664] Fix | Delete
"""Constructor."""
[665] Fix | Delete
self.folder = f
[666] Fix | Delete
self.number = n
[667] Fix | Delete
if fp is None:
[668] Fix | Delete
path = f.getmessagefilename(n)
[669] Fix | Delete
fp = open(path, 'r')
[670] Fix | Delete
mimetools.Message.__init__(self, fp)
[671] Fix | Delete
[672] Fix | Delete
def __repr__(self):
[673] Fix | Delete
"""String representation."""
[674] Fix | Delete
return 'Message(%s, %s)' % (repr(self.folder), self.number)
[675] Fix | Delete
[676] Fix | Delete
def getheadertext(self, pred = None):
[677] Fix | Delete
"""Return the message's header text as a string. If an
[678] Fix | Delete
argument is specified, it is used as a filter predicate to
[679] Fix | Delete
decide which headers to return (its argument is the header
[680] Fix | Delete
name converted to lower case)."""
[681] Fix | Delete
if pred is None:
[682] Fix | Delete
return ''.join(self.headers)
[683] Fix | Delete
headers = []
[684] Fix | Delete
hit = 0
[685] Fix | Delete
for line in self.headers:
[686] Fix | Delete
if not line[0].isspace():
[687] Fix | Delete
i = line.find(':')
[688] Fix | Delete
if i > 0:
[689] Fix | Delete
hit = pred(line[:i].lower())
[690] Fix | Delete
if hit: headers.append(line)
[691] Fix | Delete
return ''.join(headers)
[692] Fix | Delete
[693] Fix | Delete
def getbodytext(self, decode = 1):
[694] Fix | Delete
"""Return the message's body text as string. This undoes a
[695] Fix | Delete
Content-Transfer-Encoding, but does not interpret other MIME
[696] Fix | Delete
features (e.g. multipart messages). To suppress decoding,
[697] Fix | Delete
pass 0 as an argument."""
[698] Fix | Delete
self.fp.seek(self.startofbody)
[699] Fix | Delete
encoding = self.getencoding()
[700] Fix | Delete
if not decode or encoding in ('', '7bit', '8bit', 'binary'):
[701] Fix | Delete
return self.fp.read()
[702] Fix | Delete
try:
[703] Fix | Delete
from cStringIO import StringIO
[704] Fix | Delete
except ImportError:
[705] Fix | Delete
from StringIO import StringIO
[706] Fix | Delete
output = StringIO()
[707] Fix | Delete
mimetools.decode(self.fp, output, encoding)
[708] Fix | Delete
return output.getvalue()
[709] Fix | Delete
[710] Fix | Delete
def getbodyparts(self):
[711] Fix | Delete
"""Only for multipart messages: return the message's body as a
[712] Fix | Delete
list of SubMessage objects. Each submessage object behaves
[713] Fix | Delete
(almost) as a Message object."""
[714] Fix | Delete
if self.getmaintype() != 'multipart':
[715] Fix | Delete
raise Error, 'Content-Type is not multipart/*'
[716] Fix | Delete
bdry = self.getparam('boundary')
[717] Fix | Delete
if not bdry:
[718] Fix | Delete
raise Error, 'multipart/* without boundary param'
[719] Fix | Delete
self.fp.seek(self.startofbody)
[720] Fix | Delete
mf = multifile.MultiFile(self.fp)
[721] Fix | Delete
mf.push(bdry)
[722] Fix | Delete
parts = []
[723] Fix | Delete
while mf.next():
[724] Fix | Delete
n = "%s.%r" % (self.number, 1 + len(parts))
[725] Fix | Delete
part = SubMessage(self.folder, n, mf)
[726] Fix | Delete
parts.append(part)
[727] Fix | Delete
mf.pop()
[728] Fix | Delete
return parts
[729] Fix | Delete
[730] Fix | Delete
def getbody(self):
[731] Fix | Delete
"""Return body, either a string or a list of messages."""
[732] Fix | Delete
if self.getmaintype() == 'multipart':
[733] Fix | Delete
return self.getbodyparts()
[734] Fix | Delete
else:
[735] Fix | Delete
return self.getbodytext()
[736] Fix | Delete
[737] Fix | Delete
[738] Fix | Delete
class SubMessage(Message):
[739] Fix | Delete
[740] Fix | Delete
def __init__(self, f, n, fp):
[741] Fix | Delete
"""Constructor."""
[742] Fix | Delete
Message.__init__(self, f, n, fp)
[743] Fix | Delete
if self.getmaintype() == 'multipart':
[744] Fix | Delete
self.body = Message.getbodyparts(self)
[745] Fix | Delete
else:
[746] Fix | Delete
self.body = Message.getbodytext(self)
[747] Fix | Delete
self.bodyencoded = Message.getbodytext(self, decode=0)
[748] Fix | Delete
# XXX If this is big, should remember file pointers
[749] Fix | Delete
[750] Fix | Delete
def __repr__(self):
[751] Fix | Delete
"""String representation."""
[752] Fix | Delete
f, n, fp = self.folder, self.number, self.fp
[753] Fix | Delete
return 'SubMessage(%s, %s, %s)' % (f, n, fp)
[754] Fix | Delete
[755] Fix | Delete
def getbodytext(self, decode = 1):
[756] Fix | Delete
if not decode:
[757] Fix | Delete
return self.bodyencoded
[758] Fix | Delete
if type(self.body) == type(''):
[759] Fix | Delete
return self.body
[760] Fix | Delete
[761] Fix | Delete
def getbodyparts(self):
[762] Fix | Delete
if type(self.body) == type([]):
[763] Fix | Delete
return self.body
[764] Fix | Delete
[765] Fix | Delete
def getbody(self):
[766] Fix | Delete
return self.body
[767] Fix | Delete
[768] Fix | Delete
[769] Fix | Delete
class IntSet:
[770] Fix | Delete
"""Class implementing sets of integers.
[771] Fix | Delete
[772] Fix | Delete
This is an efficient representation for sets consisting of several
[773] Fix | Delete
continuous ranges, e.g. 1-100,200-400,402-1000 is represented
[774] Fix | Delete
internally as a list of three pairs: [(1,100), (200,400),
[775] Fix | Delete
(402,1000)]. The internal representation is always kept normalized.
[776] Fix | Delete
[777] Fix | Delete
The constructor has up to three arguments:
[778] Fix | Delete
- the string used to initialize the set (default ''),
[779] Fix | Delete
- the separator between ranges (default ',')
[780] Fix | Delete
- the separator between begin and end of a range (default '-')
[781] Fix | Delete
The separators must be strings (not regexprs) and should be different.
[782] Fix | Delete
[783] Fix | Delete
The tostring() function yields a string that can be passed to another
[784] Fix | Delete
IntSet constructor; __repr__() is a valid IntSet constructor itself.
[785] Fix | Delete
"""
[786] Fix | Delete
[787] Fix | Delete
# XXX The default begin/end separator means that negative numbers are
[788] Fix | Delete
# not supported very well.
[789] Fix | Delete
#
[790] Fix | Delete
# XXX There are currently no operations to remove set elements.
[791] Fix | Delete
[792] Fix | Delete
def __init__(self, data = None, sep = ',', rng = '-'):
[793] Fix | Delete
self.pairs = []
[794] Fix | Delete
self.sep = sep
[795] Fix | Delete
self.rng = rng
[796] Fix | Delete
if data: self.fromstring(data)
[797] Fix | Delete
[798] Fix | Delete
def reset(self):
[799] Fix | Delete
self.pairs = []
[800] Fix | Delete
[801] Fix | Delete
def __cmp__(self, other):
[802] Fix | Delete
return cmp(self.pairs, other.pairs)
[803] Fix | Delete
[804] Fix | Delete
def __hash__(self):
[805] Fix | Delete
return hash(self.pairs)
[806] Fix | Delete
[807] Fix | Delete
def __repr__(self):
[808] Fix | Delete
return 'IntSet(%r, %r, %r)' % (self.tostring(), self.sep, self.rng)
[809] Fix | Delete
[810] Fix | Delete
def normalize(self):
[811] Fix | Delete
self.pairs.sort()
[812] Fix | Delete
i = 1
[813] Fix | Delete
while i < len(self.pairs):
[814] Fix | Delete
alo, ahi = self.pairs[i-1]
[815] Fix | Delete
blo, bhi = self.pairs[i]
[816] Fix | Delete
if ahi >= blo-1:
[817] Fix | Delete
self.pairs[i-1:i+1] = [(alo, max(ahi, bhi))]
[818] Fix | Delete
else:
[819] Fix | Delete
i = i+1
[820] Fix | Delete
[821] Fix | Delete
def tostring(self):
[822] Fix | Delete
s = ''
[823] Fix | Delete
for lo, hi in self.pairs:
[824] Fix | Delete
if lo == hi: t = repr(lo)
[825] Fix | Delete
else: t = repr(lo) + self.rng + repr(hi)
[826] Fix | Delete
if s: s = s + (self.sep + t)
[827] Fix | Delete
else: s = t
[828] Fix | Delete
return s
[829] Fix | Delete
[830] Fix | Delete
def tolist(self):
[831] Fix | Delete
l = []
[832] Fix | Delete
for lo, hi in self.pairs:
[833] Fix | Delete
m = range(lo, hi+1)
[834] Fix | Delete
l = l + m
[835] Fix | Delete
return l
[836] Fix | Delete
[837] Fix | Delete
def fromlist(self, list):
[838] Fix | Delete
for i in list:
[839] Fix | Delete
self.append(i)
[840] Fix | Delete
[841] Fix | Delete
def clone(self):
[842] Fix | Delete
new = IntSet()
[843] Fix | Delete
new.pairs = self.pairs[:]
[844] Fix | Delete
return new
[845] Fix | Delete
[846] Fix | Delete
def min(self):
[847] Fix | Delete
return self.pairs[0][0]
[848] Fix | Delete
[849] Fix | Delete
def max(self):
[850] Fix | Delete
return self.pairs[-1][-1]
[851] Fix | Delete
[852] Fix | Delete
def contains(self, x):
[853] Fix | Delete
for lo, hi in self.pairs:
[854] Fix | Delete
if lo <= x <= hi: return True
[855] Fix | Delete
return False
[856] Fix | Delete
[857] Fix | Delete
def append(self, x):
[858] Fix | Delete
for i in range(len(self.pairs)):
[859] Fix | Delete
lo, hi = self.pairs[i]
[860] Fix | Delete
if x < lo: # Need to insert before
[861] Fix | Delete
if x+1 == lo:
[862] Fix | Delete
self.pairs[i] = (x, hi)
[863] Fix | Delete
else:
[864] Fix | Delete
self.pairs.insert(i, (x, x))
[865] Fix | Delete
if i > 0 and x-1 == self.pairs[i-1][1]:
[866] Fix | Delete
# Merge with previous
[867] Fix | Delete
self.pairs[i-1:i+1] = [
[868] Fix | Delete
(self.pairs[i-1][0],
[869] Fix | Delete
self.pairs[i][1])
[870] Fix | Delete
]
[871] Fix | Delete
return
[872] Fix | Delete
if x <= hi: # Already in set
[873] Fix | Delete
return
[874] Fix | Delete
i = len(self.pairs) - 1
[875] Fix | Delete
if i >= 0:
[876] Fix | Delete
lo, hi = self.pairs[i]
[877] Fix | Delete
if x-1 == hi:
[878] Fix | Delete
self.pairs[i] = lo, x
[879] Fix | Delete
return
[880] Fix | Delete
self.pairs.append((x, x))
[881] Fix | Delete
[882] Fix | Delete
def addpair(self, xlo, xhi):
[883] Fix | Delete
if xlo > xhi: return
[884] Fix | Delete
self.pairs.append((xlo, xhi))
[885] Fix | Delete
self.normalize()
[886] Fix | Delete
[887] Fix | Delete
def fromstring(self, data):
[888] Fix | Delete
new = []
[889] Fix | Delete
for part in data.split(self.sep):
[890] Fix | Delete
list = []
[891] Fix | Delete
for subp in part.split(self.rng):
[892] Fix | Delete
s = subp.strip()
[893] Fix | Delete
list.append(int(s))
[894] Fix | Delete
if len(list) == 1:
[895] Fix | Delete
new.append((list[0], list[0]))
[896] Fix | Delete
elif len(list) == 2 and list[0] <= list[1]:
[897] Fix | Delete
new.append((list[0], list[1]))
[898] Fix | Delete
else:
[899] Fix | Delete
raise ValueError, 'bad data passed to IntSet'
[900] Fix | Delete
self.pairs = self.pairs + new
[901] Fix | Delete
self.normalize()
[902] Fix | Delete
[903] Fix | Delete
[904] Fix | Delete
# Subroutines to read/write entries in .mh_profile and .mh_sequences
[905] Fix | Delete
[906] Fix | Delete
def pickline(file, key, casefold = 1):
[907] Fix | Delete
try:
[908] Fix | Delete
f = open(file, 'r')
[909] Fix | Delete
except IOError:
[910] Fix | Delete
return None
[911] Fix | Delete
pat = re.escape(key) + ':'
[912] Fix | Delete
prog = re.compile(pat, casefold and re.IGNORECASE)
[913] Fix | Delete
while 1:
[914] Fix | Delete
line = f.readline()
[915] Fix | Delete
if not line: break
[916] Fix | Delete
if prog.match(line):
[917] Fix | Delete
text = line[len(key)+1:]
[918] Fix | Delete
while 1:
[919] Fix | Delete
line = f.readline()
[920] Fix | Delete
if not line or not line[0].isspace():
[921] Fix | Delete
break
[922] Fix | Delete
text = text + line
[923] Fix | Delete
return text.strip()
[924] Fix | Delete
return None
[925] Fix | Delete
[926] Fix | Delete
def updateline(file, key, value, casefold = 1):
[927] Fix | Delete
try:
[928] Fix | Delete
f = open(file, 'r')
[929] Fix | Delete
lines = f.readlines()
[930] Fix | Delete
f.close()
[931] Fix | Delete
except IOError:
[932] Fix | Delete
lines = []
[933] Fix | Delete
pat = re.escape(key) + ':(.*)\n'
[934] Fix | Delete
prog = re.compile(pat, casefold and re.IGNORECASE)
[935] Fix | Delete
if value is None:
[936] Fix | Delete
newline = None
[937] Fix | Delete
else:
[938] Fix | Delete
newline = '%s: %s\n' % (key, value)
[939] Fix | Delete
for i in range(len(lines)):
[940] Fix | Delete
line = lines[i]
[941] Fix | Delete
if prog.match(line):
[942] Fix | Delete
if newline is None:
[943] Fix | Delete
del lines[i]
[944] Fix | Delete
else:
[945] Fix | Delete
lines[i] = newline
[946] Fix | Delete
break
[947] Fix | Delete
else:
[948] Fix | Delete
if newline is not None:
[949] Fix | Delete
lines.append(newline)
[950] Fix | Delete
tempfile = file + "~"
[951] Fix | Delete
f = open(tempfile, 'w')
[952] Fix | Delete
for line in lines:
[953] Fix | Delete
f.write(line)
[954] Fix | Delete
f.close()
[955] Fix | Delete
os.rename(tempfile, file)
[956] Fix | Delete
[957] Fix | Delete
[958] Fix | Delete
# Test program
[959] Fix | Delete
[960] Fix | Delete
def test():
[961] Fix | Delete
global mh, f
[962] Fix | Delete
os.system('rm -rf $HOME/Mail/@test')
[963] Fix | Delete
mh = MH()
[964] Fix | Delete
def do(s): print s; print eval(s)
[965] Fix | Delete
do('mh.listfolders()')
[966] Fix | Delete
do('mh.listallfolders()')
[967] Fix | Delete
testfolders = ['@test', '@test/test1', '@test/test2',
[968] Fix | Delete
'@test/test1/test11', '@test/test1/test12',
[969] Fix | Delete
'@test/test1/test11/test111']
[970] Fix | Delete
for t in testfolders: do('mh.makefolder(%r)' % (t,))
[971] Fix | Delete
do('mh.listsubfolders(\'@test\')')
[972] Fix | Delete
do('mh.listallsubfolders(\'@test\')')
[973] Fix | Delete
f = mh.openfolder('@test')
[974] Fix | Delete
do('f.listsubfolders()')
[975] Fix | Delete
do('f.listallsubfolders()')
[976] Fix | Delete
do('f.getsequences()')
[977] Fix | Delete
seqs = f.getsequences()
[978] Fix | Delete
seqs['foo'] = IntSet('1-10 12-20', ' ').tolist()
[979] Fix | Delete
print seqs
[980] Fix | Delete
f.putsequences(seqs)
[981] Fix | Delete
do('f.getsequences()')
[982] Fix | Delete
for t in reversed(testfolders): do('mh.deletefolder(%r)' % (t,))
[983] Fix | Delete
do('mh.getcontext()')
[984] Fix | Delete
context = mh.getcontext()
[985] Fix | Delete
f = mh.openfolder(context)
[986] Fix | Delete
do('f.getcurrent()')
[987] Fix | Delete
for seq in ('first', 'last', 'cur', '.', 'prev', 'next',
[988] Fix | Delete
'first:3', 'last:3', 'cur:3', 'cur:-3',
[989] Fix | Delete
'prev:3', 'next:3',
[990] Fix | Delete
'1:3', '1:-3', '100:3', '100:-3', '10000:3', '10000:-3',
[991] Fix | Delete
'all'):
[992] Fix | Delete
try:
[993] Fix | Delete
do('f.parsesequence(%r)' % (seq,))
[994] Fix | Delete
except Error, msg:
[995] Fix | Delete
print "Error:", msg
[996] Fix | Delete
stuff = os.popen("pick %r 2>/dev/null" % (seq,)).read()
[997] Fix | Delete
list = map(int, stuff.split())
[998] Fix | Delete
print list, "<-- pick"
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function