コード例 #1
0
ファイル: pagelet.py プロジェクト: janastu/pantoto-prototype
 def postsimilar(self,sessionuserid):
     newf = []
     for fld in self.fields:
         f = Field(sessionuserid,fld.decoration,fld.label)
         newf.append(f)
         cPickle.dump(f, open(f.getid()+".obj",'wb'))
     newp = Pagelet(sessionuserid,self.views,newf)
     self.leaves.append(newp.getid())
     cPickle.dump(self, open(self.getid()+".obj",'wb'))
     cPickle.dump(self, open(newp.getid()+".obj",'wb'))
     return newp
コード例 #2
0
stud_grp.adduser(u2.getid())
cPickle.dump(stud_grp, open(stud_grp.getid()+".obj",'wb'))

teach_grp = Group ("Teachers")
teach_grp.adduser(u3.getid())
teach_grp.adduser(u4.getid())
cPickle.dump(teach_grp, open(teach_grp.getid()+".obj", 'wb'))

#****************************************************************************************
# Session user is the teacher now
#****************************************************************************************
sessionuser = u3
print "\nNow you are the teacher 1"
# Instantiating fields
q1 = Field(sessionuser.getid(),{"format":"textbox"},"Sin(30)=")
cPickle.dump(q1, open(q1.getid()+".obj", 'wb'))

q2 = Field(sessionuser.getid(),{"format":"textbox"},"Cos(30)=")
cPickle.dump(q2, open(q2.getid()+".obj", 'wb'))

g = Field(sessionuser.getid(),{"format":"textbox"},"Grade=")
cPickle.dump(g, open(g.getid()+".obj", 'wb'))

# Instantiating Views
qp_perm = Permissions({stud_grp.getid():{q1.getlabel():"-w",q2.getlabel():"-w",g.getlabel():"--"},\
                      teach_grp.getid():{q1.getlabel():"r-",q2.getlabel():"r-",g.getlabel():"--"}})

qpaper = ViewCategory(sessionuser.getid(),"qpaper",qp_perm,workflow)

gp_perm = Permissions({stud_grp.getid():{q1.getlabel():"rn",q2.getlabel():"rn",g.getlabel():"r-"},\
                      teach_grp.getid():{q1.getlabel():"r-",q2.getlabel():"r-",g.getlabel():"rw"}})