示例#1
0
def add():
    u = current_user()
    if not u:
        return redirect(url_for("auth.login"))
    if request.method == "GET":
        boards = Board.all()
        return render_template("topic/add.html", user_id=u.id, boards=boards)
    Topic.new_and_save(request.form)
    return redirect(url_for(".index"))
示例#2
0
class Post:

    topic = Topic("", None, None)
    user = User("", "", "")
    postDate = ""
    content = ""

    def __init__(self, postDate, content, topic, user):
        self.topic = topic
        self.user = user
        self.postDate = postDate
        self.content = content

    @staticmethod
    def creationPost(content, idTopic, idUser):
        return bdd.creationPost(content, idTopic, idUser)

    @staticmethod
    def listePost(idTopic):
        return bdd.listePost(idTopic)

    @staticmethod
    def suppressionPost(idPost):
        return bdd.suppressionPost(idPost)

    @staticmethod
    def miseAjourPost(idPost, content):
        return bdd.miseAjourPost(idPost, content)
示例#3
0
def add(topic_id):
	u = current_user()
	if not u:
		return redirect(url_for("auth.login"))
	Reply.new_and_save(request.form)
	t = Topic.find_by_id(topic_id)
	update_comments(t)
	return redirect(url_for("topic.detail", topic_id=topic_id))
示例#4
0
def step_impl(context):
    # Setup environment
    # Setup Topic object
    context.pose = Topic(u"/odometry/base_raw/pose")
    # Begin capture of Topic Echo for 10 lines
    context.starting_echo = context.pose.echo(10)
    # Map return value from echo to object of type msgs/nav_msgs/Odometry
    starting_position = Odometry(context.starting_echo)
    # Store starting position to shared context
    context.starting_position = starting_position
示例#5
0
def detail(topic_id):
    t = Topic.find_by_id(topic_id)
    u = current_user()
    rs = Reply.find_by(topic_id=topic_id)
    update_views(t)
    rs.sort(key=lambda x: x.floor)
    floor_count = len(rs) + 1
    return render_template("topic/detail.html",
                           topic=t,
                           user=u,
                           replies=rs,
                           floor_count=floor_count)
示例#6
0
 def from_dict(old):
     args = old
     args['studying'] = Studying.get(id=args['studying']['id'])
     args['topic'] = Topic.get(id=args['topic']['id'])
     return args
示例#7
0
def creationTopic(request):
    title = request.form.get('title')
    idCategory = request.form.get('idCategory')
    idUser = request.form.get('idUser')

    return Topic.creationTopic(title, idCategory, idUser)
示例#8
0
def listeTitreTopic():
    return Topic.listeTitreTopic()
示例#9
0
def miseAjourTopic(request):
    title = request.form.get('title')
    idTopic = request.form.get('idTopic')

    return Topic.miseAjourTopic(idTopic, title)
示例#10
0
def supressionTopic(request):
    idTopic = request.form.get('idTopic')

    return Topic.supressionTopic(idTopic)
示例#11
0
def get_topics(board_id):
    if not board_id:
        return Topic.all()
    else:
        return [t for t in Topic.all() if t.board_id == int(board_id)]
示例#12
0
    print("Класс",klass1.get_number_today(), klass1.get_letter())
    print(klass1)
    print("----------------------------------------------------------------------")

    """----------------------------------------------------------------------"""
    """Учителя"""
    teacher1 = Teacher(first_name="Иванова", second_name="Мария", patronymic="Петровна")
    teacher2 = Teacher(first_name="Гунёва", second_name="Раисия", patronymic="Петровна")

    """----------------------------------------------------------------------"""
    """Предметы"""
    subject1 = Subject(item_name="Математика", teacher=teacher1)
    subject2 = Subject(item_name="Биология", teacher=teacher2)
    """----------------------------------------------------------------------"""
    """Темы занятий"""
    topic1 = Topic(name_topic="Дроби")
    topic2 = Topic(name_topic="Рациональные числа")
    topic3 = Topic(name_topic="Анатомия человека")
    topic4 = Topic(name_topic="Физиология человека")

    """----------------------------------------------------------------------"""
    """Изучается"""
    studying1 = Studying(hour=2, klas=klass1, syllabus=syllabus1, subject=subject1, teacher=teacher1)
    sub_topic = Subtheme(studying=studying1, topic=topic1)
    sub_topic1 = Subtheme(studying=studying1, topic=topic2)
    sub_topic2 = Subtheme(studying=studying1, topic=topic3)
    sub_topic3 = Subtheme(studying=studying1, topic=topic4)
    studying1.get_sub_themes().extend([sub_topic, sub_topic1, sub_topic2, sub_topic3])
    print(studying1)
    print("----------------------------------------------------------------------")
    """----------------------------------------------------------------------"""
示例#13
0
def step_impl(context, velocity_command, orientation_command):
    context.cmd_vel = Topic(u"/twist_mux/cmd_vel")
    # Publish supplied command to the topic and watch for feedback marker
    context.cmd_vel.rostopic_pub(u"geometry_msgs/Twist", velocity_command, orientation_command,
                                 u"publishing and latching message.")